Python code for our paper "Adversarial Domain Adaptation for Identifying Phase Transitions"
Switch branches/tags
Nothing to show
Clone or download
Fetching latest commit…
Cannot retrieve the latest commit at this time.
Failed to load latest commit information.

This is the computational appendix for the following paper:

Patrick Huembeli, Alexandre Dauphin, Peter Wittek. Identifying Quantum Phase Transitions with Adversarial Neural Networks. Physical Review B, 97:134109, 2018. DOI:10.1103/PhysRevB.97.134109

DOI for this Git repository DOI


To train the DANN, you need a few changes to the Keras source files. We recommend to make a new environment for this. We assume that the Python distribution is Anaconda. Create and activate a new environment:

$ conda create -n dann anaconda
$ source activate dann

Replace in /home/USERNAME/.conda/pkgs/keras-2.0.5-py36_0/lib/python3.6/site-packages/keras/engine by the file in the folder. The file is the original. Keep it, just in case. If the path cannot be found, start Python and type:


import keras as ker 'ker.file'

Files to Generate States

  • Produces Kitaev states

  • Produces SSH states for OBC and PBC and calculates also the winding number and gives a plot of it.

  • To do the same for long range SSH, replace the Hamiltonian in this file with the Hamiltonian from


  • generates the Ising configurations via Monte Carlo method. The code has been made faster by using the beginning of each Markov chain more than once.
  • is a normal convolutional neural network, that can give the same output as the DANN.

Files for the neural network

  • Main file for the DANN, with all the parameters.
  • First there is specified, which data has to be loaded. Then there is a section for the training, one for the preddiction / evaluation of the DANN, and the last part is to apply unsupervised techniques on the feature space directly. and

  • is the new file that has to be placed in the keras backend.
  • is a backup of the original file.