Accompanying code for the manuscript "Structured event memory: a neuro-symbolic model of event cognition", Franklin, Norman, Ranganath, Zacks, and Gershman (in press), Psychological Review, preprint
Contains the SEM model, a few basic demonstrations, and the all of the simulations in the paper. An up-to-date version of the model (but not the simluations) can be found in the following github repository: https://github.com/nicktfranklin/SEM2
The main code is listed in the models
module:
models.sem
: contains the code for the SEM modelmodels.event_models
: contains code for the various neural network models used by SEM. They all share a similar structures
There is runnable code in Jupyter notebooks:
Tutorials
: Contains tutorials, runnable in Google Colab.PaperSimulations
: Contains the simulations presented in the paper. These have been designed to run locally, with the dependencies listed in the enviornments.yml file and have not been tested in colab. These have been pre-run and can be opened on github without installation.
This library run on Python 2.7 and uses the tensorflow and keras and libraries for neural networks.
I recommend using Anaconda python and a virtual environment. You can find instructions to install Anaconda here.
Once you have anaconda installed, you can install a virtual environment by running
conda env create --file environment.yml
This will install everything you need to run the Jupyter notebooks. Note that all of the simulations were run with these packages versions and may not work with more recent versions (for example, TensorFlow is under active development).
You'll need to activate the virtual environments and open jupyter to access the demonstration notebooks. To do so, run
conda activate sem
jupyter notebook
To deactivate the virtual environment, run
conda deactivate
Note: if these instructions do not work for some reason, the critical libraries the model uses are:
- Anaconda Python 2.7
- Tensorflow v1.9
- Keras v2.2.0