  In recent years, developing unsupervised machine learning for identifying
phase transition is a research direction. In this paper, we introduce a
two-times clustering method that can help select perfect configurations from a
set of degenerate samples and assign the configuration with labels in a manner
of unsupervised machine learning. These perfect configurations can then be used
to train a neural network to classify phases. The derivatives of the predicted
classification in the phase diagram, show peaks at the phase transition points.
The effectiveness of our method is tested for the Ising, Potts, and Blume-Capel
models. By using the ordered configuration from two-times clustering, our
method can provide a useful way to obtain phase diagrams.
