  The applicability of artificial neural networks (ANNs) is typically limited
to the models they are trained with and little is known about their
generalizability, which is a pressing issue in the practical application of
trained ANNs to unseen problems. Here, by using the task of identifying phase
transitions in spin models, we establish a systematic generalizability such
that simple ANNs trained with the two-dimensional ferromagnetic Ising model can
be applied to the ferromagnetic $q$-state Potts model in different dimensions
for $q \geq 2$. The same scheme can be applied to the highly nontrivial
antiferromagnetic $q$-state Potts model. We demonstrate that similar results
can be obtained by reducing the exponentially large state space spanned by the
training data to one that comprises only three representative configurations
artificially constructed through symmetry considerations. We expect our
findings to simplify and accelerate the development of machine
learning-assisted tasks in spin-model related disciplines in physics and
materials science.
