/ising_neural_net

Phase classification of the Ising model with an Artificial Neural Network

Primary LanguagePython

Learning Ising

We present two schemes to classify the two phases the 2D Ising model with an Artifical Neural Network.

Ising

Following Machine Learning Phases of Matter a Feed Forward Neural Network with a single hidden layer is trained to classify the two phases of the model. The spin configurations are generated by sampling from the Boltzmann distribution with a Markov chain Monte Carlo algorithm.

Additionally, we implement the confusion scheme presented in Learning phases by confusion. The scheme combines supervised with unsupervised learning and allows to find the critical temperature without prior labeling of the data.

Running the programs

Generate training data

To use the neural network, you first need to generate spin configurations of the 2D Ising model over a range of temperatures by running:

python3 ising_lattice.py

This will generate the data and store it with an additional binary label that classifies the data into high and low temperature phases. Additionally, a plot will be generated that shows the magnetization as a function of temperature, this allows to visualize the phase transition.

magnetization_mc

Training and testing the Neural Network

To train and test the neural network you need to run:

python3 neural_net_ising.py

This will first train the neural network on the spin configurations and secondly test the network on a different set of data. The output of the network is plotted as a function of temperature. The output of the network is given by two neurons, one for classifying the high and one for the low temperature phase. The cross over of the two outputs indicates the critical temperature, that was learned form the training data.

magnetization_nn

This shows that the neural network is able to learn the order parameter of the phase transition with very high accuracy. Comparing the magnetization curve of the Monte Carlo simulation shows that the neural network is able to identify the magnetization as the relevant order parameter.

Confusion scheme

To run the confusion scheme you need to run:

python3 confusion_neural_net.py

The scheme allows to identify the the critical temperature by confusing the neural network with wrong lablels. Once the network is trained with the wrong labels, its accuracy is evaluated on the entire data set. The accuracy as a function of the label shows three peaks, two corresponding to labeling the entire set as one phase and one corresponding to the right label.

confusion_nn

The middle peak thus replicates the critical temperature obtained by the Monte Carlo simulation.

Authors

  • Stefan H Sack