diff --git a/src/functions/loss_functions.rs b/src/functions/loss_functions.rs index 40cbc8d..5f15e6e 100644 --- a/src/functions/loss_functions.rs +++ b/src/functions/loss_functions.rs @@ -1,5 +1,3 @@ -use std::ops::MulAssign; - use ndarray::{Array1, ArrayView1}; pub enum Type { @@ -16,7 +14,7 @@ pub fn parse_type(t: Type) -> (fn(ArrayView1, ArrayView1) -> f64, fn(A pub fn mse(y_true: ArrayView1, y_pred: ArrayView1) -> f64 { let mut temp = &y_true - &y_pred; - temp.mul_assign(&temp.clone()); + temp.mapv_inplace(|x| x * x); let mut sum = 0.0; for i in 0..temp.len() { sum += temp.get(i).unwrap();