Package org.egothor.methodatlas.eval
Record Class AccuracyMetrics.Counts
java.lang.Object
java.lang.Record
org.egothor.methodatlas.eval.AccuracyMetrics.Counts
- Record Components:
tp- true positivesfp- false positivesfn- false negativestn- true negatives
- Enclosing class:
AccuracyMetrics
Confusion counts for one binary decision.
-
Constructor Summary
ConstructorsConstructorDescriptionCounts(int tp, int fp, int fn, int tn) Creates an instance of aCountsrecord class. -
Method Summary
Modifier and TypeMethodDescriptionaccuracy()Returns the accuracy.final booleanIndicates whether some other object is "equal to" this one.f1()Returns the F1 score, the harmonic mean of precision and recall.intfn()Returns the value of thefnrecord component.intfp()Returns the value of thefprecord component.final inthashCode()Returns a hash code value for this object.Returns the precision.recall()Returns the recall.intsupport()Returns the number of truly positive samples.inttn()Returns the value of thetnrecord component.final StringtoString()Returns a string representation of this record class.inttotal()Returns the total number of samples counted.inttp()Returns the value of thetprecord component.
-
Constructor Details
-
Method Details
-
support
public int support()Returns the number of truly positive samples.- Returns:
tp + fn
-
total
public int total()Returns the total number of samples counted.- Returns:
tp + fp + fn + tn
-
precision
Returns the precision.- Returns:
tp/(tp+fp), or empty when nothing was predicted positive
-
recall
Returns the recall.- Returns:
tp/(tp+fn), or empty when there are no true positives in the truth (zero support)
-
f1
Returns the F1 score, the harmonic mean of precision and recall.- Returns:
2tp/(2tp+fp+fn), or empty when there is neither a predicted nor a true positive
-
accuracy
Returns the accuracy.- Returns:
(tp+tn)/total, or empty when no samples were counted
-
toString
Returns a string representation of this record class. The representation contains the name of the class, followed by the name and value of each of the record components. -
hashCode
public final int hashCode()Returns a hash code value for this object. The value is derived from the hash code of each of the record components. -
equals
Indicates whether some other object is "equal to" this one. The objects are equal if the other object is of the same class and if all the record components are equal. All components in this record class are compared with '=='. -
tp
public int tp()Returns the value of thetprecord component.- Returns:
- the value of the
tprecord component
-
fp
public int fp()Returns the value of thefprecord component.- Returns:
- the value of the
fprecord component
-
fn
public int fn()Returns the value of thefnrecord component.- Returns:
- the value of the
fnrecord component
-
tn
public int tn()Returns the value of thetnrecord component.- Returns:
- the value of the
tnrecord component
-