This repository contains the code used in the preprint:
Yunrui Zhang, Emily S. Finn, Mert R. Sabuncu and Amy Kuceyeski
View, engage, predict: enhancing brain-behavior mapping with naturalistic movie-watching fMRI.
https://doi.org/10.1101/2025.07.28.666907
In this work, we present a novel deep neural network framework to predict cognitive scores and sex from fMRI functional connectivty(FC) during naturalistic movie viewing, and examine how movie content and its ability to synchronize brain activity across individuals relate to prediction performance.
To run cross-validation of the deep neural network and calculation of neural synchrony described in the paper, follow the instructions provided at the beginning of each script under the code/ directory. Detailed explanations for all input parameters can be found in the argument helper section at the top of each script.
- Static FC (sFC)–Behavior Prediction
To run clip- or session-level static FC predictions, navigate to the code/ directory and run:
python movie_sfc_behav_dnn.py --clip socialnet --behav CogTotalComp_Unadj --total_trs 164 --mlp_nodes 500 --mlp_activ relu --pc_num 100 --iter_no 0
- Dynamic FC (dFC)–Behavior Prediction
To run sliding-window dynamic FC predictions, navigate to the code/ directory and run:
python movie_dfc_behav_dnn.py --clip socialnet --behav CogTotalComp_Unadj --mlp_nodes 500 --mlp_activ relu --pc_num 100 --start_tr 0 --end_tr 60 --iter_no 0
- Region-Level Neural Synchrony
To calculate region-level neural synchrony for a specific movie clip or rest session, navigate to the code/ directory and run:
python neural_synchrony.py --clip socialnet
- Create a new Conda environment using the provided
environment.ymlfile:
conda env create -f environment.yml
-
Preprocessed movie-watching fMRI BOLD time series data in Shen268 atlas can be downloaded from https://github.com/esfinn/movie_cpm.git. Place the data under
/data/all_shen_roi_ts. -
The code uses family information to ensure that subjects from the same family are always in the same train/test group during cross-validation. Since family information and other necessary data are restricted under HCP guidelines, please request access via the HCP website. After approval, obtain the
family.npyandall_behav.csvfiles following the instructions in https://github.com/esfinn/movie_cpm.git. Place these two files underdata/.
Parts of this code are adapted from movie_cpm. We thank the authors for sharing their work.
For any questions or feedback, please feel free to reach out via email: yz3275@cornell.edu