  We propose a machine learning method to investigate the propagation of cosmic
rays based on the precisely measured spectra of the primary and secondary
cosmic ray nuclei of Li, Be, B, C, and O from AMS-02, ACE, and Voyager-1. We
train two convolutional neural networks. One network learns how to infer
propagation and source parameters from the energy spectra of cosmic rays, and
the other network, which is similar to the former, has the flexibility to learn
from the data with added artificial fluctuations. Together with the simulated
data generated by GALPROP, we find that both networks can properly invert the
propagation process and infer the propagation and source parameters reasonably
well. This approach can be much more efficient than the traditional Markov
chain Monte Carlo fitting method for deriving the propagation parameters if
users choose to update confidence intervals with new experimental data. Both of
the trained networks are available at (https://github.com/alan200276/CR_ML).
