Table Of Contents

Previous topic

featsel.rfe

Next topic

algorithms.hyperalignment

This content refers to the previous stable release of PyMVPA. Please visit www.pymvpa.org for the most recent version of PyMVPA and its documentation.

algorithms.cvtranserror

Module: algorithms.cvtranserror

Inheritance diagram for mvpa.algorithms.cvtranserror:

Cross-validate a classifier on a dataset

CrossValidatedTransferError

class mvpa.algorithms.cvtranserror.CrossValidatedTransferError(transerror, splitter=None, combiner='mean', expose_testdataset=False, harvest_attribs=None, copy_attribs='copy', **kwargs)

Bases: mvpa.measures.base.DatasetMeasure, mvpa.misc.state.Harvestable

Classifier cross-validation.

This class provides a simple interface to cross-validate a classifier on datasets generated by a splitter from a single source dataset.

Arbitrary performance/error values can be computed by specifying an error function (used to compute an error value for each cross-validation fold) and a combiner function that aggregates all computed error values across cross-validation folds.

Note

Available state variables:

  • confusion: Store total confusion matrix (if available)

  • harvested: Store specified attributes of classifiers at each split

  • null_prob+: State variable

  • null_t: State variable

  • raw_results: Computed results before applying any transformation algorithm

  • results: Store individual results in the state

  • samples_error: Per sample errors.

  • splits: Store the actual splits of the data. Can be memory expensive

  • training_confusion: Store total training confusion matrix (if available)

  • transerrors: Store copies of transerrors at each step. If enabled -

    operates on clones of transerror, but for the last split original transerror is used

(States enabled by default are listed with +)

See also

Please refer to the documentation of the base classes for more information:

DatasetMeasure, Harvestable

Parameters:
  • transerror (TransferError instance) – Provides the classifier used for cross-validation.
  • splitter (Splitter | None) – Used to split the dataset for cross-validation folds. By convention the first dataset in the tuple returned by the splitter is used to train the provided classifier. If the first element is ‘None’ no training is performed. The second dataset is used to generate predictions with the (trained) classifier. If None (default) an instance of NoneSplitter is used.
  • combiner (Functor | ‘mean’) – Used to aggregate the error values of all cross-validation folds. If ‘mean’ (default) the grand mean of the transfer errors is computed.
  • expose_testdataset (bool) – In the proper pipeline, classifier must not know anything about testing data, but in some cases it might lead only to marginal harm, thus migth wanted to be enabled (provide testdataset for RFE to determine stopping point).
  • harvest_attribs (list of basestr) – What attributes of call to store and return within harvested state variable
  • copy_attribs (None | basestr) – Force copying values of attributes on harvesting
  • enable_states (None or list of basestring) – Names of the state variables which should be enabled additionally to default ones
  • disable_states (None or list of basestring) – Names of the state variables which should be disabled
  • transformer (Functor) – This functor is called in __call__() to perform a final processing step on the to be returned dataset measure. If None, nothing is called
  • null_dist (instance of distribution estimator) – The estimated distribution is used to assign a probability for a certain value of the computed measure.
combiner

Access to the configured combiner.

splitter

Access to the Splitter instance.

transerror

Access to the TransferError instance.