To reproduce our code, use the environment.yml to import a conda environment. This can be done with the following command:
conda env create -f environment.yml. Follow these steps to reproduce our project:
- To generate the beta weights with and without confounds, run the preprocessed fMRI data (preprocessed with fMRI prep) in
preprocessingPipelines/noConfound_first_level_pipeline.pyorpreprocessingPipelines/confound_first_level_pipeline.py. - Move the saved betas into folders called
confoundBetaornonConfoundBeta - To retrieve the saved beta weights only within the brain itself and the task labels,
preprocessingPipelines/dataExtraction.py. - Given our dataset, we can now run the model training and testing code!
- For Support Vector Machine, run
SVM/svm.ipynbto see the confusion matrix and coefficient brain map - For Logistic Regression, run
LogisticRegression/logistic_confounds.ipynbfor the confounded betas andLogisticRegression/logistic_nonConfounds.ipynbfor the non confounded betas, and to see the confusion matrix and coefficient brain map - For Naive Bayes, run
NaiveBayes/naivebayes_confounds.ipynbfor the confounded betas andNaiveBayes/naivebayes_nonconfounds.ipynbfor the non confounded betas - For k-Nearest Neighbor, run
kNN/knn_confounds.ipynbfor the confounded betas andkNN/knn_nonconfounds.ipynbfor the non confounded betas
- For Support Vector Machine, run
Additional: To plot single subject, single run beta weights for both tasks AND the Nilearn MNI 152 brain mask we used for the mode training, run imageResults/plotting_maps.ipynb
In this project, we trained multiple models for multi-voxel pattern analysis (MVPA) with task fMRI.
-
Kiyonaga, A.; Scimeca, J.; D’Esposito, M. (2018). Dissociating the causal roles of frontal and parietal cortex in working memory capacity [Registered Report Stage 1 - Protocol]. figshare. Journal contribution. https://doi.org/10.6084/m9.figshare.7145873.v1
-
LIBSVM: Chih-Chung Chang and Chih-Jen Lin, LIBSVM : a library for support vector machines. ACM Transactions on Intelligent Systems and Technology, 2:27:1--27:27, 2011. Software available at http://www.csie.ntu.edu.tw/~cjlin/libsvm
- pip install -U libsvm-official
-
Scikit-Learn: Scikit-learn: Machine Learning in Python, Pedregosa et al., JMLR 12, pp. 2825-2830, 2011.