Code to replicate results in:
"Statistical mechanics of vector Hopfield network near and above saturation"
Authors: Flavio Nicoletti, Francesco D'Amico, Matteo Negri
where
where
srccontains the classesruncontains scripts to run various experimentsplotcontains scripts to make plots quickly
The file hopfield.py in src contains the class VectorHopfield, which implements the basic functions to create a dataset of random examples, build the Hebb rule and run the dynamics, both in the synchronous and asynchronous fashion.
The basic usage is to declare an instance of the class and call its method run_dynamics():
import src.hopfield as H
## generate the model
N=500; d=2; P=20
model = H.VectorHopfield(N,d,P)
## check if the first example is a stable fixed point
q, it = model.run_dynamics(model.examples[0,:,:])
## print the final magnetization q
print(N,d,P,q)graphscontains notebooks and data to reproduce plots for Section 3 (below saturation)notebooks_first_stepcontains notebook and data to reproduce plots for Section 4 (above saturation)
Those notebooks contain both the code to produce the data with simulations and the data produced to reproduce the plots