Allows interpretation of classification errors.
More...
#include <confusion_matrix.h>
|
void | print_class_stats (std::ostream &out, const class_label &label, double &prec, double &rec, double &f1, size_t width) const |
| Prints precision, recall, and F1 for each class and as a whole. More...
|
|
|
prediction_counts | predictions_ |
| maps predicted class to actual class frequencies
|
|
std::set< class_label > | classes_ |
| Keeps track of the number of classes. More...
|
|
std::unordered_map< class_label, size_t > | counts_ |
| how many times each class was predicted
|
|
size_t | total_ |
| total number of classification attempts
|
|
Allows interpretation of classification errors.
typedef for predicted class assignments to counts.
void meta::classify::confusion_matrix::add |
( |
const class_label & |
predicted, |
|
|
const class_label & |
actual, |
|
|
size_t |
times = 1 |
|
) |
| |
- Parameters
-
predicted | The predicted class label |
actual | The actual class label |
times | The number of times this prediction was made |
void meta::classify::confusion_matrix::print_stats |
( |
std::ostream & |
out = std::cout | ) |
const |
Prints this matrix's statistics to out.
- Parameters
-
out | The stream to write to (defaults to std::cout ) |
void meta::classify::confusion_matrix::print |
( |
std::ostream & |
out = std::cout | ) |
const |
Prints this matrix to out.
- Parameters
-
out | The stream to write to (defaults to std::cout ) |
void meta::classify::confusion_matrix::print_result_pairs |
( |
std::ostream & |
out = std::cout | ) |
const |
Prints (predicted, actual) pairs for all judgements.
- Parameters
-
out | The stream to write to (defaults to std::cout ) |
size_t meta::classify::confusion_matrix::string_pair_hash |
( |
const std::pair< std::string, std::string > & |
strPair | ) |
|
|
static |
Implements a hash function for a pair of strings.
- Parameters
-
str_pair | The pair of strings |
- Returns
- the hash
double meta::classify::confusion_matrix::accuracy |
( |
| ) |
const |
- Returns
- the accuracy for this confusion matrix
operator+ for confusion matrices.
All counts are agglomerated for all predictions.
- Parameters
-
- Returns
- a confusion_matrix containing all predictions of the parameters
operator+= for confusion matrices.
All counts are agglomerated for all predictions.
- Parameters
-
- Returns
- a confusion_matrix containing all predictions of the parameters
- Parameters
-
a | The first matrix to compare |
b | The second matrix to compare |
- Returns
- whether results between two confusion matrices are statistically significant according to McNemar's test with Yates' correction for continuity (alpha = .05)
void meta::classify::confusion_matrix::print_class_stats |
( |
std::ostream & |
out, |
|
|
const class_label & |
label, |
|
|
double & |
prec, |
|
|
double & |
rec, |
|
|
double & |
f1, |
|
|
size_t |
width |
|
) |
| const |
|
private |
Prints precision, recall, and F1 for each class and as a whole.
- Parameters
-
out | The stream to print to |
label | The current class label to get statistics for |
prec | The precision for this class |
rec | The recall for this class |
f1 | The F1 score for this class |
std::set<class_label> meta::classify::confusion_matrix::classes_ |
|
private |
Keeps track of the number of classes.
We use a std::set here so the class labels are sorted alphabetically.
The documentation for this class was generated from the following files: