libeblearn
|
#include <ebl_logger.h>
Public Member Functions | |
classifier_meter () | |
~classifier_meter () | |
Destructor. | |
void | init (uint nclasses) |
int | correctp (ubyte co, ubyte cd) |
void | clear () |
void | resize (intg sz) |
char | update (intg a, class_state *co, ubyte cd, double energy) |
void | update (intg age_, bool correct, double energy) |
void | update (intg age, uint desired, uint infered, double energy) |
void | test (class_state *co, ubyte cd, double energy) |
double | class_normalized_average_error (idx< int > &confu) |
double | overall_average_error (idx< int > &confu) |
double | class_normalized_average_success (idx< int > &confu) |
int | get_class_samples (idx< int > &confu, intg classid) |
int | get_class_errors (idx< int > &confu, intg classid) |
double | get_normalized_error () |
idx< int > & | get_confusion () |
Returns the confusion matrix;. | |
void | info () |
void | info_sprint () |
void | info_print () |
void | display (int iteration, string &dsname, std::vector< string * > *lblstr=NULL, bool ds_is_test=false) |
void | display_average (string &dsname, std::vector< string * > *lblstr=NULL, bool ds_is_test=false) |
Display information averaged over all iterations. | |
void | display_positive_rates (double threshold, std::vector< string * > *lblstr=NULL) |
bool | save () |
bool | load () |
Public Attributes | |
double | energy |
float | confidence |
intg | size |
intg | age |
Number of samples seen for this iteration. | |
intg | total_correct |
intg | total_error |
intg | total_punt |
double | total_energy |
std::vector< uint > | class_errors |
std::vector< uint > | class_totals |
std::vector< uint > | class_tpr |
std::vector< uint > | class_fpr |
std::vector< std::string > | log_fields |
Names of variables to log. | |
std::vector< double > | log_values |
Values to log. | |
std::vector< double > | total_values |
Totals samples used for values. |
Meters are classes used to measure the performance of learning machines. There are several types of meters for each specific situation. meters are generally assumed to have at least the following methods: {
update: updates the meter with the objects and values passed as argument.} { clear: resets the meter, so it can be used for a new series of measurements.} { test: simply prints performance information for the data passed as argument. This does not update any internal state.} } Methods are provided to compute and display the information measured by a meter. {
display: display performance information on the terminal} { info: returns a list of the informations printed by display} } a class that can be used to measure the performance of classifiers. This is a simple version that does not record anything but simply computes performance measures.
ebl::classifier_meter::classifier_meter | ( | ) |
Create a new <classifier-meter> using <comparison-function> to compare actual and desired answers. By default the <same-class?> function is used for that purpose. It takes two integer arguments, and returns 1 if they are equal, -1 if they are different, and 0 if the first argument is -1 (which means reject).
double ebl::classifier_meter::class_normalized_average_error | ( | idx< int > & | confu | ) |
Returns the average error percentage computed from the confusion matrix, i.e. taking into account the class distributions, in other words, returns the mean of the per-class mean error.
double ebl::classifier_meter::class_normalized_average_success | ( | idx< int > & | confu | ) |
Returns the average success percentage computed from the confusion matrix 'confu'.
void ebl::classifier_meter::clear | ( | ) |
reset the meter. This must be called before a measurement campaign is started.
int ebl::classifier_meter::correctp | ( | ubyte | co, |
ubyte | cd | ||
) |
return 0 if <actual> equals -1, otherwise, return 1 if <actual> and <desired> are equal, -1 otherwise.
void ebl::classifier_meter::display | ( | int | iteration, |
string & | dsname, | ||
std::vector< string * > * | lblstr = NULL , |
||
bool | ds_is_test = false |
||
) |
Display the meter's information on the terminal. namely, the age, the number of samples (number of calls to update since the last clear), the average energy, the percentage of correctly recognize samples, the percentage of erroneously recognized samples, and the percentage of rejected samples. names of each class (lblstr) are optional.
ds_is_test | If true, prepend "test_" in front of varialbes. |
void ebl::classifier_meter::display_positive_rates | ( | double | threshold, |
std::vector< string * > * | lblstr = NULL |
||
) |
display ROC points for each class. names of each class (lblstr) are optional.
int ebl::classifier_meter::get_class_errors | ( | idx< int > & | confu, |
intg | classid | ||
) |
Return the number of errors for class with id 'classid' in confusion matrix 'confu'.
int ebl::classifier_meter::get_class_samples | ( | idx< int > & | confu, |
intg | classid | ||
) |
Return the number of samples for class with id 'classid' in confusion matrix 'confu'.
double ebl::classifier_meter::get_normalized_error | ( | ) |
Returns the error rate, normalized by the number of examples of in each class.
void ebl::classifier_meter::info | ( | ) |
return a list with the age, the number of samples (number of calls to update since the last clear), the average energy, the percentage of correctly recognize samples, the percentage of erroneously recognized samples, and the percentage of rejected samples.
void ebl::classifier_meter::init | ( | uint | nclasses | ) |
Initialize the meter.
nclasses | The number of classes. |
double ebl::classifier_meter::overall_average_error | ( | idx< int > & | confu | ) |
Returns the average error percentage computed regardless of the class. This measure might be bias with unbalanced datasets.
char ebl::classifier_meter::update | ( | intg | a, |
class_state * | co, | ||
ubyte | cd, | ||
double | energy | ||
) |
update the meter with results from a new sample. <age> is the number of training iterations so far, <actual> (a <class-state>) the actual output of the machine, <desired> (an idx0 of int) the desired category, and <energy> (an idx0-state) the energy.