Class ConfusionMatrix
- java.lang.Object
-
- ai.libs.jaicore.ml.classification.loss.ConfusionMatrix
-
public class ConfusionMatrix extends java.lang.Object
Given two equal-length lists/vectors of values, this class computes a confusion matrix
-
-
Constructor Summary
Constructors Constructor Description ConfusionMatrix(java.util.List<?> expected, java.util.List<?> actual)
Constructor computing the confusion matrix based on the given equal-length lists expected and actual.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description int[][]
getConfusionMatrix()
Returns an integer matrix with counts of the confusions.int
getIndexOfObject(java.lang.Object object)
Returns the index of an object in the confusion matrix.java.util.List<java.lang.Object>
getObjectIndex()
Gets the order of all the occurring elements which also defines the index of an element.java.lang.String
toString()
-
-
-
Constructor Detail
-
ConfusionMatrix
public ConfusionMatrix(java.util.List<?> expected, java.util.List<?> actual)
Constructor computing the confusion matrix based on the given equal-length lists expected and actual.- Parameters:
expected
- The list of expected values.actual
- The list of actual values.
-
-
Method Detail
-
getObjectIndex
public java.util.List<java.lang.Object> getObjectIndex()
Gets the order of all the occurring elements which also defines the index of an element.- Returns:
- The index list of objects.
-
getIndexOfObject
public int getIndexOfObject(java.lang.Object object)
Returns the index of an object in the confusion matrix.- Parameters:
object
- The object for which to retrieve the index.- Returns:
- The index of the given object.
-
getConfusionMatrix
public int[][] getConfusionMatrix()
Returns an integer matrix with counts of the confusions.- Returns:
- The integer matrix counting all occurring confusions.
-
toString
public java.lang.String toString()
- Overrides:
toString
in classjava.lang.Object
-
-