{'fraction_non_alphanumeric': 0.027172406144291023, 'fraction_numerical': 0.008428991293739255, 'mean_word_length': 4.926388432467959, 'pattern_counts': {'":': 0, '<': 0, '<?xml version=': 0, '>': 0, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 4, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
Discovering Phase Transitions with Unsupervised Learning

Unsupervised learning is a discipline of machine learning which aims at discovering patterns in big data sets or classifying the data into several categories without being trained explicitly. We show that unsupervised learning techniques can be readily used to identify phases and phases transitions of many body systems. Starting with raw spin configurations of a prototypical Ising model, we use principal component analysis to extract relevant low dimensional representations the original data and use clustering analysis to identify distinct phases in the feature space. This approach successfully finds out physical concepts such as order parameter and structure factor to be indicators of the phase transition. We discuss future prospects of discovering more complex phases and phase transitions using unsupervised learning techniques.

Unsupervised learning is a discipline of machine learning which aims at discovering patterns in big data sets or classifying the data into several categories without being trained explicitly. We show that unsupervised learning techniques can be readily used to identify phases and phases transitions of many body systems. Starting with raw spin configurations of a prototypical Ising model, we use principal component analysis to extract relevant low dimensional representations the original data and use clustering analysis to identify distinct phases in the feature space. This approach successfully finds out physical concepts such as order parameter and structure factor to be indicators of the phase transition. We discuss future prospects of discovering more complex phases and phase transitions using unsupervised learning techniques.
Classifying phases of matter and identifying phase transitions between them is one of the central topics of condensed matter physics research. Despite an astronomical number of constituting particles, it often suffices to represent states of a many-body system with only a few variables. For example, a conventional approach in condensed matter physics is to identify order parameters via symmetry consideration or analyzing low energy collective degree of freedoms and use them to label phases of matter [1].
However, it is harder to identify phases and phase transitions in this way in an increasing number of new states of matter, where the order parameter may only be defined in an elusive nonlocal way [2]. These new developments call for new ways of identifying appropriate indicators of phase transitions.
To meet this challenge, we use machine learning techniques to extract information of phases and phase transitions directly from many-body configurations. In fact, application of machine learning techniques to condensed matter physics is a burgeoning field [3][4][5][6][7][8][9][10][11][12][13][33]. For example, regression approaches are used to predict crystal structures [3], to approximate density functionals [6], and to solve quantum impurity problems [10]; artificial neural networks are trained to classify phases of classical statistical models [13]. However, most of those applications use supervised learning techniques (regression and classification), where a learner needs to be trained with the previously solved data set (input/output pairs) before it can be used to make predictions.
On the other hand, in the unsupervised learning, there is no such explicit training phase. The learner should by itself find out interesting patterns in the input data. Typical unsupervised learning tasks include cluster analysis and feature extraction. Cluster analysis divides the input data into several groups based on certain measures of similarities. Feature extraction finds a low-dimensional representation of the dataset while still preserving essential characteristics of the original data. Unsupervised learning methods have broad applications in data compression, visualization, online advertising and recommender system, etc. They are often being used as a preprocessor of supervised learning to simplify the training procedure. In many cases, unsupervised learning also lead to better human interpretations of complex datasets.
In this paper, we explore the application of unsupervised learning in many-body physics with a focus on phase transitions. The advantage of unsupervised learning is that one assumes neither the presence of the phase transition nor the precise location of the critical point. Dimension reduction techniques can extract salient features such as order parameter and structure factor from the raw configuration data. Clustering analysis can then divide the data into several groups in the low-dimensional feature space, representing different phases. Our studies show that unsupervised learning techniques have great potentials of addressing the big data challenge in the many-body physics and making scientific discoveries.
As an example, we consider the prototypical classical Ising model where the spins take two values σ i = {−1, +1}. We consider the model (1) on a square lattice with periodic boundary conditions and set J = 1 as the energy unit.
The system undergoes a phase transition at temperature T /J = 2/ln(1 + √ 2) ≈ 2.269 [14]. A discrete Z 2 spin inversion symmetry is broken in the ferromagnetic phase below T c and is restored in the disordered phase at temperatures above T c .
We generate 100 uncorrelated spin configuration samples using Monte Carlo simulation [15] at temperatures T /J = 1.6, 1.7, . . . , 2.9 each and collect them into an M × N matrix in the matrix denote σ i = ±1. Such a matrix is the only data we feed to the unsupervised learning algorithm.
Our goal is to discover possible phase transition of the model (1) without assuming its existence. This is different from the supervised learning task, where exact knowledge of T c was used to train a learner [13]. Moreover, the following analysis does not assume any prior knowledge about the lattice geometry and the Hamiltonian. We are going to use the unsupervised learning approach to extract salient features in the data and then use this information to cluster the samples into distinct phases. Knowledge about the temperature of each sample and the critical temperature T c of the Ising model is used to verify the clustering.
Interpreting each row of X as a coordinate of an Ndimensional space, the M data points form a cloud centered around the origin of a hypercube [34]. Discovering a phase transition amounts to find a hypersurface which divides the data points into several groups, each representing a phase. The task is akin to the standard unsupervised learning technique: cluster analysis [16], where numerous algorithms are available, and they group the data based on different criteria.
However, direct applying clustering algorithms to the Ising configurations may not be very enlightening. The reasons are twofold. First, even if one manages to separate the data into several groups, clusters in high dimensional space may not directly offer useful physical insights. Second, many clustering algorithms rely on a good measure of similarity between the data points. Its definition is, however, ambiguous without supplying of domain knowledge such as the distance between two spin configurations.
On the other hand, the raw spin configuration is a highly redundant description of the system's state because there are correlations among the spins. Moreover, as the temperature varies, there is an overall tendency in the raw spin configurations, such as lowering the total magnetization. In the following, we will try to first identify some crucial features in the raw data. They provide an effective low dimensional representation of the original data. And in terms of these features, the meaning of the distance between configurations becomes more transparent. The separation of phases is also often clearly visible and comprehensible by the human in the reduced space spanned by these features. Therefore, feature extraction does not only simplifies the subsequent clustering analysis but also provides effective means of visualizing and offering physical insights. We denote the crucial features extracted by the unsupervised learning as indicators of the phase transition. In general, they do not necessarily need to be the same as the conventional order parameters defined in condensed matter physics. This unsupervised learning approach nevertheless provides an alternative view of phases and phase transitions. Principal component analysis (PCA) [17] is a widely used feature extraction technique. The principal components are mutually orthogonal directions along which the variances of the data decrease monotonically. PCA finds the principal components through a linearly transformation of the original coordinates Y = XW . When applied to the Ising configurations in Eq. (2), PCA finds the most significant variations of the data changing with the temperature. We interpret them as relevant features in the data and use them as indicators of the phase transition if there is any.
We write the orthogonal transformation into column vectors W = (w 1 , w 2 , . . . , w N ) and denote w as weights The eigenvalues are nonnegative real numbers sorted in a descending order λ 1 ≥ λ 2 . . . ≥ λ N ≥ 0. Using the terminology of PCA, we denote the normalized eigenvaluesλ = λ / N =1 λ as explained variance ratio. When keeping only the first few principal components, PCA is an efficient dimension reduction approach which captures most variations of the original data. Moreover, PCA also yields an optimal approximation of the data in the sense of minimizing the squared reconstruction error [18]. Figure 1 shows the first few explained variance ratios for various system sizes. Notably, there is only one dominant principal component. As the temperature changes the Ising configurations vary most significantly along the first principal component, whose weight is shown in the inset of Fig. 1. The flat distribution all over the lattice sites means the transformation actually gives the uniform magnetization 1 N i σ i . In this sense, PCA has identified the order parameter of the Ising model (1) upon a phase transition.
Next, we project the samples in the space spanned by the first two principal components, shown in Figure 2. The color of each sample indicates its temperature. The projected coordinates are given by the matrix-vector product The variation of the data along the first principal axis y 1 is indeed much stronger than that along the second principal axis y 2 . Most importantly, one clearly observes that as the system size enlarges the samples tend to split into three clusters. The high-temperature samples lie around the origin while the low-temperature samples lie symmetrically at finite y 1 . The samples at the critical temperature (light yellow dots) have broad spread because of large critical fluctuations. We note that Ref. [13] presents a different low dimension visualization of the Ising configurations using stochastic neighbor embedding technique. When folding the horizontal axis of Fig. 2 into i |σ i | or ( i σ i ) 2 the two clusters associated with the lowtemperature phase merge together. With such a linear separable low dimensional representation of the original data, a cluster analysis [36] can easily divide the samples into two phases, thus identifying the phase transition. Notice that our unsupervised learning analysis does not only finds the phase transition and an estimate of the critical temperature but also provides insight into the order parameter.
Having established the baseline of applying the unsupervised learning techniques in the prototypical Ising model, we now turn to a more challenging case where the learner can make nontrivial findings. For this, we consider the same Ising model Eq. (1) with a conserved order parameter (COP) i σ i ≡ 0. This model describes classical lattice gasses [19], where the occupation of each lattice site can be either one or zero and the particles interact via a short-range attraction. The conserved total magnetization corresponds to the constraint of a half filled lattice.
On a square lattice with periodic boundary conditions, the spins tend to form two domains at low-temperatures shown in Fig. 3(a,b). The two domain walls wrap around the lattice either horizontally or vertically to minimize the domain wall energy [19]. Besides, the domains can also shift in space due to translational invariance. As the temperature increases, these domain walls melt and the system restores both the translational and rotational symmetries in the high-temperature phase shown in Fig. 3(c). At zero total magnetization, the critical temperature of such solid-gas phase transition is the same as the Ising transition T c /J ≈ 2.269 [20]. However, since the total magnetization is conserved, simply summing up the Ising spins can not be used as an indicator to distinguish the two phases. In fact, it is unclear to the author which quantity signifies the phase transition before this study. It is, therefore, a good example to demonstrate the ability of the unsupervised learning approach.
We perform the same PCA on the COP Ising configurations sampled with Monte Carlo simulation [19] and show the first few explained variance ratios in Fig. 4. Notably, there are four instead of one leading principal components. Their weights plotted in the insets of Fig. 4 show notable nonuniformity over the lattice sites. This indicates that in the COP Ising model the spatial distribution of the spins varies drastically as the temperature changes. Denote Euclidean coordinate of site i as (µ i , ν i ), where µ i , ν i = 1, 2, . . . , √ N . The weights of the four leading principal components can be written as cos(θ i ), cos(φ i ), sin(θ i ), sin 37]. Note these four mutually orthogonal weights correspond to the two orientations of the domain walls shown in Fig. 3(a,b). Therefore, the PCA correctly finds out the rotational symmetry breaking caused by the domain wall formation.
To visualize the samples in the four-dimensional feature space spanned by the first few principal components, we plot two-dimensional projections in Fig. 5. In all cases, the high-temperature samples are around the origin while the low-temperature samples form a surrounding cloud. Motivated by the circular shapes of all these projections, we further reduce to a two-dimensional space via a nonlinear transformation (y 1 , y 2 , y 3 , y 4 ) → (y 2 1 + y 2 2 , y 2 3 + y 2 4 ). As shown in Fig. 6(a), the line 4 =1 y 2 = const (a four dimensional sphere of a constant radius) separates the low and high temperature samples. This motivates a further dimension reduction to a single variable 4 =1 y 2 as an indicator of the phase transition in the COP Ising model.
Substituting weights of the four principal components cos(θ i ), cos(φ i ), sin(θ i ), sin(φ i ), the sum 4 =1 y 2 is pro- portional to Even though such structure factor was unknown to the author before it was discovered by the learner, one can convince himself it indeed captures the domain wall formation at low temperatures shown in Fig. 3(a,b). Figure 6(b) shows the structure factor versus temperature for various system sizes. It decreases as the temperature increases and clearly serves as a good indicator of the phase transition. We emphasis that the input spin configurations contain no information about the lattice geometry nor the Hamiltonian. However, the unsupervised learner has by itself extracted meaningful information related to the breaking of the orientational order. Therefore, even without the knowledge of the lattice and the analytical understanding of the structure factor Eq. (5), 4 =1 y 2 plays the same role of separating the phases in the projected space.
It is interesting to compare our analysis of phase transitions to standard imagine recognition applications. In the Ising model example, the learner essentially finds out the brightness of the imagine i σ i as an indicator of the phase transition. While in the COP Ising model example, instead of detecting sharpness of the edges (melting of domain walls) following the ordinary imagine recognition routine, the PCA learner finds out the structure factor Eq. (5) related to symmetry breaking, which is a fundamental concept in phase transition and condensed matter physics.
Considering PCA is arguably one of the simplest unsupervised learning techniques, the obtained results are rather encouraging. In essence, our analysis finds out the dominant collective modes of the system related to the phase transition. The approach can be readily generalized to more complex cases such as models with emergent symmetry and order by disorder [21]. The unsupervised learning approach is particularly profitable in the case of hidden or multiple intertwined orders, where it can help to single out various phases.
Although nonlinear transformation of the raw configuration Eq. (5) was discovered via visualization in Fig. 5, simple PCA is however limited to linear transformations. Therefore, it remains challenging to identify more subtle phase transitions related to the topological order, where the indicators of the phase transition are nontrivial nonlinear functions of the original configurations. For this purpose, it would be interesting to see if a machine learning approach can comprehend concepts such as duality transformation [22], Wilson loop [23] and string order parameter [24]. A judicial apply of kernel techniques [25] or neural network based deep autoencoders [26] may achieve some of these goals.
Furthermore, although our discussions focus on thermal phase transitions of the classical Ising model, the unsupervised learning approaches can also be used to analyze quantum many-body systems and quantum phase transitions [27]. In these applications, diagnosing quantum states of matter without knowledge of Hamiltonian is a useful paradigm for cases with only access to wavefunctions or experimental data.