Public Member Functions | Protected Member Functions | Protected Attributes

CContingencyTableEvaluation Class Reference

Detailed Description

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): $ \frac{TP+TN}{N} $

Error rate (ERROR_RATE): $ \frac{FP+FN}{N} $

Balanced error (BAL): $ \frac{1}{2} \left( \frac{FN}{FN+TP} + \frac{FP}{FP+TN} \right) $

Weighted relative accuracy (WRACC): $ \frac{TP}{TP+FN} - \frac{FP}{FP+TN} $

F1 score (F1): $ \frac{2\cdot FP}{2\cdot TP + FP + FN} $

Cross correlation coefficient (CROSS_CORRELATION): $ \frac{TP\cdot TN - FP \cdot FN}{\sqrt{(TP+FP)(TP+FN)(TN+FP)(TN+FN)}} $

Recall (RECALL): $ \frac{TP}{TP+FN} $

Precision (PRECISION): $ \frac{TP}{TP+FP} $

Specificity (SPECIFICITY): $ \frac{TN}{TN+FP} $

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.

Inheritance diagram for CContingencyTableEvaluation:
Inheritance graph

List of all members.

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 & Destructor Documentation


Definition at line 75 of file ContingencyTableEvaluation.h.


type type of measure (e.g ACCURACY)

Definition at line 81 of file ContingencyTableEvaluation.h.

virtual ~CContingencyTableEvaluation (  )  [virtual]


Definition at line 85 of file ContingencyTableEvaluation.h.

Member Function Documentation

void compute_scores ( CLabels predicted,
CLabels ground_truth 
) [protected]

get scores for TP, FP, TN, FN

Definition at line 73 of file ContingencyTableEvaluation.cpp.

float64_t evaluate ( CLabels predicted,
CLabels ground_truth 
) [virtual]

evaluate labels

predicted labels
ground_truth labels assumed to be correct
evaluation result

Implements CBinaryClassEvaluation.

Definition at line 15 of file ContingencyTableEvaluation.cpp.

float64_t get_accuracy (  )  const


computed accuracy

Definition at line 105 of file ContingencyTableEvaluation.h.

float64_t get_BAL (  )  const

Balanced error (BAL)

computed BAL

Definition at line 127 of file ContingencyTableEvaluation.h.

float64_t get_cross_correlation (  )  const

cross correlation

computed cross correlation coefficient

Definition at line 160 of file ContingencyTableEvaluation.h.

float64_t get_error_rate (  )  const

error rate

computed error rate

Definition at line 116 of file ContingencyTableEvaluation.h.

EEvaluationDirection get_evaluation_direction (  )  [virtual]
whether criterium has to be maximised or minimised

Implements CEvaluation.

Definition at line 44 of file ContingencyTableEvaluation.cpp.

float64_t get_F1 (  )  const


computed F1 score

Definition at line 149 of file ContingencyTableEvaluation.h.

virtual const char* get_name ( void   )  const [virtual]
float64_t get_precision (  )  const


computed precision

Definition at line 182 of file ContingencyTableEvaluation.h.

float64_t get_recall (  )  const


computed recall

Definition at line 171 of file ContingencyTableEvaluation.h.

float64_t get_specificity (  )  const


computed specificity

Definition at line 193 of file ContingencyTableEvaluation.h.

float64_t get_WRACC (  )  const


computed WRACC

Definition at line 138 of file ContingencyTableEvaluation.h.

Member Data Documentation

bool m_computed [protected]

indicator of contingencies being computed

Definition at line 210 of file ContingencyTableEvaluation.h.

float64_t m_FN [protected]

number of false negative examples

Definition at line 225 of file ContingencyTableEvaluation.h.

float64_t m_FP [protected]

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.

float64_t m_TN [protected]

number of true negative examples

Definition at line 222 of file ContingencyTableEvaluation.h.

float64_t m_TP [protected]

number of true positive examples

Definition at line 216 of file ContingencyTableEvaluation.h.

type of measure to evaluate

Definition at line 207 of file ContingencyTableEvaluation.h.

The documentation for this class was generated from the following files:
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Defines

SHOGUN Machine Learning Toolbox - Documentation