jsat.classifiers.evaluation
Class SimpleBinaryClassMetric
- java.lang.Object
-
- jsat.classifiers.evaluation.SimpleBinaryClassMetric
-
- All Implemented Interfaces:
- java.io.Serializable, ClassificationScore
- Direct Known Subclasses:
- F1Score, FbetaScore, MatthewsCorrelationCoefficient, Precision, Recall
public abstract class SimpleBinaryClassMetric extends java.lang.Object implements ClassificationScore
This is a base class for scores that can be computed from simple counts of the true positives, true negatives, false positives, and false negatives. The class with index zero will be considered the positive class and the class with the first index will be the negative class.
By default this class assumes higher scores are better- See Also:
- Serialized Form
-
-
Constructor Summary
Constructors Constructor and Description SimpleBinaryClassMetric()SimpleBinaryClassMetric(SimpleBinaryClassMetric toClone)
-
Method Summary
All Methods Instance Methods Abstract Methods Concrete Methods Modifier and Type Method and Description voidaddResult(CategoricalResults prediction, int trueLabel, double weight)Adds the given result to the scorevoidaddResults(ClassificationScore other)The score contained in this object is augmented with the results already accumulated in theotherobject.abstract SimpleBinaryClassMetricclone()abstract doublegetScore()Computes the score for the results that have been enrolled viaClassificationScore.addResult(jsat.classifiers.CategoricalResults, int, double)booleanlowerIsBetter()Returnstrueif a lower score is better, orfalseif a higher score is bettervoidprepare(CategoricalData toPredict)Prepares this score to predict on the given input-
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
-
Methods inherited from interface jsat.classifiers.evaluation.ClassificationScore
equals, getName, hashCode
-
-
-
-
Constructor Detail
-
SimpleBinaryClassMetric
public SimpleBinaryClassMetric()
-
SimpleBinaryClassMetric
public SimpleBinaryClassMetric(SimpleBinaryClassMetric toClone)
-
-
Method Detail
-
addResult
public void addResult(CategoricalResults prediction, int trueLabel, double weight)
Description copied from interface:ClassificationScoreAdds the given result to the score- Specified by:
addResultin interfaceClassificationScore- Parameters:
prediction- the prediction for the data pointtrueLabel- the true label for the data pointweight- the weigh to assign to the data point
-
prepare
public void prepare(CategoricalData toPredict)
Description copied from interface:ClassificationScorePrepares this score to predict on the given input- Specified by:
preparein interfaceClassificationScore- Parameters:
toPredict- the class label information that will be evaluated
-
addResults
public void addResults(ClassificationScore other)
Description copied from interface:ClassificationScoreThe score contained in this object is augmented with the results already accumulated in theotherobject. This does not result in an averaging, but alters the current object to have the same score it would have had if all the results were originally inserted into this object.
This method is only required to work ifotherif of the same class asthisobject.- Specified by:
addResultsin interfaceClassificationScore- Parameters:
other- the object to add the results from
-
getScore
public abstract double getScore()
Description copied from interface:ClassificationScoreComputes the score for the results that have been enrolled viaClassificationScore.addResult(jsat.classifiers.CategoricalResults, int, double)- Specified by:
getScorein interfaceClassificationScore- Returns:
- the score for the current results
-
lowerIsBetter
public boolean lowerIsBetter()
Description copied from interface:ClassificationScoreReturnstrueif a lower score is better, orfalseif a higher score is better- Specified by:
lowerIsBetterin interfaceClassificationScore- Returns:
trueif a lower score is better
-
clone
public abstract SimpleBinaryClassMetric clone()
- Specified by:
clonein interfaceClassificationScore- Overrides:
clonein classjava.lang.Object
-
-
DataMelt 3.0 © DataMelt by jWork.ORG