Multivariate Pattern Analysis in Python |
Inheritance diagram for mvpa.clfs.base:
Base class for all classifiers.
At the moment, regressions are treated just as a special case of classifier (or vise verse), so the same base class Classifier is utilized for both kinds.
Bases: mvpa.misc.state.ClassWithCollections
Abstract classifier class to be inherited by all classifiers
Note
Available state variables:
(States enabled by default are listed with +)
See also
Please refer to the documentation of the base class for more information:
Cheap initialization.
Parameters: |
|
---|
Create full copy of the classifier.
It might require classifier to be untrained first due to present SWIG bindings.
TODO: think about proper re-implementation, without enrollment of deepcopy
Factory method to return an appropriate sensitivity analyzer for the respective classifier.
Either classifier was already trained.
MUST BE USED WITH CARE IF EVER
Predict classifier on data
Shouldn’t be overridden in subclasses unless explicitly needed to do so. Also subclasses trying to call super class’s predict should call _predict if within _predict instead of predict() since otherwise it would loop
Helper to avoid check if data was changed actually changed
Useful if classifier was (re)trained but with the same data (so just parameters were changed), so that it could be repredicted easily (on the same data as before) without recomputing for instance train/test kernel matrix. Should be used with caution and always compared to the results on not ‘retrainable’ classifier. Some additional checks are enabled if debug id ‘CHECK_RETRAIN’ is enabled, to guard against obvious mistakes.
Parameters: |
|
---|
Helper to avoid check if data was changed actually changed
Useful if just some aspects of classifier were changed since its previous training. For instance if dataset wasn’t changed but only classifier parameters, then kernel matrix does not have to be computed.
Words of caution: classifier must be previously trained, results always should first be compared to the results on not ‘retrainable’ classifier (without calling retrain). Some additional checks are enabled if debug id ‘CHECK_RETRAIN’ is enabled, to guard against obvious mistakes.
Parameters: | kwargs – that is what _changedData gets updated with. So, smth like (params=['C'], labels=True) if parameter C and labels got changed |
---|
Providing summary over the classifier
Train classifier on a dataset
Shouldn’t be overridden in subclasses unless explicitly needed to do so
Either classifier was already trained
Reset trained state
Bases: mvpa.clfs.base.LearnerError
Exception to be thrown by learners if input data is bogus, i.e. no features or samples
Bases: mvpa.clfs.base.LearnerError
Exception to be thrown whenever classifier fails to provide predictions. Usually happens if it was trained on degenerate data but without any complaints.
Bases: mvpa.clfs.base.LearnerError
Exception to be thrown whenever classifier fails to learn for some reason
Bases: exceptions.Exception
Base class for exceptions thrown by the learners (classifiers, regressions)