Function mean_squared_error

Source
pub fn mean_squared_error(y_hat: &Vec<f64>, y: &Vec<f64>) -> Result<f64, Error>
Expand description

Calculates the mean squared error between two vectors.

§Formula

MSE = 1/n * sum((y_hat - y)^2)

§Arguments

  • y_hat - Vector of predicted values
  • y - Vector of actual values

§Returns

  • Mean squared error