skbold.estimators.roi_voting_classifier module

class RoiVotingClassifier(mvp, preproc_pipeline=None, clf=None, mask_type='unilateral', voting='soft', weights=None)[source]

Bases: sklearn.base.BaseEstimator, sklearn.base.ClassifierMixin

This classifier fits a base-estimator (by default a linear SVM) on different feature sets (i.e. voxels) from different regions of interest (which are drawn from the Harvard-Oxford Cortical atlas), and subsequently the final prediction is derived through a max-voting rule, which can be either ‘soft’ (argmax of mean class probability) or ‘hard’ (max of class prediction).

Notes

This classifier has not been tested!

Parameters:
  • mvp (mvp-object) – An custom object from the skbold package containing data (X, y) and corresponding meta-data (e.g. mask info)
  • preproc_pipeline (object) – A scikit-learn Pipeline object with desired preprocessing steps (e.g. scaling, additional feature selection)
  • clf (object) – A scikit-learn style classifier (implementing fit(), predict(), and predict_proba()), that is able to be used in Pipelines.
  • mask_type (str) – Can be ‘unilateral’ or ‘bilateral’, which will use all masks from the corresponding Harvard-Oxford Cortical (lateralized) atlas. Alternatively, it may be an absolute path to a directory containing a custom set of masks as nifti-files (default: ‘unilateral’).
  • voting (str) – Either ‘hard’ or ‘soft’ (default: ‘soft’).
  • weights (list (or ndarray)) – List/array of shape [n_rois] with a relative weighting factor to be used in the voting procedure.
fit(X=None, y=None)[source]

Fits RoiVotingClassifier.

Parameters:
  • X (ndarray) – Array of shape = [n_samples, n_features].
  • y (list or ndarray of int or float) – List or ndarray with floats/ints corresponding to labels.
Returns:

self – RoiStackingClassifier instance with fitted parameters.

Return type:

object

predict(X)[source]

Predict class given fitted RoiVotingClassifier.

Parameters:X (ndarray) – Array of shape = [n_samples, n_features].
Returns:maxvotes – Array with class predictions for all classes of X.
Return type:ndarray