Expand description
F1 score, also known as balanced F-score or F-measure.
F-measure
Harmonic mean of the precision and recall.
\[f1 = (1 + \beta^2)\frac{precision \times recall}{\beta^2 \times precision + recall}\]
where \(\beta \) is a positive real factor, where \(\beta \) is chosen such that recall is considered \(\beta \) times as important as precision.
Example:
use smartcore::metrics::f1::F1;
use smartcore::metrics::Metrics;
let y_pred: Vec<f64> = vec![0., 0., 1., 1., 1., 1.];
let y_true: Vec<f64> = vec![0., 1., 1., 0., 1., 0.];
let beta = 1.0; // beta default is equal 1.0 anyway
let score: f64 = F1::new_with(beta).get_score( &y_true, &y_pred);
Structs
- F-measure