CategoryType
- The type of category that the confusion matrix is under.public abstract class AbstractConfusionMatrix<CategoryType> extends AbstractCloneableSerializable implements ConfusionMatrix<CategoryType>
ConfusionMatrix
interface. Takes
care of a lot of the support functions in the interface so that
implementations can focus on the core data structures.Constructor and Description |
---|
AbstractConfusionMatrix()
Creates a new
AbstractConfusionMatrix . |
Modifier and Type | Method and Description |
---|---|
void |
add(CategoryType target,
CategoryType estimate)
Adds a count of one to the matrix entry for the (actual, predicted)
pair.
|
<OtherType extends CategoryType> |
addAll(ConfusionMatrix<OtherType> other)
Adds all of the values in the given confusion matrix to this confusion
matrix.
|
double |
getAccuracy()
The accuracy value of the entire confusion matrix.
|
double |
getActualCount(CategoryType target)
Gets the total number of entries for the given actual category.
|
double |
getAverageCategoryAccuracy()
The average accuracy value for the categories in the confusion
matrix.
|
double |
getAverageCategoryErrorRate()
The average error rate for the actual categories in the confusion
matrix.
|
double |
getCategoryAccuracy(CategoryType category)
The category accuracy value for the confusion matrix.
|
double |
getCategoryErrorRate(CategoryType category)
The category error rate for the confusion matrix.
|
double |
getErrorRate()
The error rate of the entire confusion matrix.
|
double |
getPredictedCount(CategoryType predicted)
Gets the total number of entries for the given predicted category.
|
double |
getTotalCorrectCount()
Gets the total number of correct entries in the confusion matrix.
|
double |
getTotalCount()
Gets the total number of entries in the confusion matrix.
|
double |
getTotalIncorrectCount()
Gets the total number of incorrect entries in the confusion matrix.
|
boolean |
isEmpty()
Gets whether or not the matrix is empty.
|
clone
equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
add, clear, getActualCategories, getCategories, getCount, getPredictedCategories, getPredictedCategories
clone
public AbstractConfusionMatrix()
AbstractConfusionMatrix
.public void add(CategoryType target, CategoryType estimate)
ConfusionMatrix
add
in interface ConfusionMatrix<CategoryType>
target
- The actual category.estimate
- The predicted category.public <OtherType extends CategoryType> void addAll(ConfusionMatrix<OtherType> other)
ConfusionMatrix
addAll
in interface ConfusionMatrix<CategoryType>
OtherType
- The type of values in the other matrix, which must extend the type
of value in this matrix. Typically these will be the same.other
- The other confusion matrix to add all of its values to this one.public boolean isEmpty()
ConfusionMatrix
isEmpty
in interface ConfusionMatrix<CategoryType>
public double getTotalCount()
ConfusionMatrix
getTotalCount
in interface ConfusionMatrix<CategoryType>
public double getTotalCorrectCount()
ConfusionMatrix
getTotalCorrectCount
in interface ConfusionMatrix<CategoryType>
public double getTotalIncorrectCount()
ConfusionMatrix
getTotalCount() - getTotalCorrectCount()
.getTotalIncorrectCount
in interface ConfusionMatrix<CategoryType>
public double getActualCount(CategoryType target)
ConfusionMatrix
getActualCount
in interface ConfusionMatrix<CategoryType>
target
- The actual category.public double getPredictedCount(CategoryType predicted)
ConfusionMatrix
getPredictedCount
in interface ConfusionMatrix<CategoryType>
predicted
- The predicted category.public double getAccuracy()
ConfusionMatrix
getAccuracy
in interface ConfusionMatrix<CategoryType>
public double getCategoryAccuracy(CategoryType category)
ConfusionMatrix
getCategoryAccuracy
in interface ConfusionMatrix<CategoryType>
category
- The category to get the accuracy for.public double getAverageCategoryAccuracy()
ConfusionMatrix
getAverageCategoryAccuracy
in interface ConfusionMatrix<CategoryType>
public double getErrorRate()
ConfusionMatrix
getErrorRate
in interface ConfusionMatrix<CategoryType>
public double getCategoryErrorRate(CategoryType category)
ConfusionMatrix
getCategoryErrorRate
in interface ConfusionMatrix<CategoryType>
category
- The category to get the error rate for.public double getAverageCategoryErrorRate()
ConfusionMatrix
getAverageCategoryErrorRate
in interface ConfusionMatrix<CategoryType>