MLCore::MultiClassMetrics
MLCore::MultiClassMetrics
Metrics for a multi-class classification problem. More…
#include <ClassificationMetrics.hpp>
Public Functions
| Name | |
|---|---|
| bool | isValid() const Check if any predictions were counted. |
Public Attributes
| Name | |
|---|---|
| double | overall_accuracy Fraction of correct predictions. |
| arma::umat | confusion_matrix Shape: (num_classes × num_classes), entry (true, pred). |
| std::vector< double > | per_class_precision precision[i] = TP_i / (TP_i + FP_i) |
| std::vector< double > | per_class_recall recall[i] = TP_i / (TP_i + FN_i) |
| std::vector< double > | per_class_f1 f1[i] = 2·P·R / (P + R) |
| std::size_t | num_classes Number of classes. |
Detailed Description
struct MLCore::MultiClassMetrics;Metrics for a multi-class classification problem.
The confusion matrix is stored as an arma::umat of shape (num_classes × num_classes). Entry (i, j) is the count of observations with true class i that were predicted as class j.
Per-class precision, recall, and F1 are vectors of size num_classes. When a denominator is zero, the corresponding metric is 0.0.
Public Functions Documentation
function isValid
inline bool isValid() constCheck if any predictions were counted.
Public Attributes Documentation
variable overall_accuracy
double overall_accuracy = 0.0;Fraction of correct predictions.
variable confusion_matrix
arma::umat confusion_matrix;Shape: (num_classes × num_classes), entry (true, pred).
variable per_class_precision
std::vector< double > per_class_precision;precision[i] = TP_i / (TP_i + FP_i)
variable per_class_recall
std::vector< double > per_class_recall;recall[i] = TP_i / (TP_i + FN_i)
variable per_class_f1
std::vector< double > per_class_f1;f1[i] = 2·P·R / (P + R)
variable num_classes
std::size_t num_classes = 0;Number of classes.
Updated on 2026-11-13 at 20:25:41 +0000