Models a confusion matrix. More...
#include <YaDT.h>
Public Member Functions | |
float | cases () const |
Return total weights in the confusion matrix. | |
conf_matrix * | clone () const |
Clone method. | |
conf_matrix (const conf_matrix &) | |
Copy constructor not defined. | |
double | get_elapsed () const |
Return elapsed time taken to build the confusion matrix. | |
float | get_element (size_t actual, size_t predicted) const |
Return a cell of the matrix. | |
float | mis_perc () const |
Return misclassification percentage of the confusion matrix. | |
const conf_matrix & | operator= (const conf_matrix &) |
Assignment constructor not defined. | |
size_t | size () const |
Return degree of the matrix. | |
void | toTEXT (std::ostream &os=std::cout, size_t space=0) const |
Text output of the confusion matrix. | |
void | toXML (std::ostream &os=std::cout) const |
XML output of the confusion matrix. | |
~conf_matrix () | |
Destructor. |
Models a confusion matrix.
A confusion matrix is a matrix n x n of weight_type::type, where n is the number of distinct values of a class (including the "unknown" class value). For a conf_matrix object cm, cm.get_element(act, pred) represents the weighted sum of cases of class with index act predicted as belonging to class of index pred. The "unknown" class value has index 0: cm.get_element(0, x) should be 0 since actual classes should never be "unknown" (this may happen, however, if the actual class of cases in the test set did not appear in the training set); cm.get_element(x, 0) should be 0 since predicted classes should never be "unknown". A confusion matrix can only be obtained as the return value of some computation.
yadt::conf_matrix::~conf_matrix | ( | ) |
Destructor.
yadt::conf_matrix::conf_matrix | ( | const conf_matrix & | ) |
Copy constructor not defined.
float yadt::conf_matrix::cases | ( | ) | const |
Return total weights in the confusion matrix.
More formally, for a conf_matrix object cm, it is returned sum(true, cm[i, j]).
conf_matrix* yadt::conf_matrix::clone | ( | ) | const |
Clone method.
Return a newly allocated conf_matrix that is a clone of the called object.
double yadt::conf_matrix::get_elapsed | ( | ) | const |
Return elapsed time taken to build the confusion matrix.
float yadt::conf_matrix::get_element | ( | size_t | actual, | |
size_t | predicted | |||
) | const |
Return a cell of the matrix.
float yadt::conf_matrix::mis_perc | ( | ) | const |
Return misclassification percentage of the confusion matrix.
The misclassification percentage of a conf_matrix object cm is sum(i != j, cm[i, j]).
const conf_matrix& yadt::conf_matrix::operator= | ( | const conf_matrix & | ) |
Assignment constructor not defined.
size_t yadt::conf_matrix::size | ( | ) | const |
Return degree of the matrix.
The degree of a matrix n x n, is n.
void yadt::conf_matrix::toTEXT | ( | std::ostream & | os = std::cout , |
|
size_t | space = 0 | |||
) | const |
Text output of the confusion matrix.
os | output stream. | |
space | indent space. |
void yadt::conf_matrix::toXML | ( | std::ostream & | os = std::cout |
) | const |
XML output of the confusion matrix.