- Home
- Library
- Computational Quantum Field Theory
- Predicting Observables across Parameters
- Learning Phases and Collective Variables
Learning Phases and Collective Variables
A projection of spin configurations can reveal a collective coordinate without being told the magnetization. The next question is physical: what does that coordinate measure, which information has it discarded, and what survives a change of volume?
We answer these questions with principal-component analysis (PCA) on exact independent samples of two small periodic Ising systems. Their complete finite-volume distributions are available, so sampling error can be compared with an exact covariance. The learned leading direction closely follows magnetization. The finite boxes nevertheless have no thermodynamic singularity, and a single coordinate does not determine their energy.
Preparation. Covariance matrices, the variational characterization of an eigenvector, and the distinction between training and testing a physical observable. The equivariant-map article addresses a different question: imposing a transformation law on a map before fitting it.
A finite ensemble with a known answer
Let on the periodic square , with . In units the Hamiltonian and probability are
Each positive-coordinate bond is counted once. The periodic boundary condition is part of the model. Define total magnetization , magnetization density , and energy density .
At zero external field, , so in every finite box. This does not imply that a typical low-temperature configuration has small . It means that the two signs have equal probability. The original PCA study of raw Ising configurations provides the motivating example; its numerical system sizes and Monte Carlo data are distinct from the finite exact calculation here. Wang 2016, Eqs. (1)–(4) and Fig. 1 discussion.
For , there are respectively and states. We enumerate them, compute their Boltzmann weights, and draw directly from the resulting categorical distribution. The fixed temperatures are
Each size and temperature supplies training configurations and another independent test configurations. This removes Markov-chain equilibration and autocorrelation as issues in this particular experiment. It does not remove finite-sample fluctuations.
The partition function has an independent row-transfer check. For row configurations , put
and
In a product of row-transfer factors, each row's two half-horizontal contributions add to one complete horizontal energy, and each adjacent row pair contributes its vertical bonds once. The trace closes the second periodic direction. The largest difference between this calculation and complete enumeration is in over the retained cases. This tests the ensemble normalization and edge counting independently of PCA.
The learned direction is an optimization result
At one fixed size, concatenate the five training groups into a matrix , where . Every row is a raw spin configuration. No energy, magnetization or temperature labels enter the eigensolve.
Use the empirical training mean and covariance,
For a unit vector , the variance of the projected centered data is . A Lagrange multiplier for gives
The leading vector maximizes that variance; the following vectors maximize it subject to orthogonality. For a rank- orthogonal projection, the mean squared reconstruction loss is the sum of omitted eigenvalues, up to the normalization used in (5). Thus PCA optimizes a specified quadratic compression criterion. It does not optimize sensitivity to every physical observable.
The explained-variance fractions are
A large means that one linear direction captures much of this ensemble's variation.
Why the exact leading direction is uniform
The exact covariance of the equally weighted temperature mixture is
No mean subtraction appears because the exact spin means vanish. Translation invariance makes every row sum equal. Consequently the normalized uniform vector is an eigenvector, with eigenvalue
Why is it the leading eigenvector? For a connected finite ferromagnet at positive inverse temperature, every two-point function is strictly positive. One way to see the sign is to expand each bond factor as . The partition-function spin sum selects edge subsets with even degree at every vertex. In the numerator of , it instead selects odd degree at and even degree elsewhere. Every surviving term is positive, and a path joining and supplies at least one such term.
Therefore is an entrywise strictly positive matrix. The Perron–Frobenius theorem gives a unique positive leading eigenvector. Since is already positive and an eigenvector, it is that leading vector. This derives the magnetization interpretation without imposing on the empirical fit:
At infinite temperature the conclusion changes. Independent spins give , so all eigenvalues are equal and no direction is preferred. Translation symmetry alone does not select a unique principal component. Similarly, constraining removes the uniform fluctuation entirely; other correlations must then carry the variation.
Centering changes the coordinate's transformation law
Orient the fitted by requiring . Its sign is otherwise arbitrary. Retain two coordinates,
The centered score is the conventional PCA coordinate. The coordinate is exactly odd under spin flip:
An empirical centering offset can therefore move the apparent symmetry center of a scatter plot. It is not evidence for a physical external field. Our training samples were not artificially paired with their spin flips. Such pairing would enforce a zero empirical mean but would not create twice as many independent observations.
The fitted vectors are close to uniform:
| Size | Leading variance fraction | Overlap with | Centering offset |
|---|---|---|---|
The exact pooled leading eigengaps are and , respectively; the empirical covariance differs from the exact one in operator norm by and . The stable leading direction has a quantitative spectral explanation. These numbers describe two separately fitted maps, with different input dimensions.
The figure compares the actual variance spectrum with a physical test of the learned coordinate. The latter uses independent configurations and the exact finite-volume magnetization variance.
Left: empirical explained-variance fractions from separate pooled-temperature PCA fits. Right: independent-test means of with configuration standard errors, compared with exact at each temperature. The points and curves are nearly coincident because the fitted leading vectors are close to uniform. The smooth finite-volume change is not a determination of a thermodynamic critical point.
Test against observables, not only clusters
At , independent tests give the following comparisons. The RMSE is between and the exact configuration magnetization ; the correlation is between and .
| Size | Coordinate RMSE | Energy correlation | Test |
|---|---|---|---|
The errors on the means use independent configurations. They are conditional on the one fitted training map; they do not estimate variation across retraining experiments. All temperatures and both sizes are retained in the companion results.
The strong energy correlation has a simple interpretation: strongly aligned configurations tend to have both large and low energy. It is not an invertible relation. Domain walls change the energy even at fixed magnetization, as the second exercise makes explicit.
A size-independent normalized interpretation, , is useful. It is still not zero-shot size transfer of a single PCA model. A vector with nine entries cannot directly act on a sixteen-component spin array. The periodic local-prediction example supplies a genuinely shared local rule that can act on both sizes.
Finally, for every fixed finite , is a finite sum of positive exponentials for . Its logarithm and the observables above are analytic. Separated clusters or a rapid variation can suggest an order parameter and motivate a finite-size study. Establishing a phase transition requires control of a thermodynamic limit and its scaling, not a classifier boundary or these two tiny boxes. Odd also has odd , so an exactly zero magnetization configuration is absent; even the discrete support of a plot depends on volume.
To test critical behavior, the finite-square Ising crossing calculation compares dimensionless magnetization moments across sizes. A direction learned from configurations at one size can identify a magnetization coordinate without establishing its infinite-volume scaling.
Reproduction
The pure ensemble is implemented in ising_samples.py; collective_checks.py creates or reuses the fixed sample archive and writes collective-results.json under examples/computational-qft/machine-learning/. It retains all temperature cells, exact covariance spectra, empirical centering, independent sample errors and partition checks. The data seeds are fixed before drawing; no fluctuation was replaced. The plotter reads those results without resampling. The chapter companion README gives the commands and archive contract.
Summary
A principal component is a variance-maximizing direction for a specified distribution. In the finite ferromagnetic Ising ensemble its leading exact direction is uniform, so a learned leading coordinate can be identified with magnetization and tested quantitatively. Centering, finite volume, sector constraints and omitted observables determine what that identification does—and does not—establish.
Exercises
1. Covariance, susceptibility and a finite peak
Add a uniform field through . Derive the susceptibility per site and relate it to the uniform covariance eigenvalue at one temperature. Explain why a peak of on a finite lattice is not by itself a phase-transition proof.
Solution
Differentiating a normalized Gibbs expectation gives
At zero field the finite system has . Translation invariance gives and . Hence
This relation is for a single-temperature covariance. A covariance pooled over temperatures is a mixture; one cannot assign it a single susceptibility by inserting an arbitrary temperature.
The finite partition sum and its derivatives are analytic for , and bounds . A smooth peak records enhanced finite-volume fluctuations. A singular thermodynamic response requires an appropriate growing-volume limit, with systematic finite-size analysis.
2. Same magnetization, different energy
On a periodic square, compare the stripe with the checkerboard . Compute for each. What does this imply for a magnetization-only representation? How does empirical centering affect its spin-flip parity?
Solution
Both configurations have eight positive and eight negative spins, so . In the stripe, the sixteen bonds in the constant direction all have product . In the other direction, each row has two aligned and two anti-aligned bonds; their sum is zero. Thus .
Every nearest-neighbor checkerboard bond is anti-aligned. There are such bonds, so . Therefore the exact uniform coordinate assigns the same value to configurations whose energies differ by . A small empirical nonuniformity in does not turn a single approximate magnetization coordinate into a complete energy representation.
For any fixed linear vector , the uncentered coordinate is odd. Centering gives . The origin of the centered plot is a statistical convention, while the physical spin-flip center is fixed by the transformation of the input.
References
- L. Wang, “Discovering Phase Transitions with Unsupervised Learning,” Physical Review B 94, 195105 (2016), journal article; arXiv:1606.00318v2, especially Eqs. (1)–(4) and the unconstrained and fixed-magnetization examples.
Scrollable formula. Use Left and Right arrow keys to reveal hidden content.
Scrollable table. Use Left and Right arrow keys to reveal hidden columns.
Scrollable figure. Use Left and Right arrow keys to reveal hidden content.