mulan.evaluation.measure
Class RankingMeasureBase

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

public abstract class RankingMeasureBase
extends MeasureBase

Version:
2010.12.03
Author:
Grigorios Tsoumakas
See Also:
Serialized Form

Field Summary
protected  int count
          The number of validation examples processed
protected  double sum
          The current sum of the measure
 
Constructor Summary
RankingMeasureBase()
           
 
Method Summary
 double getValue()
          Gets the value of a measure.
 void reset()
          Resets the cumulated measure value, so the process of computation can be started from beginning (e.g. for a new series of outputs from learning task).
protected  void updateInternal(MultiLabelOutput prediction, boolean[] truth)
          Updates the measure based on an example
protected abstract  void updateRanking(int[] ranking, boolean[] truth)
          Updates the measure based on an example
 
Methods inherited from class mulan.evaluation.measure.MeasureBase
makeCopy, toString, update
 
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
 

Field Detail

sum

protected double sum
The current sum of the measure


count

protected int count
The number of validation examples processed

Constructor Detail

RankingMeasureBase

public RankingMeasureBase()
Method Detail

reset

public void reset()
Description copied from interface: Measure
Resets the cumulated measure value, so the process of computation can be started from beginning (e.g. for a new series of outputs from learning task).


getValue

public double getValue()
Description copied from interface: Measure
Gets the value of a measure. The measure is incrementally cumulated for learner's prediction by each Measure.update(MultiLabelOutput, boolean[]) call. The value returned by the method, returns sum of all update calls divided by the number of calls (average of all measures for all predictions).

Returns:
the average measure value computed so far

updateInternal

protected void updateInternal(MultiLabelOutput prediction,
                              boolean[] truth)
Description copied from class: MeasureBase
Updates the measure based on an example

Specified by:
updateInternal in class MeasureBase
Parameters:
prediction - the output of the algorithm for the example
truth - the ground truth of the example

updateRanking

protected abstract void updateRanking(int[] ranking,
                                      boolean[] truth)
Updates the measure based on an example

Parameters:
ranking - the predicted ranking
truth - the ground truth