Untapped Potential in Self-Optimization of Hopfield Networks: The Creativity of Unsupervised Learning
This repository contains the code used for the paper "Untapped Potential in Self-Optimization of Hopfield Networks: The Creativity of Unsupervised Learning" (Artificial Life, arXiv).
- SO_base.py - Main file. Uses the custom containers in containers.py, the parameters in paramfiles/modularprob.py, and calls for SO_base_FUNC.py to run the simulations. Calls for SO_base_plots.py to generate figures 2-9 in the paper.
- SO_base_plots.py - Calls for SO_for_SAT.py and borders.py, and contains various plot functions to generate figures 2-9.
- SO_base_FUNC.py - Calls for hebbclean.F90 to run the simulation in FORTRAN. Contains functions from SO-scaled-up to generate random weight matrices.
- hebbclean.F90 - Contains the FORTRAN routine.
- containers.py - Contains custom containers.
- paramfiles/modularprob.py - Folder that contains all the parameters.
To replicate the figures in the paper, modify the following parameters in the paramfiles/modularprob.py file:
- For Figures 2-4, and 8-9:
- Set
CO.alphaGrid = TrueandCO.num_alphas = 1(for Fig. 3 also setplot6 = Truein SO_base.py).
- Set
- For Figures 5-6:
- Set
CO.alphaGrid = FalseandCO.num_alphas = 64.
- Set
- For Figure 7:
- Set
CO.alphaGrid = False,CO.num_alphas = 1andCO.resets_arr = [4000] * len(CO.alpha_arr)in line 33 of the code.
- Set
Make sure your system has gfortran and f2py. Run the following commands before the execution of the python code to compile the FORTRAN file:
f2py3 --f90flags="-g -fdefault-integer-8 -O3" -m hebbF -c hebbclean.F90
Current code is written to run the explicitly with FORTRAN (plots are generated in Python). To run the simulation in Python only see SO-scaled-up.
If you have any questions, feel free to open an issue or send me an email: natalya.weber (at) alumni.oist.jp.
If you use our code for your research, consider citing our paper:
@article{weber_untapped_2025,
title = {Untapped {{Potential}} in {{Self-Optimization}} of {{Hopfield Networks}}: {{The Creativity}} of {{Unsupervised Learning}}},
shorttitle = {Untapped {{Potential}} in {{Self-Optimization}} of {{Hopfield Networks}}},
author = {Weber, Natalya and Guckelsberger, Christian and Froese, Tom},
year = 2025,
month = oct,
journal = {Artif Life},
pages = {1--30},
publisher = {MIT Press},
issn = {1064-5462},
doi = {10.1162/ARTL.a.10},
abstract = {The self-optimization (SO) model can be considered as the third operational mode of the classical Hopfield network, leveraging the power of associative memory to enhance optimization performance. Moreover, it has been argued to express characteristics of minimal agency, which renders it useful for the study of Artificial Life. In this article, we draw attention to another facet of the SO model: its capacity for creativity. Drawing on creativity studies, we argue that the model satisfies the necessary and sufficient conditions of a creative process. Moreover, we show that learning is needed to find creative outcomes above chance probability. Furthermore, we demonstrate that modifying the learning parameters in the SO model gives rise to four different regimes that can account for both creative products and inconclusive outcomes, thus providing a framework for studying and understanding the emergence of creative behaviors in artificial systems that learn.}
}