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
|
__init__(self,
clf,
groups,
**kwargs)
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. |
source code
|
|
|
|
|
|
|
|
|
|
|
|
Inherited from ProxyClassifier :
getSensitivityAnalyzer
Inherited from base.Classifier :
__str__ ,
clone ,
isTrained ,
predict ,
repredict ,
retrain ,
train ,
trained
Inherited from misc.state.ClassWithCollections :
__getattribute__ ,
__new__ ,
__setattr__ ,
reset
Inherited from object :
__delattr__ ,
__hash__ ,
__reduce__ ,
__reduce_ex__
|
|
_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 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
- Overrides:
ProxyClassifier.__init__
|
Train TreeClassifier
First train .clf on groupped samples, then train each of .clfs
on a corresponding subset of samples.
- Overrides:
ProxyClassifier._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 ...
...
|
|