mulan.classifier.transformation
Class BinaryRelevance

java.lang.Object
  extended by mulan.classifier.MultiLabelLearnerBase
      extended by mulan.classifier.transformation.TransformationBasedMultiLabelLearner
          extended by mulan.classifier.transformation.BinaryRelevance
All Implemented Interfaces:
Serializable, MultiLabelLearner, TechnicalInformationHandler

public class BinaryRelevance
extends TransformationBasedMultiLabelLearner

Version:
2012.03.14
Author:
Robert Friberg, Grigorios Tsoumakas
See Also:
Serialized Form

Field Summary
protected  Classifier[] ensemble
          The ensemble of binary relevance models.
 
Fields inherited from class mulan.classifier.transformation.TransformationBasedMultiLabelLearner
baseClassifier
 
Fields inherited from class mulan.classifier.MultiLabelLearnerBase
featureIndices, labelIndices, numLabels
 
Constructor Summary
BinaryRelevance(Classifier classifier)
          Creates a new instance
 
Method Summary
protected  void buildInternal(MultiLabelInstances train)
          Learner specific implementation of building the model from MultiLabelInstances training data set.
 Classifier getModel(String labelName)
          Returns the model which corresponds to the label with labelName
protected  MultiLabelOutput makePredictionInternal(Instance instance)
          Learner specific implementation for predicting on specified data based on trained model.
 
Methods inherited from class mulan.classifier.transformation.TransformationBasedMultiLabelLearner
getBaseClassifier, getTechnicalInformation, globalInfo
 
Methods inherited from class mulan.classifier.MultiLabelLearnerBase
build, debug, getDebug, isModelInitialized, isUpdatable, makeCopy, makePrediction, setDebug
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

ensemble

protected Classifier[] ensemble
The ensemble of binary relevance models. These are Weka Classifier objects.

Constructor Detail

BinaryRelevance

public BinaryRelevance(Classifier classifier)
Creates a new instance

Parameters:
classifier - the base-level classification algorithm that will be used for training each of the binary models
Method Detail

buildInternal

protected void buildInternal(MultiLabelInstances train)
                      throws Exception
Description copied from class: MultiLabelLearnerBase
Learner specific implementation of building the model from MultiLabelInstances training data set. This method is called from MultiLabelLearnerBase.build(MultiLabelInstances) method, where behavior common across all learners is applied.

Specified by:
buildInternal in class MultiLabelLearnerBase
Parameters:
train - the training data set
Throws:
Exception - if learner model was not created successfully

makePredictionInternal

protected MultiLabelOutput makePredictionInternal(Instance instance)
Description copied from class: MultiLabelLearnerBase
Learner specific implementation for predicting on specified data based on trained model. This method is called from MultiLabelLearnerBase.makePrediction(weka.core.Instance) which guards for model initialization and apply common handling/behavior.

Specified by:
makePredictionInternal in class MultiLabelLearnerBase
Parameters:
instance - the data instance to predict on
Returns:
the output of the learner for the given instance

getModel

public Classifier getModel(String labelName)
Returns the model which corresponds to the label with labelName

Parameters:
labelName -
Returns:
the corresponding model or null if the labelIndex is wrong