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())})
Notes
Available conditional attributes:
(Conditional attributes enabled by default suffixed with +)
Initialize TreeClassifier
Parameters : | clf : Classifier
groups : dict of meta-label: tuple of (tuple of labels, classifier)
enable_ca : None or list of str
disable_ca : None or list of str
auto_train : bool
force_train : bool
space: str, optional :
postproc : Node instance, optional
descr : str
|
---|
Dictionary of classifiers used by the groups
Provide summary for the TreeClassifier.