mulan.evaluation.measure
Class MeasureBase

java.lang.Object
  extended by mulan.evaluation.measure.MeasureBase
All Implemented Interfaces:
Serializable, Measure
Direct Known Subclasses:
BipartitionMeasureBase, ConfidenceMeasureBase, RankingMeasureBase

public abstract class MeasureBase
extends Object
implements Measure, Serializable

Author:
Grigorios Tsoumakas
See Also:
Serialized Form

Constructor Summary
MeasureBase()
           
 
Method Summary
 Measure makeCopy()
          Creates a deep copy of the given measure using serialization.
 String toString()
          Returns a string with the value of a measure
 void update(MultiLabelOutput prediction, boolean[] truth)
          Computes the value of a measure for the given prediction and true labels.
protected abstract  void updateInternal(MultiLabelOutput prediction, boolean[] truth)
          Updates the measure based on an example
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 
Methods inherited from interface mulan.evaluation.measure.Measure
getIdealValue, getName, getValue, reset
 

Constructor Detail

MeasureBase

public MeasureBase()
Method Detail

update

public final void update(MultiLabelOutput prediction,
                         boolean[] truth)
Description copied from interface: Measure
Computes the value of a measure for the given prediction and true labels. The immediate value of a measure is returned and result is added to the cumulated measure value.

Specified by:
update in interface Measure
Parameters:
prediction - the prediction for which measure has to be computed
truth - the true labels bipartition for given prediction
See Also:
Measure.getValue()

toString

public String toString()
Returns a string with the value of a measure

Overrides:
toString in class Object
Returns:
string representation of the value of a measure

updateInternal

protected abstract void updateInternal(MultiLabelOutput prediction,
                                       boolean[] truth)
Updates the measure based on an example

Parameters:
prediction - the output of the algorithm for the example
truth - the ground truth of the example

makeCopy

public Measure makeCopy()
                 throws Exception
Description copied from interface: Measure
Creates a deep copy of the given measure using serialization.

Specified by:
makeCopy in interface Measure
Returns:
a deep copy of the measure
Throws:
Exception - if an error occurs while making copy of the measure.