RegressionMetrics

Trait RegressionMetrics 

Source
pub trait RegressionMetrics<T: RealNumber> {
    // Provided methods
    fn mse(
        &self,
        y_true: &DVector<T>,
        y_pred: &DVector<T>,
    ) -> Result<T, Box<dyn Error>> { ... }
    fn mae(
        &self,
        y_true: &DVector<T>,
        y_pred: &DVector<T>,
    ) -> Result<T, Box<dyn Error>> { ... }
    fn r2(
        &self,
        y_true: &DVector<T>,
        y_pred: &DVector<T>,
    ) -> Result<T, Box<dyn Error>> { ... }
}
Expand description

A trait for computing regression metrics.

Provided Methods§

Source

fn mse( &self, y_true: &DVector<T>, y_pred: &DVector<T>, ) -> Result<T, Box<dyn Error>>

Computes the mean squared error (MSE) between the true values and the predicted values.

§Arguments
  • y_true - The true values.
  • y_pred - The predicted values.
§Returns

The mean squared error.

§Errors

Returns an error if the lengths of y_true and y_pred are different.

Source

fn mae( &self, y_true: &DVector<T>, y_pred: &DVector<T>, ) -> Result<T, Box<dyn Error>>

Computes the mean absolute error (MAE) between the true values and the predicted values.

§Arguments
  • y_true - The true values.
  • y_pred - The predicted values.
§Returns

The mean absolute error.

§Errors

Returns an error if the lengths of y_true and y_pred are different.

Source

fn r2( &self, y_true: &DVector<T>, y_pred: &DVector<T>, ) -> Result<T, Box<dyn Error>>

Computes the coefficient of determination (R^2) between the true values and the predicted values.

§Arguments
  • y_true - The true values.
  • y_pred - The predicted values.
§Returns

The coefficient of determination (R^2).

§Errors

Returns an error if the lengths of y_true and y_pred are different.

Implementors§