Package mvpa :: Package algorithms :: Module cvtranserror :: Class CrossValidatedTransferError

[hide private]
[frames] | no frames]

# Class CrossValidatedTransferError

source code

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.

Nested Classes | [hide private]

Inherited from `misc.state.ClassWithCollections`: `__metaclass__`

Instance Methods | [hide private]

__init__(self, transerror, splitter=None, combiner='mean', expose_testdataset=False, harvest_attribs=None, copy_attribs='copy', **kwargs) :Parameters: transerror: TransferError instance Provides the classifier used for cross-validation. | source code

_call(self, dataset) Perform cross-validation on a dataset. | source code

Inherited from `measures.base.DatasetMeasure`: `__call__`, `__repr__`, `null_dist`, `transformer`, `untrain`

Inherited from `measures.base.DatasetMeasure` (private): `_postcall`

Inherited from `misc.state.Harvestable` (private): `_harvest`, `_setAttribs`

Inherited from `misc.state.ClassWithCollections`: `__getattribute__`, `__new__`, `__setattr__`, `__str__`, `reset`

Inherited from `object`: `__delattr__`, `__format__`, `__hash__`, `__reduce__`, `__reduce_ex__`, `__sizeof__`, `__subclasshook__`

Class Variables | [hide private]

| results = `StateVariable(enabled= False, doc= """Store individu`...``
| splits = `StateVariable(enabled= False, doc= """Store the actua`...``
| transerrors = `StateVariable(enabled= False, doc= """Store copi`...``
| confusion = `StateVariable(enabled= False, doc= """Store total `...``
| training_confusion = `StateVariable(enabled= False, doc= """Sto`...``
| samples_error = `StateVariable(enabled= False, doc= "Per sample`...``
| splitter = `property(fget= lambda self: self.__splitter, doc= "`...``
| transerror = `property(fget= lambda self: self.__transerror, do`...``
| combiner = `property(fget= lambda self: self.__combiner, doc= "`...``
Inherited from `measures.base.DatasetMeasure`: `__doc__`, `null_prob`, `null_t`, `raw_results` Inherited from `misc.state.Harvestable`: `harvest_attribs`, `harvested` Inherited from `misc.state.Harvestable` (private): `_KNOWN_COPY_METHODS` Inherited from `misc.state.ClassWithCollections`: `_DEV__doc__`, `descr`

Properties | [hide private]

Inherited from `object`: `__class__`

Method Details | [hide private]

### __init__(self, transerror, splitter=None, combiner='mean', expose_testdataset=False, harvest_attribs=None, copy_attribs='copy', **kwargs)
(Constructor)

source code

    :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
        :class:`~mvpa.datasets.splitters.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
      **kwargs:
        All additional arguments are passed to the
        :class:`~mvpa.measures.base.DatasetMeasure` base class.

Parameters:
  - `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.
Overrides: object.__init__

### _call(self, dataset)

source code

Perform cross-validation on a dataset.

'dataset' is passed to the splitter instance and serves as the source dataset to generate split for the single cross-validation folds.

Overrides: measures.base.DatasetMeasure._call

Class Variable Details | [hide private]

### results

Value:

      StateVariable(enabled= False, doc= """Store individual results in the
      state""")

### splits

Value:

      StateVariable(enabled= False, doc= """Store the actual splits of the d
      ata. Can be memory expensive""")

### transerrors

Value:

      StateVariable(enabled= False, doc= """Store copies of transerrors at e
      ach step. If enabled -
             operates on clones of transerror, but for the last split origin
      al
             transerror is used""")

### confusion

Value:

      StateVariable(enabled= False, doc= """Store total confusion matrix (if
       available)""")

### training_confusion

Value:

      StateVariable(enabled= False, doc= """Store total training confusion m
      atrix (if available)""")

### samples_error

Value:

      StateVariable(enabled= False, doc= "Per sample errors.")

### splitter

Value:

      property(fget= lambda self: self.__splitter, doc= "Access to the Split
      ter instance.")

### transerror

Value:

      property(fget= lambda self: self.__transerror, doc= "Access to the Tra
      nsferError instance.")

### combiner

Value:

      property(fget= lambda self: self.__combiner, doc= "Access to the confi
      gured combiner.")