de.fu_berlin.ties.classify
Class PredictionComparator
java.lang.Object
de.fu_berlin.ties.classify.PredictionComparator
- All Implemented Interfaces:
- Comparator<Prediction>
public class PredictionComparator
- extends Object
- implements Comparator<Prediction>
A comparison function that compares
Prediction
s based on their
probabilities.
- Version:
- $Revision: 1.6 $, $Date: 2004/11/19 14:04:19 $, $Author: siefkes $
- Author:
- Christian Siefkes
PredictionComparator
public PredictionComparator()
- Creates a new instance.
compare
public int compare(Prediction pred1,
Prediction pred2)
throws ClassCastException
- Compares two
Prediction
s. This method checks whether the
pR values of both predictions are given
and compares them if they are. Otherwise the
probabilities are compared.
In case of a tie the raw
scores are compared if both are WinnowPrediction
s.
Otherwise the types are compared
lexicographically (but in inverted order, so in case of a tie the
alphabetically first prediction "wins").
- Specified by:
compare
in interface Comparator<Prediction>
- Parameters:
pred1
- the first prediction to be comparedpred2
- the second prediction to be compared
- Returns:
- a negative integer, zero, or a positive integer if the first
argument is less than, equal to, or greater than of the second
- Throws:
ClassCastException
- if either of the arguments is not a
Prediction
toString
public String toString()
- Returns a string representation of this object.
- Overrides:
toString
in class Object
- Returns:
- a textual representation
Copyright © 2003-2004 Christian Siefkes. All Rights Reserved.