mlnext.score#

Module for model evaluation.

Functions

apply_threshold

Applies threshold t to x.

auc_point_adjust_metrics

Calculates the area under the curve for performance metrics with point-adjusted predictions for values of k in [0,100].

bern_log_likelihood

Calculates the log likelihood of x being produced by a bernoulli distribution parameterized by mean.

eval_metrics

Calculates accuracy, f1, precision, recall and recall_anomalies.

eval_metrics_all

Calculates combined accuracy, f1, precision, recall and AUC scores for multiple arrays.

eval_sigmoid

Turns a binary-class sigmoid prediction into 0-1 class labels.

eval_softmax

Turns a multi-class softmax prediction into class labels.

get_threshold

Returns the perc-th percentile of x.

kl_divergence

Calculates the kl divergence kld(q||p) between a normal gaussian p (prior_mean, prior_std) and a normal distribution q parameterized by mean and log_var.

l2_norm

Calculates the l2-norm (euclidean distance) for x and x_hat.

moving_average

Calculates the moving average for X with stepsize step.

norm_log_likelihood

Calculates the negative log likelihood that x was drawn from a normal gaussian distribution defined by mean and log_var.

point_adjust_metrics

Calculates the performance metrics for various k in [0, 100].

pr_curve

Computes precision-recall pairs for different probability thresholds for binary classification tasks.

Classes

ConfusionMatrix

ConfusionMatrix is a confusion matrix for a binary classification problem.

PRCurve

Container for the result of pr_curve.