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>> { ... }
}
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.
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.
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.
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.
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.