  We present a method to analyse arrival directions of ultra-high-energy cosmic
rays (UHECRs) using a classifier defined by a deep convolutional neural network
trained on a HEALPix grid. To illustrate a high effectiveness of the method, we
employ it to estimate prospects of detecting a large-scale anisotropy of UHECRs
induced by a nearby source with an (orbital) detector having a uniform exposure
of the celestial sphere and compare the results with our earlier calculations
based on the angular power spectrum. A minimal model for extragalactic cosmic
rays and neutrinos by Kachelrie{\ss}, Kalashev, Ostapchenko and Semikoz (2017)
is assumed for definiteness and nearby active galactic nuclei Centaurus A, M82,
NGC 253, M87 and Fornax A are considered as possible sources of UHECRs. We
demonstrate that the proposed method drastically improves sensitivity of an
experiment by decreasing the minimal required amount of detected UHECRs or the
minimal detectable fraction of from-source events several times compared to the
approach based on the angular power spectrum. We also test robustness of the
neural networks against different models of the large-scale Galactic magnetic
fields and variations of the mass composition of UHECRs, and consider
situations when there are two nearby sources or the dominating source is not
known a~priori. In all cases, the neural networks demonstrate good performance
unless the test models strongly deviate from those used for training. The
method can be readily applied to the analysis of data of the Telescope Array,
the Pierre Auger Observatory and other cosmic ray experiments.
