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.
|
cloneequals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitadd, clear, getActualCategories, getCategories, getCount, getPredictedCategories, getPredictedCategoriesclonepublic AbstractConfusionMatrix()
AbstractConfusionMatrix.public void add(CategoryType target, CategoryType estimate)
ConfusionMatrixadd in interface ConfusionMatrix<CategoryType>target - The actual category.estimate - The predicted category.public <OtherType extends CategoryType> void addAll(ConfusionMatrix<OtherType> other)
ConfusionMatrixaddAll 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()
ConfusionMatrixisEmpty in interface ConfusionMatrix<CategoryType>public double getTotalCount()
ConfusionMatrixgetTotalCount in interface ConfusionMatrix<CategoryType>public double getTotalCorrectCount()
ConfusionMatrixgetTotalCorrectCount in interface ConfusionMatrix<CategoryType>public double getTotalIncorrectCount()
ConfusionMatrixgetTotalCount() - getTotalCorrectCount().getTotalIncorrectCount in interface ConfusionMatrix<CategoryType>public double getActualCount(CategoryType target)
ConfusionMatrixgetActualCount in interface ConfusionMatrix<CategoryType>target - The actual category.public double getPredictedCount(CategoryType predicted)
ConfusionMatrixgetPredictedCount in interface ConfusionMatrix<CategoryType>predicted - The predicted category.public double getAccuracy()
ConfusionMatrixgetAccuracy in interface ConfusionMatrix<CategoryType>public double getCategoryAccuracy(CategoryType category)
ConfusionMatrixgetCategoryAccuracy in interface ConfusionMatrix<CategoryType>category - The category to get the accuracy for.public double getAverageCategoryAccuracy()
ConfusionMatrixgetAverageCategoryAccuracy in interface ConfusionMatrix<CategoryType>public double getErrorRate()
ConfusionMatrixgetErrorRate in interface ConfusionMatrix<CategoryType>public double getCategoryErrorRate(CategoryType category)
ConfusionMatrixgetCategoryErrorRate in interface ConfusionMatrix<CategoryType>category - The category to get the error rate for.public double getAverageCategoryErrorRate()
ConfusionMatrixgetAverageCategoryErrorRate in interface ConfusionMatrix<CategoryType>