Classifier Chain Learner (chain)

class Orange.multitarget.chain.ClassifierChainLearner(learner=None, name='Classifier Chain', rand=None, callback=None, class_order=None, actual_values=True, **kwargs)

Bases: Orange.classification.Learner

Expands single class classification techniques into multi-target classification techniques by chaining the classification data. A learner is constructed for each of the class variables in a random or given order. The data for each learner are the features extended by all previously classified variables. This chaining passes the class informationd between classifiers and allows class correlations to be taken into account. TODO: cite weka source?

Parameters:
  • learner (Orange.core.Learner) – A single class learner that will be extended by chaining.
  • rand – random generator used in bootstrap sampling. If None (default), then random.Random(42) is used.
  • callback – a function to be called after every iteration of induction of classifier. The call returns a parameter (from 0.0 to 1.0) that provides an estimate of completion of the learning progress.
  • name (string) – learner name.
Return type:

Orange.multitarget.chain.ClassifierChain or Orange.multitarget.chain.ClassifierChainLearner

class Orange.multitarget.chain.ClassifierChain(classifiers, class_order, domains, name, orig_domain)

Bases: Orange.classification.Classifier

Uses the classifiers induced by the ClassifierChainLearner. An input instance is classified into the class with the most frequent vote. However, this implementation returns the averaged probabilities from each of the trees if class probability is requested.

It should not be constructed manually.

Parameters:
  • classifiers (list of Orange.core.Learner) – a list of classifiers.
  • domains – the domains used by learners.
  • orig_domain – the domain of the learning set.
  • name (string) – name of the classifier.

Ensemble Classifier Chain Learner

class Orange.multitarget.chain.EnsembleClassifierChainLearner(n_chains=50, sample_size=0.25, learner=None, actual_values=True, name='Ensemble CChain', rand=None, callback=None)

Bases: Orange.classification.Learner

Expands single class classification techniques into multi-target classification techniques by chaining the classification data. A learner is constructed for each of the class variables in a random or given order. The data for each learner are the features extended by all previously classified variables. This chaining passes the class informationd between classifiers and allows class correlations to be taken into account. TODO: cite weka source?

Parameters:
  • n_chains (integer) – Number of chains to be constructed.
  • sample_size (float) – Size (percentage) of the subset taken from original dataset.
  • learner (Orange.core.Learner) – A single class learner that will be extended by chaining.
  • rand – random generator used in bootstrap sampling. If None (default), then random.Random(42) is used.
  • callback – a function to be called after every iteration of induction of classifier. The call returns a parameter (from 0.0 to 1.0) that provides an estimate of completion of the learning progress.
  • name (string) – learner name.
Return type:

Orange.multitarget.chain.EnsembleClassifierChainLearner or Orange.multitarget.chain.EnsembleClassifierChain

class Orange.multitarget.chain.EnsembleClassifierChain(classifiers, name)

Bases: Orange.classification.Classifier

Uses the classifiers induced by the EnsembleClassifierChainLearner. An input instance is classified into the class with the most frequent vote. However, this implementation returns the averaged probabilities from each of the trees if class probability is requested.

When constructed manually, the following parameters have to be passed:

Parameters:
  • classifiers (list) – a list of chain classifiers to be used.
  • name (str) – name of the resulting classifier.

Examples

import Orange

data = Orange.data.Table('multitarget:bridges.tab')

cl1 = Orange.multitarget.chain.ClassifierChainLearner( \
	learner = Orange.classification.majority.MajorityLearner, name="CChain - Maj")
cl2 = Orange.multitarget.chain.ClassifierChainLearner( \
	learner = Orange.classification.tree.SimpleTreeLearner, name="CChain - Tree")
cl3 = Orange.multitarget.chain.EnsembleClassifierChainLearner( \
	learner = Orange.classification.tree.SimpleTreeLearner, n_chains=50, sample_size=0.25, name="Ensemble CC - Tree")

learners = [cl1,cl2,cl3]

results = Orange.evaluation.testing.cross_validation(learners, data)

print "Classification - bridges.tab"
print "%18s  %6s  %8s  %8s" % ("Learner    ", "LogLoss", "Mean Acc", "Glob Acc")
for i in range(len(learners)):
    print "%18s  %1.4f    %1.4f    %1.4f" % (learners[i].name,
    Orange.multitarget.scoring.mt_average_score(results, Orange.evaluation.scoring.logloss)[i],
    Orange.multitarget.scoring.mt_mean_accuracy(results)[i],
    Orange.multitarget.scoring.mt_global_accuracy(results)[i])

Table Of Contents

Previous topic

Binary Relevance Learner (binary)

Next topic

Neural Network Learner (neural)

This Page