[][src]Module smartcore::metrics::f1

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;
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 score: f64 = F1 {beta: 1.0}.get_score(&y_pred, &y_true);

Structs

F1

F-measure