skbold.postproc.mvp_results module¶
-
class
MvpAverageResults
(out_dir, type='classification')[source]¶ Bases:
object
Averages results from MVPA analyses on, for example, different subjects or different ROIs.
Parameters: out_dir (str) – Absolute path to directory where the results will be saved.
-
class
MvpResults
(mvp, n_iter, out_path=None, feature_scoring='', verbose=False)[source]¶ Bases:
object
Class to keep track of model evaluation metrics and feature scores. See the ReadTheDocs homepage for more information on its API and use.
Parameters: - mvp (mvp-object) – Necessary to extract some metadata from.
- n_iter (int) – Number of folds that will be kept track of.
- out_path (str) – Path to save results to.
- feature_scoring (str) – Which method to use to calculate feature-scores with. Can be: 1) ‘fwm’: feature weight mapping [1] - keep track of raw voxel-weights (coefficients) 2) ‘forward’: transform raw voxel-weights to corresponding forward- model [2].
- verbose (bool) – Whether to print extra output.
References
[1] Stelzer, J., Buschmann, T., Lohmann, G., Margulies, D.S., Trampel, R., and Turner, R. (2014). Prioritizing spatial accuracy in high-resolution fMRI data using multivariate feature weight mapping. Front. Neurosci., http://dx.doi.org/10.3389/fnins.2014.00066. [2] Haufe, S., Meineck, F., Gorger, K., Dahne, S., Haynes, J-D., Blankertz, B., and Biessmann, F. et al. (2014). On the interpretation of weight vectors of linear models in multivariate neuroimaging. Neuroimage, 87, 96-110. -
load_model
(path, param=None)[source]¶ Load model or pipeline from disk.
Parameters: - path (str) – Absolute path to model.
- param (str) – Which, if any, specific param needs to be loaded.
-
class
MvpResultsClassification
(mvp, n_iter, feature_scoring='fwm', verbose=False, out_path=None)[source]¶ Bases:
skbold.postproc.mvp_results.MvpResults
MvpResults class specifically for classification analyses.
Parameters: - mvp (mvp-object) – Necessary to extract some metadata from.
- n_iter (int) – Number of folds that will be kept track of.
- out_path (str) – Path to save results to.
- feature_scoring (str) – Which method to use to calculate feature-scores with. Can be: 1) ‘coef’: keep track of raw voxel-weights (coefficients) 2) ‘forward’: transform raw voxel-weights to corresponding forward- model (see Haufe et al. (2014). On the interpretation of weight vectors of linear models in multivariate neuroimaging. Neuroimage, 87, 96-110.)
- verbose (bool) – Whether to print extra output.
-
update
(test_idx, y_pred, pipeline=None)[source]¶ Updates with information from current fold.
Parameters: - test_idx (ndarray) – Indices of current test-trials.
- y_pred (ndarray) – Predictions of current test-trials.
- values (ndarray) – Values of features for model in the current fold. This can be the entire pipeline (in this case, it is extracted automaticlly). When a pipeline is passed, the idx-parameter does not have to be passed.
- idx (ndarray) – Index mapping the ‘values’ back to whole-brain space.
-
class
MvpResultsRegression
(mvp, n_iter, feature_scoring='', verbose=False, out_path=None)[source]¶ Bases:
skbold.postproc.mvp_results.MvpResults
MvpResults class specifically for Regression analyses.
Parameters: - mvp (mvp-object) – Necessary to extract some metadata from.
- n_iter (int) – Number of folds that will be kept track of.
- out_path (str) – Path to save results to.
- feature_scoring (str) – Which method to use to calculate feature-scores with. Can be: 1) ‘coef’: keep track of raw voxel-weights (coefficients) 2) ‘forward’: transform raw voxel-weights to corresponding forward- model (see Haufe et al. (2014). On the interpretation of weight vectors of linear models in multivariate neuroimaging. Neuroimage, 87, 96-110.)
- verbose (bool) – Whether to print extra output.
:param .. warning:: Has not been tested with MvpWithin!:
-
update
(test_idx, y_pred, pipeline=None)[source]¶ Updates with information from current fold.
Parameters: - test_idx (ndarray) – Indices of current test-trials.
- y_pred (ndarray) – Predictions of current test-trials.
- pipeline (scikit-learn Pipeline object) – pipeline from which relevant scores/coefficients will be extracted.