The class ContingencyTableEvaluation a base class used to evaluate 2-class classification with TP, FP, TN, FN rates.
This class has implementations of the measures listed below:
Accuracy (ACCURACY):
Error rate (ERROR_RATE):
Balanced error (BAL):
Weighted relative accuracy (WRACC):
F1 score (F1):
Cross correlation coefficient (CROSS_CORRELATION):
Recall (RECALL):
Precision (PRECISION):
Specificity (SPECIFICITY):
Note that objects of this class should be used only if computing of many different measures is required. In other case, using helper classes (CAccuracyMeasure, ...) could be more convenient.
Definition at line 69 of file ContingencyTableEvaluation.h.
Public Member Functions | |
CContingencyTableEvaluation () | |
CContingencyTableEvaluation (EContingencyTableMeasureType type) | |
virtual | ~CContingencyTableEvaluation () |
virtual float64_t | evaluate (CLabels *predicted, CLabels *ground_truth) |
EEvaluationDirection | get_evaluation_direction () |
virtual const char * | get_name () const |
float64_t | get_accuracy () const |
float64_t | get_error_rate () const |
float64_t | get_BAL () const |
float64_t | get_WRACC () const |
float64_t | get_F1 () const |
float64_t | get_cross_correlation () const |
float64_t | get_recall () const |
float64_t | get_precision () const |
float64_t | get_specificity () const |
Protected Member Functions | |
void | compute_scores (CLabels *predicted, CLabels *ground_truth) |
Protected Attributes | |
EContingencyTableMeasureType | m_type |
bool | m_computed |
int32_t | m_N |
float64_t | m_TP |
float64_t | m_FP |
float64_t | m_TN |
float64_t | m_FN |
constructor
Definition at line 75 of file ContingencyTableEvaluation.h.
constructor
type | type of measure (e.g ACCURACY) |
Definition at line 81 of file ContingencyTableEvaluation.h.
virtual ~CContingencyTableEvaluation | ( | ) | [virtual] |
destructor
Definition at line 85 of file ContingencyTableEvaluation.h.
get scores for TP, FP, TN, FN
Definition at line 73 of file ContingencyTableEvaluation.cpp.
evaluate labels
predicted | labels | |
ground_truth | labels assumed to be correct |
Implements CBinaryClassEvaluation.
Definition at line 15 of file ContingencyTableEvaluation.cpp.
float64_t get_accuracy | ( | ) | const |
float64_t get_BAL | ( | ) | const |
Balanced error (BAL)
Definition at line 127 of file ContingencyTableEvaluation.h.
float64_t get_cross_correlation | ( | ) | const |
cross correlation
Definition at line 160 of file ContingencyTableEvaluation.h.
float64_t get_error_rate | ( | ) | const |
EEvaluationDirection get_evaluation_direction | ( | ) | [virtual] |
Implements CEvaluation.
Definition at line 44 of file ContingencyTableEvaluation.cpp.
float64_t get_F1 | ( | ) | const |
virtual const char* get_name | ( | void | ) | const [virtual] |
get name
Implements CSGObject.
Reimplemented in CAccuracyMeasure, CErrorRateMeasure, CBALMeasure, CWRACCMeasure, CF1Measure, CCrossCorrelationMeasure, CRecallMeasure, CPrecisionMeasure, and CSpecificityMeasure.
Definition at line 97 of file ContingencyTableEvaluation.h.
float64_t get_precision | ( | ) | const |
float64_t get_recall | ( | ) | const |
float64_t get_specificity | ( | ) | const |
specificity
Definition at line 193 of file ContingencyTableEvaluation.h.
float64_t get_WRACC | ( | ) | const |
bool m_computed [protected] |
indicator of contingencies being computed
Definition at line 210 of file ContingencyTableEvaluation.h.
number of false negative examples
Definition at line 225 of file ContingencyTableEvaluation.h.
number of false positive examples
Definition at line 219 of file ContingencyTableEvaluation.h.
int32_t m_N [protected] |
total number of labels
Definition at line 213 of file ContingencyTableEvaluation.h.
number of true negative examples
Definition at line 222 of file ContingencyTableEvaluation.h.
number of true positive examples
Definition at line 216 of file ContingencyTableEvaluation.h.
EContingencyTableMeasureType m_type [protected] |
type of measure to evaluate
Definition at line 207 of file ContingencyTableEvaluation.h.