ClassificationMetrics

Trait ClassificationMetrics 

Source
pub trait ClassificationMetrics<T: WholeNumber> {
    // Provided methods
    fn confusion_matrix(
        &self,
        y_true: &DVector<T>,
        y_pred: &DVector<T>,
    ) -> Result<DMatrix<usize>, Box<dyn Error>> { ... }
    fn accuracy(
        &self,
        y_true: &DVector<T>,
        y_pred: &DVector<T>,
    ) -> Result<f64, Box<dyn Error>> { ... }
    fn precision(
        &self,
        y_true: &DVector<T>,
        y_pred: &DVector<T>,
    ) -> Result<f64, Box<dyn Error>> { ... }
    fn recall(
        &self,
        y_true: &DVector<T>,
        y_pred: &DVector<T>,
    ) -> Result<f64, Box<dyn Error>> { ... }
    fn f1_score(
        &self,
        y_true: &DVector<T>,
        y_pred: &DVector<T>,
    ) -> Result<f64, Box<dyn Error>> { ... }
}

Provided Methods§

Source

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

Computes the confusion matrix based on the true labels and predicted labels.

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

The confusion matrix as a Result containing a ConfusionMatrix or an error message.

Source

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

Computes the accuracy based on the true labels and predicted labels.

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

The accuracy as a Result containing a f64 value or an error message.

Source

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

Computes the precision based on the true labels and predicted labels.

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

The precision as a Result containing a f64 value or an error message.

Source

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

Computes the recall based on the true labels and predicted labels.

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

The recall as a Result containing a f64 value or an error message.

Source

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

Computes the F1 score based on the true labels and predicted labels.

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

The F1 score as a Result containing a f64 value or an error message.

Implementors§