  Using a supervised neural network (NN) trained once on a one-dimensional
lattice of 200 sites, we calculate the Berezinskii--Kosterlitz--Thouless phase
transitions of the two-dimensional (2D) classical $XY$ and the 2D generalized
classical $XY$ models. In particular, both the bulk quantities Binder ratios
and the spin states of the studied systems are employed to construct the needed
configurations for the NN prediction. By applying semiempirical finite-size
scaling to the relevant data, the critical points obtained by the NN approach
agree well with the known results established in the literature. This implies
that for each of the considered models, the determination of its various phases
requires only a little information. The outcomes presented here demonstrate
convincingly that the employed universal NN is not only valid for the symmetry
breaking related phase transitions, but also works for calculating the critical
points of the phase transitions associated with topology. The efficiency of the
used NN in the computation is examined by carrying out several detailed
benchmark calculations.
