rdr.mulan
Class MultiLabelClassifierBase

java.lang.Object
  extended by rdr.mulan.MultiLabelClassifierBase
All Implemented Interfaces:
java.io.Serializable, MultiLabelClassifier, weka.core.TechnicalInformationHandler
Direct Known Subclasses:
TransformationBasedMultiLabelClassifier

public abstract class MultiLabelClassifierBase
extends java.lang.Object
implements weka.core.TechnicalInformationHandler, MultiLabelClassifier, java.io.Serializable

Common base class for all multi-label classifiers.

Version:
$Revision: 0.3 $
Author:
Robert Friberg, Jozef Vilcek, Grigorios Tsoumakas
See Also:
Serialized Form

Constructor Summary
MultiLabelClassifierBase(int numLabels)
          Creates a MultiLabelClassifierBase instance.
 
Method Summary
abstract  void buildClassifier(weka.core.Instances instances)
          Builds the classifier.
 boolean getDebug()
          Get whether debugging is turned on.
 int getNumLabels()
          Returns a number of labels the classifier is configured for.
abstract  weka.core.TechnicalInformation getTechnicalInformation()
          
static MultiLabelClassifier makeCopy(MultiLabelClassifier model)
          Creates a deep copy of the given classifier using serialization.
 Prediction predict(weka.core.Instance instance)
          Computes the prediction of labels for a specified input Instance.
 void setDebug(boolean debug)
          Set debugging mode.
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

MultiLabelClassifierBase

public MultiLabelClassifierBase(int numLabels)
Creates a MultiLabelClassifierBase instance.

Parameters:
numLabels - the number of labels the classifier should use
Method Detail

getNumLabels

public int getNumLabels()
Returns a number of labels the classifier is configured for. The label attributes are assumed to be the last ones in Instances training data.

Specified by:
getNumLabels in interface MultiLabelClassifier
Returns:
the number of labels

getTechnicalInformation

public abstract weka.core.TechnicalInformation getTechnicalInformation()

Specified by:
getTechnicalInformation in interface weka.core.TechnicalInformationHandler

buildClassifier

public abstract void buildClassifier(weka.core.Instances instances)
                              throws java.lang.Exception
Builds the classifier.

Specified by:
buildClassifier in interface MultiLabelClassifier
Parameters:
instances - set of training data, upon which the classifier should be build
Throws:
java.lang.Exception - if classifier was not created successfully

predict

public final Prediction predict(weka.core.Instance instance)
                         throws java.lang.Exception
Description copied from interface: MultiLabelClassifier
Computes the prediction of labels for a specified input Instance.

Specified by:
predict in interface MultiLabelClassifier
Parameters:
instance - the input instance for which the prediction is made
Returns:
the prediction
Throws:
java.lang.Exception - if prediction was not successful

setDebug

public void setDebug(boolean debug)
Set debugging mode.

Parameters:
debug - true if debug output should be printed

getDebug

public boolean getDebug()
Get whether debugging is turned on.

Returns:
true if debugging output is on

makeCopy

public static MultiLabelClassifier makeCopy(MultiLabelClassifier model)
                                     throws java.lang.Exception
Creates a deep copy of the given classifier using serialization.

Parameters:
model - the classifier to copy
Returns:
a deep copy of the classifier
Throws:
java.lang.Exception - if an error occurs