Skip to content

model_diagnostics/invalid-functional-or-level

Pack Severity Fix Versions
model-diagnostics error none, edit by hand All versions

model_diagnostics validates functional against ("mean", "median", "expectile", "quantile") and requires 0 < level < 1 for quantile and expectile functionals and score objects (PinballLoss, HomogeneousQuantileScore, HomogeneousExpectileScore, ElementaryScore). Invalid values such as functional="mode" or level=0, level=1, or level=90 raise ValueError.

decompose(y_val, y_pred, scoring_function=PinballLoss(level=90), functional="quantile", level=90)
decompose(y_val, y_pred, scoring_function=PinballLoss(level=0.9), functional="quantile", level=0.9)

Calls to model_diagnostics scoring or calibration APIs with a string literal functional outside ("mean", "median", "expectile", "quantile") or a numeric literal level outside the open interval (0, 1).

Choose one of "mean", "median", "expectile", or "quantile" for functional, and express level as a fraction strictly between 0 and 1 (such as 0.5 or 0.9).

functional must be one of "mean", "median", "expectile", or "quantile" in model_diagnostics; any other literal raises ValueError.

See all rules in the model-diagnostics pack.