  We propose two machine-learning methods based on neural networks, which we
respectively call the phase-classification method and the
temperature-identification method, for detecting different types of phase
transitions in the XXZ models without prior knowledge of their critical
temperatures. The XXZ models have exchange couplings which are anisotropic in
the spin space where the strength is represented by a parameter $\Delta(>0)$.
The models exhibit the second-order phase transition when $\Delta>1$, whereas
the Berezinskii-Kosterlitz-Thouless (BKT) phase transition when $\Delta<1$. In
the phase-classification method, the neural network is trained using spin or
vortex configurations of well-known classical spin models other than the XXZ
models, e.g., the Ising models and the XY models, to classify those of the XXZ
models to corresponding phases. We demonstrate that the trained neural network
successfully detects the phase transitions for both $\Delta>1$ and $\Delta<1$,
and the evaluated critical temperatures coincide well with those evaluated by
conventional numerical calculations. In the temperature-identification method,
on the other hand, the neural network is trained so as to identify temperatures
at which the input spin or vortex configurations are generated by the Monte
Carlo thermalization. The critical temperatures are evaluated by analyzing the
optimized weight matrix, which coincide with the result of numerical
calculation for the second-order phase transition in the Ising-like XXZ model
with $\Delta=1.05$ but cannot be determined uniquely for the BKT transition in
the XY-like XXZ model with $\Delta=0.95$.
