conda create -n introdl python=3.9
conda activate introdl
- if mac user:
conda install pytorch torchvision torchaudio -c pytorch
- else:
conda install pytorch torchvision torchaudio pytorch-cuda=11.3 -c pytorch -c nvidia
pip install -r requirements.txtTo download fMRI datasets, run
PYTHONPATH=./ python scripts/download_datasets.py
To generate synthetics datasets, run
PYTHONPATH=./ python scripts/generate_datasets.py
for model in lstm mean_lstm transformer mean_transformer
do
for dataset in cobre abide synth1 synth2
do
PYTHONPATH=./ python scripts/run_experiments.py --mode tune --model $model --ds $dataset --prefix test
PYTHONPATH=./ python scripts/run_experiments.py --mode exp --model $model --ds $dataset --prefix test
done
done
or
PYTHONPATH=./ python scripts/run_experiments.py --mode tune --model lstm --ds abide --prefix test
PYTHONPATH=./ python scripts/run_experiments.py --mode exp --model lstm --ds abide --prefix test
For model introspection to work you need to move (or copy) the exp folder of the desired model from the assets/logs to assets/trained_models. Choose the same --prefix as the prefix of your desired model's folder. We uploaded some tained weights; use introdl prefix for them.
for model in lstm mean_lstm transformer mean_transformer
do
for dataset in cobre abide synth1 synth2
do
PYTHONPATH=./ python scripts/run_introspection.py --model $model --ds $dataset --methods saliency --prefix introdl
done
done
or
PYTHONPATH=./ python scripts/run_introspection.py --model lstm --ds abide --methods saliency --prefix introdl
--mode:tune- tune mode: run multiple experiments with different hyperparamsexp- experiment mode: run experiments with best hyperparams found in thetunemoderesume- see below
--model: some of the working models; check the sourse code for more infolstmmean_lstmtransformermean_transformer
--ds: dataset for the experimentscobreabide
-
--prefix: custom prefix for the project- default prefix is UTC time
- appears in the name of logs directory and the name of WandB project
tune->expexperiments will use the same prefix (unless it is default)- don't use
-character in the prefix - don't use
resumeortuneas a prefix
-
--multiclass: some datasets have multiple classes (default: False); pass--multiclassif you want to load all classes -
--zscore: whether dataset should be zscored over time direction (default: False); pass--zscoreif you want zscore the data -
--filter-indices: whehter ICA components in real-world fMRI data should be filtered (default: True); pass--no-filter-indicesif you want to load all ICA components -
--max-epochs- max epochs to use (default: 200) -
--n-splits- number of splits forStratifiedKFoldcross-validation (default=5):- the
dsdataset is split innum-splitsequally sized folds
- the
-
--n-trials- number of trials for each test fold (default=50 fortuneand 10 forexp):- in
tuneit equals to number of different hyperparams sets tested on each fold - in
expmode, for each trial, a new seed fortrain_test_splitis used for splitting train-val dataset into train and val datasets - important note: if you provide the same
num-splitsandnum-trialsfor different experiments on the same dataset, datasets splits will be the same
- in
-
--batch-size- batch size (default: 64) -
--patience- patience for early stopping (default: 30)
--mode:resume- resume mode: for resuming interrupted experiment
--path:- path to the interrupted experiment (e.g.,
/Users/user/intro-dl-project/assets/logs/prefix-mode-model-ds)
- path to the interrupted experiment (e.g.,