Binary Relevance Learner (binary)

class Orange.multitarget.binary.BinaryRelevanceLearner(learner=None, name='Binary Relevance', callback=None, **kwargs)

Bases: Orange.classification.Learner

Creates a standard single class learner for each class variable. Binary relevance assumes independance of class variables.

Parameters:
  • learner (Orange.core.Learner) – A single class learner.
  • 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.BinaryRelevanceLearner or Orange.multitarget.BinaryRelevanceCLassifier

class Orange.multitarget.binary.BinaryRelevanceClassifier(classifiers, domains, name)

Bases: Orange.classification.Classifier

Uses the classifiers induced by the BinaryRelevanceLearner. 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.

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

Examples

import Orange

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

cl1 = Orange.multitarget.binary.BinaryRelevanceLearner( \
	learner = Orange.classification.majority.MajorityLearner, name="Binary - Maj")
cl2 = Orange.multitarget.binary.BinaryRelevanceLearner( \
	learner = Orange.classification.tree.SimpleTreeLearner, name="Binary - Tree")

learners = [cl1,cl2]

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

Clustering Tree Learner (tree)

Next topic

Classifier Chain Learner (chain)

This Page