This has been tested on Julia 1.9.2. The checked-in manifest was resolved with Julia 1.9.3, so use Julia 1.9.x for the most reliable reproduction.
Code to recreate the numerical experiments in the paper is in the Experiments
folder. The root Project.toml and Manifest.toml contain the Julia
environment with the packages needed to run the files.
From the repository root, start Julia with the project environment active:
julia --project=.The first time you use the repository, instantiate the environment from the Julia REPL:
using Pkg
Pkg.instantiate()For one-off scripts, pass the environment on the command line:
julia --project=. path/to/script.jlThe main Curie-Weiss experiments are in Experiments/CW_tests. The scripts in
this folder use relative paths, so run them from inside that directory:
cd Experiments/CW_testsCollect samples and learn the Curie-Weiss model parameters:
julia --project=../.. cw_datacollect.jlThis writes or updates data_cw.jld2. The defaults match the plotting scripts:
n_spins = 5000, J * n_spins = 1.2, h = 0.04, Glauber sampling, and
M = 2^22, 2^24, ..., 2^32. These are large runs; edit the parameter lists near
the top of cw_datacollect.jl for smaller smoke tests.
Create the summary plots from data_cw.jld2:
julia --project=../.. cw_plotter.jlThis writes error_cw.pdf, prob_cw.pdf, and mag_cw.pdf.
Create the free-energy histogram plot:
julia --project=../.. free_energy_plotter.jlThis writes FE_histogram.pdf. If the cached sample file named in the script is
not present, the script will generate new Glauber samples, which can be slow.
Spin-glass learning experiments are in
Experiments/PottsSGLearning/n12_beta_sweep. These scripts use @__DIR__ to
find the repository paths, so they can be run from the repository root.
To reproduce the checked-in plots from the checked-in result files:
julia --project=. Experiments/PottsSGLearning/n12_beta_sweep/plotter.jl
julia --project=. Experiments/PottsSGLearning/n12_beta_sweep/plotter_energy.jl
julia --project=. Experiments/PottsSGLearning/n12_beta_sweep/plotter_panelb.jlThe scripts write:
n12_24_beta_sweep.pdffromresults.jld2andresults_n24.jld2n12_24_energy_sweep.pdffromresults.jld2andresults_n24.jld2n12_24_panelb.pdffromresults_panelb.jld2
To regenerate the result files before plotting, run:
julia --project=. Experiments/PottsSGLearning/n12_beta_sweep/datacollector.jl
julia --project=. Experiments/PottsSGLearning/n12_beta_sweep/datacollector_n24.jl
julia --project=. Experiments/PottsSGLearning/n12_beta_sweep/datacollector_panelb.jlThe Potts utilities used by these experiments live in PottsPSpin, and the
Potts pseudolikelihood learner is in
Experiments/PottsSGLearning/potts_sumoflocal_PLE.jl.
This code is provided under a BSD license as part of the Optimization, Inference and Learning for Advanced Networks project, C18014.