Class TreeClassifier
source code
TreeClassifier which allows to create hierarchy of classifiers
Functions by grouping some labels into a single "meta-label" and training
classifier first to separate between meta-labels. Then
each group further proceeds with classification within each group.
Possible scenarios:
TreeClassifier(SVM(),
{'animate': ((1,2,3,4),
TreeClassifier(SVM(),
{'human': (('male', 'female'), SVM()),
'animals': (('monkey', 'dog'), SMLR())})),
'inanimate': ((5,6,7,8), SMLR())})
would create classifier which would first do binary classification
to separate animate from inanimate, then for animate result it
would separate to classify human vs animal and so on:
SVM
/ animate inanimate
/ SVM SMLR
/ \ / | \ human animal 5 6 7 8
| |
SVM SVM
/ \ / male female monkey dog
1 2 3 4
If it is desired to have a trailing node with a single label and
thus without any classification, such as in
SVM
/ g1 g2
- / 1 SVM
- / 2 3
then just specify None as the classifier to use:
TreeClassifier(SVM(),
{'g1': ((1,), None),
'g2': ((1,2,3,4), SVM())})
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
Inherited from ProxyClassifier:
getSensitivityAnalyzer
Inherited from base.Classifier:
__str__,
clone,
isTrained,
predict,
repredict,
retrain,
train,
trained
Inherited from base.Classifier (private):
_getFeatureIds,
_postpredict,
_posttrain,
_prepredict,
_pretrain,
_regressionIsBogus,
_setRetrainable
Inherited from misc.state.ClassWithCollections:
__getattribute__,
__new__,
__setattr__,
reset
Inherited from object:
__delattr__,
__format__,
__hash__,
__reduce__,
__reduce_ex__,
__sizeof__,
__subclasshook__
|
|
|
_DEV__doc = ...
|
|
Inherited from ProxyClassifier:
clf
Inherited from base.Classifier:
_DEV__doc__,
feature_ids,
predicting_time,
predictions,
regression,
retrainable,
trained_dataset,
trained_labels,
trained_nsamples,
training_confusion,
training_time,
values
Inherited from base.Classifier (private):
_clf_internals
Inherited from misc.state.ClassWithCollections:
descr
|
|
|
clfs
Dictionary of classifiers used by the groups
|
|
Inherited from object:
__class__
|
__init__(self,
clf,
groups,
**kwargs)
(Constructor)
| source code
|
Initialize TreeClassifier
:Parameters:
clf : Classifier
Classifier to separate between the groups
groups : dict of meta-label: tuple of (tuple of labels, classifier)
Defines the groups of labels and their classifiers.
See :class:`~mvpa.clfs.meta.TreeClassifier` for example
- Parameters:
clf - classifier based on which mask classifiers is created
- Overrides:
object.__init__
|
__repr__(self,
prefixes=[])
(Representation operator)
| source code
|
String representation of TreeClassifier
- Parameters:
fullname - Either to include full name of the module
prefixes - What other prefixes to prepend to list of arguments
- Overrides:
object.__repr__
|
|
Train TreeClassifier
First train .clf on groupped samples, then train each of .clfs
on a corresponding subset of samples.
- Overrides:
base.Classifier._train
|
_DEV__doc
- Value:
"""
Questions:
* how to collect confusion matrices at a particular layer if such
classifier is given to SplitClassifier or CVTE
* What additional states to add, something like
clf_labels -- store remapped labels for the dataset
clf_values ...
...
|
|