Skip to content

mlforecast/intervals-without-calibration

Rule intervals-without-calibration
Pack MLForecast
Severity warning
Fix none, edit by hand
Library versions every version

MLForecast.predict(level=...) needs a fit that calibrates prediction intervals. Without calibration, prediction can succeed with only point forecasts.

forecast.fit(train)
forecast.fit(train, prediction_intervals=PredictionIntervals(n_windows=2, h=7))
predicted = forecast.predict(h=7, level=[95])

The rule follows the receiver to an imported MLForecast constructor. It reports a forecast with a literal confidence level when the previous statement is a call to fit on the same receiver with no interval configuration or with prediction_intervals=None. It leaves calls with unpacked fit arguments alone.

On MLForecast 1.1.0, the uncalibrated call warned and returned Ridge alone. The calibrated call returned Ridge, Ridge-lo-95 and Ridge-hi-95. See Nixtla’s prediction interval guide.

Fit with PredictionIntervals and a calibration horizon and number of windows that fit the data. xpd has no automatic fix because the choice depends on the forecast horizon and the available history.

xpd prints this message with the issue. A name that starts with $ stands for code from your file.

This MLForecast fit did not calibrate prediction intervals. predict(level=...) warns and returns point forecasts without interval columns. Fit with prediction_intervals=PredictionIntervals(...) before requesting levels.

Browse the other rules of the MLForecast pack.