Models adaptive learning via surprise-driven attractor switching in cortical networks.
- Implements biologically-plausible attractor networks (PFC, Basal Ganglia, Mortor Cortex) that track latent environmental states
- PFC switches between discrete attractor states when entropy-based surprise signals exceed threshold
- Hebbian learning links PFC attractors to motor predictions via basal ganglia pathway
- Fits model to human behavioral data from changepoint detection tasks (McGuire & Nassar 2014)
- Generates publication figures comparing model and human peri-changepoint learning rates
run.py: main entry point for reproducing the analysis and figures.configs.py: shared paths, cache flags, figure settings, and multiprocessing settings.model/: network implementation, including the optional Cython-accelerated backend.tasks.py: helicopter-task generation for changepoint and reversal environments.analysis.py,fit.py,fit_line.py: behavioral analyses and subject/model fitting.simulations/: simulation helpers, including Figure 6 reversal analyses.visualization/: plotting and optional SVG figure assembly.data/: source data location plus generated outputs, caches, figures, and plots.
Most users should start with run.py.
The SIAS network consists of four interconnected RNN layers with distinct computational roles:
- Prefrontal cortex: Attractor states representing context
- Basal ganglia: Learning layer linking abstract states and concrete actions
- Thalamus: Implements push-pull attractor switching in PFC
- Sensorimotor cortex: Represents motor output and supervisory feedback
Learning occurs via Hebbian weight updates:
- PFC-to-BG weights learn context-action associations
- SMC-to-PFC weights (flexible model only) enable reversal learning
Subjects and models perform "helicopter tasks" with observations drawn from a hidden Gaussian source that undergoes changepoints:
- Latent state changes with hazard rate ~0.1
- Observations are noisy samples from current latent state
- Subjects predict next observation location
- Optimal behavior requires detecting changepoints and adjusting learning rate
Two variants of these tasks are analyzed here:
- Changepoint: Standard task with discrete state changes
- Reversal: States can return to previously visited values
Create or update the conda environment:
conda env update -f environment.yml --prune
conda activate leiaPut the required source data in:
data/source/
Then open run.py, choose which parts of the pipeline you want to run, and execute:
python run.pyGenerated outputs are written under data/results/, data/cache/, data/figures/, data/paper/figs, and data/plots/.
The model can run with a Cython backend for faster decision and learning phases. Build it with:
python setup_cython.py build_ext --inplaceIf the compiled backend is available, model/network.py loads it automatically. If not, the code falls back to the pure Python implementation.