MVPA approach

mbfmri.core.mvpa

mbfmri.core.mvpa.run_mbmvpa(bids_layout, config=None, mvpa_model='elasticnet', report_path=None, overwrite=False, overwrite_latent_process=True, refit_compmodel=False, **kwargs)

Callable function of the package to enable a single line usage. The following procedures are done by MBMVPA class.

  1. process fMRI & behavioral data to generate multi-voxel bold signals and latent process signals

  2. load processed signals.

  3. fit MVPA models and interprete the models to make a brain map.

By running this code, users can expect to get a brain activation pattern attributed to the target latent process defined in the computational model.

Parameters
  • bids_layout (str or pathlib.PosixPath or bids.layout.layout.BIDSLayout or BIDSController) – Root for input data. It should follow BIDS convention.

  • config (dict or str or pathlib.PosixPath, default=None) – Dictionary for keyworded configuration, or path for yaml file. The configuration input will override the default configuration.

  • mvpa_model (str, default=”elasticnet”) – Name for MVPA model. Currently, “elasticnet,” “mlp” and “cnn” are allowed.

  • report_path (str or pathlib.PosixPath, defualt=None) – Path for saving outputs of MVPA_CV module. please refer to mbmvpa.models.mvpa_general.MVPA_CV Default path will be set as bids_root/mbmvpa/mvpa/ (If None)

  • overwrite (bool, default=False) – Indicate if processing multi-voxel signals is required though the files exist.

  • overwrite_latent (bool, default=False) – Indicate if generating latent process signals is required though the files exist.

  • refit_compmodel (bool, default=False) – Indicate if fitting computational model is required though the fitted results (indiv. params. and LOOIC) exist.

  • **kwargs (dict) – Dictionary for keywarded arguments. This allows users to override default configuration and config input. Argument names are same as those of wrapped modules.

    Generating multi-voxel signals document

    Generating latent process signals document

    Data loading document

    MVPA model document (Please refer to the corresponding model according to mvpa_model.)

    Parameters of the above modules can be controlled by input paramter by keywords. (e.g. run_mbfmri(…, mask_smoothing_fwhm=6, …, alpha=0.01) means mask_smoothing_fwhm will be set in VoxelFeatureGenerator and alpha will be set in ElasticNet.) Please check full list of configuration parameters <https://project-model-based-fmri.readthedocs.io/en/latest/mbfmri.core.html#full-list-of-configuration>_.

Examples

from mbfmri.core.mvpa import run_mbmvpa
import hbayesdm

_ = run_mbmvpa(analysis='mvpa',                     # name of analysis, "mvpa" or "glm"
               bids_layout='mini_bornstein2017',    # data
               mvpa_model='elasticnet',             # MVPA model, "mlp" or "cnn" for DNN
               dm_model= 'banditNarm_lapse_decay',  # computational model
               feature_name='zoom2rgrout',          # indentifier for processed fMRI data
               task_name='multiarmedbandit',        # identifier for task
               process_name='PEchosen',             # identifier for target latent process
               subjects='all',                      # list of subjects to include
               method='5-fold',                     # type of cross-validation
               report_path=report_path,             # save path for reporting results
               confounds=["trans_x", "trans_y",     # list of confounds to regress out
                          "trans_z", "rot_x",
                          "rot_y", "rot_z"],
               n_core=4,                            # number of core for multi-processing in hBayesDM
               n_thread=4,                          # number of thread for multi-threading in generating voxel features
               overwrite=True,                      # indicate if re-run and overwriting are required
               refit_compmodel=True,                # indicate if refitting comp. model is required
              )

}

class mbfmri.core.mvpa.MBMVPA(bids_layout, config=None, mvpa_model='elasticnet', report_path=None, logistic=False, **kwargs)

Bases: mbfmri.core.base.MBFMRI

Wrapper of functions in the package to enable a single line usage. The following procedures are done by MBMVPA class.

  1. process fMRI & behavioral data to generate multi-voxel bold signals and latent process signals

  2. load processed signals.

  3. fit MVPA models and interprete the models to make a brain map.

By running this code, users can expect to get a brain activation pattern attributed to the target latent process defined in the computational model.

Parameters
  • bids_layout (str or pathlib.PosixPath or bids.layout.layout.BIDSLayout or BIDSController) – Root for input data. It should follow BIDS convention.

  • config (dict or str or pathlib.PosixPath, default=None) – Dictionary for keyworded configuration, or path for yaml file. The configuration input will override the default configuration.

  • mvpa_model (str, default=”elasticnet”) – Name for MVPA model. Currently, “elasticnet,” “mlp” and “cnn” are allowed.

  • report_path (str or pathlib.PosixPath, defualt=None) – Path for saving outputs of MVPA_CV module. please refer to mbmvpa.models.mvpa_general.MVPA_CV Default path will be set as bids_root/mbmvpa/mvpa/ (If None)

  • **kwargs (dict) – Dictionary for keywarded arguments. This allows users to override default configuration and config input. Argument names are same as those of wrapped modules.

    Generating multi-voxel signals document

    Generating latent process signals document

    Data loading document

    MVPA model document (Please refer to the corresponding model according to mvpa_model.)

    Parameters of the above modules can be controlled by input paramter by keywords. (e.g. run_mbfmri(…, mask_smoothing_fwhm=6, …, alpha=0.01) means mask_smoothing_fwhm will be set in VoxelFeatureGenerator and alpha will be set in ElasticNet.) Please check full list of configuration parameters <https://project-model-based-fmri.readthedocs.io/en/latest/mbfmri.core.html#full-list-of-configuration>_.

run(overwrite=False, overwrite_latent_process=True, refit_compmodel=False)

run the following procedures.

  1. preprocess fMRI & behavioral data

  2. load preprocessed data

  3. fit MVPA models and interprete the models

Parameters
  • overwrite (bool, default=False) – Indicate if processing multi-voxel signals is required though the files exist.

  • overwrite_latent (bool, default=False) – Indicate if generating latent process signals is required though the files exist.

  • refit_compmodel (bool, default=False) – Indicate if fitting computational model is required though the fitted results (indiv. params. and LOOIC) exist.