tumourkit.utils.classification.metrics_from_predictions
- tumourkit.utils.classification.metrics_from_predictions(y_true: ndarray, y_pred: ndarray, y_prob: ndarray | None = None, num_classes: int | None = 2) List[float]
Computes evaluation metrics using predictions and ground truth. For binary: Accuracy, F1 Score, ROC AUC, %ERR, ECE For multiclass: Micro F1, Macro F1, Weighted F1, ECE
- Parameters:
y_true (np.ndarray) – The ground truth to compare with, values start at 0. Shape: (N, 1).
y_pred (np.ndarray) – Predictions with values starting at 0. Shape: (N, 1).
y_prob (Optional[np.ndarray]) – Probabilities of the predictions. Shape: (N, num_classes) or (N, 1) if binary.
num_classes (Optional[int]) – Number of classes to consider.
- Returns:
Several metrics. Either 4 or 5 floats, depending on whether is binary or multiclass.
- Return type:
List[float]