NRAE#

mlquantify.metrics.NRAE(prev_real, prev_pred, eps=0.0)[source]#

Compute the normalized relative absolute error between the real and predicted prevalences.

Parameters:
prev_realarray-like of shape (n_classes,)

True prevalence values for each class.

prev_predarray-like of shape (n_classes,)

Predicted prevalence values for each class.

epsfloat, default=0.0

Additive (Laplace) smoothing applied to both prevalence vectors; see RAE. Needed when the true prevalence can be zero (e.g. under APP), since the normalisation also divides by min(prev_real).

Returns:
errorfloat

Normalized relative absolute error across all classes.