“Deep learning models reveal replicable, generalizable, and behaviorally relevant sex differences in human functional brain organization.” © 2023 by The Board of Trustees of the Leland Stanford Junior University is licensed under CC BY-NC 4.0
Contact the Stanford Office of Technology Licensing (otl.stanford.edu) for commercial license inquiries
Ryali, S., Zhang, Y., de los Angeles, C., Superkar, K., & Menon, V. (2024). Deep learning models reveal replicable, generalizable, and behaviorally relevant sex differences in human functional brain organization. The proceedings of the National Academy of Sciences.
The extracted time series were used as inputs of DNN (scripts under timeseries_extraction/)
- config files: rest_ts_extraction_config_*_brainnetome.m
- main script: read_ts_extraction_dev.m
-
utility functions: utilityFunctions.py
-
model architecture: modelClasses.py
-
create cross-validation datasets on HCP and extract basic info (e.g. #F/#M, subject ids, head motions): create_cv_datasets.py and extract_basic_info.py
-
train models on HCP datasets: hcp_cv_model_training.py
-
test replicability on HCP datasets: evaluate_hcp_session.py
-
test generalizability on NKI-RS dataset: evaluate_nkirs.py
-
test generalizability on MPI Leipzig dataset: evaluate_leipzig.py
In consensus analysis, we split data into 5 folds for 100 times, repeated analysis for each CV dataset (training on HCP Session 1 or 3 and then extracting individual fingerprints using the trained models), and finally gathered all fingerprints from the 100 runs and identified consensus features (top features that consistently appeared across all folds)
-
create random seeds for each of the 100 split: create_randomlist.py
-
train models on HCP session 1 or 3 for each of CV dataset: hcp_training_models_multiple_cv_datasets.py
-
generate feature attributions from each of the trained models using IG or DeepLift
- for IG: generate_feature_attribution_ig_multiple_cv.py
- for DeepLift: generate_DL_feature_attribution_multiple_cv.py
-
get consensus features across all models for each session: get_consensus_features_multiple_cv.py (IG features of HCP cohort) and get_DL_consensus_features_multiple_cv.py (DL features of HCP cohort)
-
generate common features across sexes: generate_common_features_across_sex.sh
-
generate brain plots of consensus features: generate_consensus_images.m
-
generate NKI-RS feature attributions from each of the trained models using IG or DeepLift
- for IG: generate_nki_feature_attribution_ig_multiple_cv.py
- for DeepLift: generate_nki_DL_feature_attribution_multiple_cv.py
-
get NKI-RS consensus features across all HCP models of each session: get_nki_consensus_features_multiple_cv.py (IG features of NKI-RS cohort) and get_nki_DL_consensus_features_multiple_cv.py (DL features of NKI-RS cohort)
-
generate NKI-RS common features across sexes: generate_common_features_across_sex.sh
-
generate brain plots of NKI-RS consensus features: generate_consensus_images.m
-
generate MPI Leipzig feature attributions from each of the trained models using IG: generate_leipzig_feature_attribution_multiple_cv.py
-
get MPI Leipzig consensus features across all HCP models of each session: get_leipzig_consensus_features_multiple_cv.py
-
generate MPI Leipzig common features across sexes: generate_common_features_across_sex.sh
-
generate brain plots of Leipzig consensus features: generate_consensus_images.m
-
generate nifti files of top features for each individual: generate_indiv_niftis.py for HCP cohort and generate_nki_indiv_niftis.py for NKI-RS cohort
-
generate brain images of top features for each individual: generate_indiv_images.m
-
radar plots of individual fingerprints (only show top 20% features identified at the group level with the same sex)
- generate_data_radarplots.py and generate_indiv_radarplots.py for HCP cohort
- generate_data_radarplots_nki.py and generate_indiv_radarplots_nki.py for NKI-RS cohort
-
distinctiveness of fingerprints: distinctiveness_fingerprint.py for HCP cohort and distinctiveness_nki_fingerprint.py for NKI cohort
-
tsne plot of fingerprints' distinctiveness: tsne_plot_distinctiveness.py for HCP cohort and tsne_plot_distinctiveness_nki.py for NKI cohort
-
bar plot of fingerprints' distinctiveness: generate_data_bar_plot_distinctiveness.py and distinctiveness_barplots.R
-
stability of fingerprints: stability_fingerprint.py
-
control analysis examining the relationship between head movement and brain features underlying sex classification: dnn/control_analysis_dcor2.py
-
control analyses with different artifact reduction methods and different brain atlases
- config files: timeseries_extraction/rest_ts_extraction_config_hcp_rfMRI_*_acompcor.m
- main script: timeseries_extraction/read_ts_extraction_dev.m
- same DNN classification scripts were applied to time series extracted using the scripts here
- brain-behavioral analysis using individual-level stDNN features attributions (fingerprints) and 3 PCs derived from NIH toolbox congnition measures
- mycca_brain_behav_cognition_PCversion.R is used for brain-behavioral CCA
- mycca_brain_behav_cognition_prediction_MvsF_HCP.R is used for prediction analysis
- mycca_plotting_brain_behav_cognition_PCversion.R is for plotting
- myRFunc_updated.R includes all supporting functions
-
classification using conventrional machine learning approaches
- classicML_staticFC_gender_multiple.py for HCP and NKI-RS cohorts
- classicML_staticFC_gender_multiple_leipzig.py for HCP and MPI Leipzig cohorts
-
brain-behavioral analysis using static functional connectivity and cognition measures
- staticFC_PCs_to_csv.py is used to get the first 246 PCs of static functional connectivity and save to csv file
- mycca_sFC_behav_cognition_PCversion.R is used for brain-behavioral CCA with sFC PCs
- mycca_sFC_behav_cognition_prediction_MvsF_HCP.R is used for prediction analysis
- mycca_plotting_sFC_behav_cognition_PCversion.R is for plotting
- myRFunc_updated.R includes all supporting functions