Predictive coding narrows the gap between convolutional networks and human brain function in misspelled-word reading
Jiaxin You, Riitta Salmelin, and Marijn van Vliet (2026). "Predictive coding narrows the gap between convolutional networks and human brain function in misspelled-word reading".
This repo contains Python scripts for dataset generation, Predictive coding model training/evaluation, model-brain comparison and figure producing. The predictive-coding components in this work rely on Predify (GitHub).
Data
- Project data (non-personal) are stored on OSF: https://osf.io/8472e
- After downloading, set
data_dirinconfig.pyto the folder where you extracted the data.
Installation
The required Python packages are listed in requirements.txt. One way to install them is through pip:
pip install -r requirements.txt
Repository layout
00_dataset_generation.py: Prepare image stimuli and dataset for training and validating.01_train_backbone_model.py: Train the backbone feedforward CNN model.01_test_stimuli_backbone.py: Test the experimental stimuli on the trained backbone model.02_generate_pred_model.py: Generate predictive coding model architecture.03_train_feedback_weights.py: Train feedback components of predictive coding model.04_train_pcoder_hps.py: Hyperparameter optimation for predictive coding model using five-fold cross validation.05_Fig2b_model_behavior_mean_folds.py: Produce model behaviorly performance with hyperparameters averaged across folds (Figure 2b).05_Fig2c-d_model_behavior_median_fold.py: Produce model behavior with meidan hyperparameters across folds (Figure 2c-d).06_meg_rois_rdms.py/06_model_rdms.py: RDM computations for MEG ROIs and model representations.07_*: Computate RSA time courses between RDMs of model and parcel representation and plot the results.08_*: Linear mapping / ridge mapping from model to parcel representations and plot the results.config.py: Central configuration values used by scripts.pnet/: Predictive coding model architecture.