Investigating ferromagnetic transitions using ML (Final Presentation)

Team members: Ashish Panigrahi and S. Gautameshwar.

For the midway progress of the project, see here. All the code used for this project is hosted on GitHub at this link. The slides for the presentation can be found here.

Overview of the Ising Model

Previously covered during the midway presentation, we deal briefly with the one-dimensional Ising model and in the second half of the project, present the two-dimensional Ising spin model consisting of either spin-\(\uparrow\) or spin-\(\downarrow\).

 Fig 1: 2D lattice consisting of spin-1/2 particles
Fig 1: 2D lattice consisting of spin-1/2 particles

The Hamiltonian of the Ising model is given by

\[ H(\sigma) = - \sum_{\langle i, j \rangle} J_{ij} \sigma_i \sigma_j \]

where the summation is carried over the first nearest neighbours i.e. \(j = i+1\) or \(j = i-1\). Hence the equivalent total "eigenenergy" of the lattice is similarly given by

\[ E(\sigma) = - \sum_{\langle i, j \rangle} J_{ij} \sigma_i \sigma_j \]

here \(\sigma_i = \pm1\), giving a scalar value for energy.

Pre-midway work

We investigated regression models for the one-dimensional Ising spin model consisting of 50 spin-1/2 particles. The idea was to be able to find the parameter quantifying interaction between the spin particles i.e. the coupling constant \(J\).

The assumption made was that the interaction is limited to only the first nearest neighbours of a spin particle (depicted by the notation \(\langle i, j \rangle\) under the summation in the equation for the Hamiltonian).

We trained our model using linear regression and its variants (Ridge and Lasso regression). Comparison between the various models was observed with linear regression giving a bad model due to overfitting. In contrast, Ridge and Lasso eliminated the problem of overfitting and gave us a fairly performant model.

To extend our model, we also experimented with the case where instead of a first-neighbour, extension of the interaction upto the second nearest neighbour was assumed and a model was trained on it using Ridge regression which gave us pretty good results.

Premise to investigating the 2D Ising model

The idea for post-midway work involving the two-dimensional Ising model is investigating 2D lattices made with spin-1/2 particles with the dynamics of the orientation of these particles governed by the temperature of the lattice where there exists a critical temperature \(T_c\) beyond which an originally ferromagnetic material becomes paramagnetic.

Analysis of the Monte-Carlo data for the model

 Plot of average energy as a function of temperature
Plot of average energy as a function of temperature
 Plot of heat capacity as a function of temperature
Plot of heat capacity as a function of temperature
[1] The unit for temperature is the natural units where we assume \(h = 1\), \(c = 1\) and so on.

Labelling data before supervised learning

While generating our data, we use a coupling strength value of \(J=2\). How does one proceed to determine the critical temperature? Theoretically shown by Onsager et al., \(T_c\) is given by

\[ T_c = J/ \log (1 + \sqrt{2}) \approx 2.26 \]

Afterwards, we split this data into critical and ordered/disordered sets and we expect the model to struggle in identifying the type of orderness of the lattices in the vicinity of the critical temperature.

Vicinity of critical temperature

In the left plot, the region marked red refers to the vicinity of the critical temperature where we label our lattices to be in the critical phase. The whole premise is for the model, given a lattice configuration, be able to determine if the phase is ordered or disordered.

Random Forests: the way to go?

Implementation of Random Forests

We used scikit-learn to implement our algorithm. The training was done on our ordered and disordered lattice datasets using the RF classifier scheme. However, the critical lattice samples were not used for training since we use it as a certificate for verifying the reliability of our model when classifying between the ordered and disordered phases especially within the critical regime (region we earlier marked red).

In the RF algorithm, two hyperparameters play significant roles in determining if our model works fairly well: - n_estimators i.e. the number of decision trees in our forest. - min_samples_split i.e. the leaf size (number of features) at each node.

During the implementation, we compared course trees (min_samples_split = 10000) with fine trees (min_samples_split = 2).

Results from Mehta et al.

Mehta et al. [1] implemented the random forests algorithm on Monte-Carlo generated data and as seen from the above plot, we see a training and testing score of almost 100%, which is expected since both the training and testing data were generated using the same Monte-Carlo approach.

However, the catch comes up when seeing the scores for critical samples. Accuracy scores of 69.2% and 83.1% were seen for course and fine trees respectively at 100 estimators each.

Is there a way we can improve on this score?

Transductive approach - an improvement to vanilla RF

Implementation of this weighted approach

We simply cloned (duplicated) the lattice Ising data for points that were closer to the critical temperature \(T_c\) in order to increase the weights for these lattices compared to the farther ones for which no further cloning was done.

 More weights given to points closer to the red region (compared to the ones far from it) who have more weights than their extremities
More weights given to points closer to the red region (compared to the ones far from it) who have more weights than their extremities

Results

 Training scores obtained with our approach
Training scores obtained with our approach
 Testing scores obtained with our approach
Testing scores obtained with our approach
 Critical scores
Critical scores

The results we obtained with our weighted approach shows an increase in the accuracy of our model when classifying critical samples compared to vanilla RF. Interestingly, by emphasising on lattice samples closer to the critical temperature \(T_c\), our approach works better for coarse trees with an accuracy of 92.0% compared to fine ones (88.75%).

Overall, we see a huge improvement over a vanilla RF critical score of 69.2%.

Conclusion

Limitations and future work

Bibliography

  1. Pankaj Mehta et al. “A high-bias, low-variance introduction to machine learning for physicists”. In: Physics reports 810 (2019), pp. 1-124

  2. Morningstar, Alan, and Roger G. Melko. "Deep learning the ising model near criticality." arXiv preprint arXiv:1708.04622 (2017).

  3. Breiman, Leo. "Random forests." Machine learning 45.1 (2001): 5-32.

  4. Deisenroth, Marc Peter, A. Aldo Faisal, and Cheng Soon Ong. Mathematics for machine learning. Cambridge University Press, 2020.