Class ConfusionMatrix<T extends Comparable<? super T>>
- java.lang.Object
-
- org.nd4j.evaluation.classification.ConfusionMatrix<T>
-
- All Implemented Interfaces:
Serializable
public class ConfusionMatrix<T extends Comparable<? super T>> extends Object implements Serializable
- See Also:
- Serialized Form
-
-
Constructor Summary
Constructors Constructor Description ConfusionMatrix()
ConfusionMatrix(List<T> classes)
Creates an empty confusion MatrixConfusionMatrix(ConfusionMatrix<T> other)
Creates a new ConfusionMatrix initialized with the contents of another ConfusionMatrix.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description void
add(ConfusionMatrix<T> other)
Adds the entries from another confusion matrix to this one.void
add(T actual, T predicted)
Increments the entry specified by actual and predicted by one.void
add(T actual, T predicted, int count)
Increments the entry specified by actual and predicted by count.boolean
equals(Object o)
int
getActualTotal(T actual)
Computes the total number of times the class actually appeared in the data.List<T>
getClasses()
Gives the applyTransformToDestination of all classes in the confusion matrix.int
getCount(T actual, T predicted)
Gives the count of the number of times the "predicted" class was predicted for the "actual" class.int
getPredictedTotal(T predicted)
Computes the total number of times the class was predicted by the classifier.int
hashCode()
String
toCSV()
Outputs the ConfusionMatrix as comma-separated values for easy import into spreadsheetsString
toHTML()
Outputs Confusion Matrix in an HTML table.String
toString()
-
-
-
Constructor Detail
-
ConfusionMatrix
public ConfusionMatrix()
-
ConfusionMatrix
public ConfusionMatrix(ConfusionMatrix<T> other)
Creates a new ConfusionMatrix initialized with the contents of another ConfusionMatrix.
-
-
Method Detail
-
add
public void add(T actual, T predicted)
Increments the entry specified by actual and predicted by one.
-
add
public void add(T actual, T predicted, int count)
Increments the entry specified by actual and predicted by count.
-
add
public void add(ConfusionMatrix<T> other)
Adds the entries from another confusion matrix to this one.
-
getClasses
public List<T> getClasses()
Gives the applyTransformToDestination of all classes in the confusion matrix.
-
getCount
public int getCount(T actual, T predicted)
Gives the count of the number of times the "predicted" class was predicted for the "actual" class.
-
getPredictedTotal
public int getPredictedTotal(T predicted)
Computes the total number of times the class was predicted by the classifier.
-
getActualTotal
public int getActualTotal(T actual)
Computes the total number of times the class actually appeared in the data.
-
toCSV
public String toCSV()
Outputs the ConfusionMatrix as comma-separated values for easy import into spreadsheets
-
toHTML
public String toHTML()
Outputs Confusion Matrix in an HTML table. Cascading Style Sheets (CSS) can control the table's appearance by defining the empty-space, actual-count-header, predicted-class-header, and count-element classes. For example- Returns:
- html string
-
-