fix: metric parameter name changed

This commit is contained in:
Volodymyr Orlov
2020-06-08 15:02:51 -07:00
parent 14113b4152
commit 61b404afea
5 changed files with 43 additions and 27 deletions
+5 -5
View File
@@ -9,18 +9,18 @@ use crate::metrics::recall::Recall;
pub struct F1 {}
impl F1 {
pub fn get_score<T: FloatExt, V: BaseVector<T>>(&self, y_true: &V, y_prod: &V) -> T {
if y_true.len() != y_prod.len() {
pub fn get_score<T: FloatExt, V: BaseVector<T>>(&self, y_true: &V, y_pred: &V) -> T {
if y_true.len() != y_pred.len() {
panic!(
"The vector sizes don't match: {} != {}",
y_true.len(),
y_prod.len()
y_pred.len()
);
}
let beta2 = T::one();
let p = Precision {}.get_score(y_true, y_prod);
let r = Recall {}.get_score(y_true, y_prod);
let p = Precision {}.get_score(y_true, y_pred);
let r = Recall {}.get_score(y_true, y_pred);
(T::one() + beta2) * (p * r) / (beta2 * p + r)
}