This repository contains code used to generate the neural network model figure from the manuscript:
Blanco-Pozo, M., Akam, T., & Walton, M. (2023). Dopamine-independent effect of rewards on choices through hidden-state inference. Nature Neuroscience 27.2 (2024): 286-297.
The model consists of a recurrent neural network representing prefrontal cortex (PFC) and a feedforward network representing basal-ganglia. The PFC network is trained to predict the next observation and in doing so learns to infer hidden task states. The basal ganglia network is trained using actor-critic RL (A2C) to predict future reward and choose appropriate actions given the current observation and PFC activity.
The main branch of the repository contains the original Tensorflow/Keras implementation of the model used in the manuscript. The pyTorch branch contains a re-implementation of the model in pyTorch by @dylanhxzhao.
The file run_experiment.py in the code folder contains functions to run a simulation experiment and analyse the data.
run_experiments()runs 12 simulation runs each for the two model variants shown in the figure and saves the data in thedatafolder.analyse_experiments()loads the saved data and runs the analyses, saving figure panels and stats output in theplotsfolder.
- Python 3
- tensorflow
- numpy
- pandas
- matplotlib
- seaborn
- scipy
- scikit-learn
- statsmodels
The figure was generated using Python 3.10.8 and the package versions listed in requirements.txt
