rust_ml/bench/classification_metrics.rs
1/// Performance metrics for classification models.
2///
3/// This struct contains common evaluation metrics used to assess the performance
4/// of classification models, including accuracy, precision, recall, and F1 score.
5#[derive(Debug)]
6pub struct ClassificationMetrics {
7 /// The loss value (e.g., cross-entropy loss) from the model's predictions.
8 pub loss: f64,
9
10 /// The accuracy of the model, measured as the proportion of correctly
11 /// classified instances out of the total instances.
12 /// Range: [0.0, 1.0], where 1.0 means perfect classification.
13 pub accuracy: f64,
14
15 /// The precision of the model, measured as the ratio of true positives to
16 /// the sum of true positives and false positives.
17 /// Range: [0.0, 1.0], where 1.0 means no false positives.
18 pub precision: f64,
19
20 /// The recall (sensitivity) of the model, measured as the ratio of true positives
21 /// to the sum of true positives and false negatives.
22 /// Range: [0.0, 1.0], where 1.0 means no false negatives.
23 pub recall: f64,
24
25 /// The F1 score, which is the harmonic mean of precision and recall.
26 /// Range: [0.0, 1.0], where 1.0 means perfect precision and recall.
27 /// F1 = 2 * (precision * recall) / (precision + recall)
28 pub f1_score: f64,
29}