matcha.utils.metrics

Metrics computation for regression and classification model evaluation.

Provides functions for calculating standard performance metrics, handling censored data, and computing enrichment factors for ranking tasks.

Functions

process_censor(→ numpy.ndarray)

Apply censoring constraints to predictions based on label bounds and censor indicators.

process_regression(→ numpy.ndarray)

Calculate regression metrics including R2, RMSE, MAE, Spearman correlation, and fold accuracy.

enrichment_factor_score(→ float)

Function to compute Enrichment Factor using precomputed binary labels

process_classification(→ numpy.ndarray)

Calculate classification metrics including accuracy, F1, precision, recall, ROC-AUC, and PR-AUC.

Module Contents

matcha.utils.metrics.process_censor(labels: numpy.ndarray, predictions: numpy.ndarray, censor: list[str]) numpy.ndarray[source]

Apply censoring constraints to predictions based on label bounds and censor indicators.

matcha.utils.metrics.process_regression(labels: numpy.ndarray, predictions: numpy.ndarray, log10: bool = False) numpy.ndarray[source]

Calculate regression metrics including R2, RMSE, MAE, Spearman correlation, and fold accuracy.

matcha.utils.metrics.enrichment_factor_score(y_true: numpy.ndarray, y_prob: numpy.ndarray) float[source]

Function to compute Enrichment Factor using precomputed binary labels according to the threshold set in process_ranking

matcha.utils.metrics.process_classification(labels: numpy.ndarray, predictions: numpy.ndarray, probabilities: numpy.ndarray, model: matcha.sklearn.base_sklearn_model.BaseScikitLearnModel | None = None) numpy.ndarray[source]

Calculate classification metrics including accuracy, F1, precision, recall, ROC-AUC, and PR-AUC.