sktime: [BUG] AutoETS `predict_quantile` and `predict_interval` fail in sktime 0.17.2
Describe the bug
AutoETS predict_quantiles and predict_interval fail in sktime 0.17.2, These were working in 0.17.1. Originally observed when we tried to upgrade pycaret to use sktime 0.17.2 (see: https://github.com/pycaret/pycaret/issues/3523).
To Reproduce
!pip install sktime==0.17.2
from sktime.datasets import load_airline
from sktime.forecasting.ets import AutoETS
y = load_airline()
forecaster = AutoETS(auto=True, n_jobs=-1, sp=12)
forecaster.fit(y)
# Gives error
y_pred = forecaster.predict_quantiles(fh=[1,2,3])
# Also gives error
y_pred = forecaster.predict_interval(fh=[1,2,3])
---------------------------------------------------------------------------
TypeError Traceback (most recent call last)
[<ipython-input-4-b9df560b190c>](https://localhost:8080/#) in <cell line: 1>()
----> 1 y_pred = forecaster.predict_quantiles(fh=[1,2,3])
4 frames
[/usr/local/lib/python3.10/dist-packages/sktime/forecasting/base/_base.py](https://localhost:8080/#) in predict_quantiles(self, fh, X, alpha)
559 # we call the ordinary _predict_quantiles if no looping/vectorization needed
560 if not self._is_vectorized:
--> 561 quantiles = self._predict_quantiles(fh=fh, X=X_inner, alpha=alpha)
562 else:
563 # otherwise we call the vectorized version of predict_quantiles
[/usr/local/lib/python3.10/dist-packages/sktime/forecasting/base/_base.py](https://localhost:8080/#) in _predict_quantiles(self, fh, X, alpha)
2077
2078 # compute quantile forecasts corresponding to upper/lower
-> 2079 pred_a = self._predict_interval(fh=fh, X=X, coverage=[coverage])
2080 pred_int = pd.concat([pred_int, pred_a], axis=1)
2081
[/usr/local/lib/python3.10/dist-packages/sktime/forecasting/base/adapters/_statsmodels.py](https://localhost:8080/#) in _predict_interval(self, fh, X, coverage)
189 valid_indices = fh.to_absolute(self.cutoff).to_pandas()
190
--> 191 prediction_results = self._fitted_forecaster.get_prediction(
192 start=start, end=end, exog=X
193 )
[/usr/local/lib/python3.10/dist-packages/statsmodels/tsa/exponential_smoothing/ets.py](https://localhost:8080/#) in get_prediction(self, start, end, dynamic, index, method, simulate_repetitions, **simulate_kwargs)
2100 """
2101 return PredictionResultsWrapper(
-> 2102 PredictionResults(
2103 self,
2104 start,
[/usr/local/lib/python3.10/dist-packages/statsmodels/tsa/exponential_smoothing/ets.py](https://localhost:8080/#) in __init__(self, results, start, end, dynamic, index, method, simulate_repetitions, **simulate_kwargs)
2296 if ndynamic:
2297 sim_results.append(
-> 2298 results.simulate(
2299 ndynamic,
2300 anchor=anchor_dynamic,
TypeError: ETSResults.simulate() got an unexpected keyword argument 'exog'
Expected behavior This worked in sktime 0.17.1 so the behavior should have continued in 0.17.2
Versions
/usr/local/lib/python3.10/dist-packages/_distutils_hack/init.py:33: UserWarning: Setuptools is replacing distutils. warnings.warn(“Setuptools is replacing distutils.”)
System: python: 3.10.11 (main, Apr 5 2023, 14:15:10) [GCC 9.4.0] executable: /usr/bin/python3 machine: Linux-5.15.107±x86_64-with-glibc2.31
Python dependencies: pip: 23.1.2 sktime: 0.17.2 sklearn: 1.2.2 numpy: 1.22.4 scipy: 1.10.1 pandas: 1.5.3 matplotlib: 3.7.1 joblib: 1.2.0 statsmodels: 0.13.5 numba: 0.56.4 pmdarima: None tsfresh: None tensorflow: 2.12.0 tensorflow_probability: 0.19.0
About this issue
- Original URL
- State: closed
- Created a year ago
- Comments: 25 (7 by maintainers)
Commits related to this issue
- [ENH] add more test parameter sets to `AutoETS` (#4588) This adds a second test parameter set to `AutoETS`. Towards https://github.com/sktime/sktime/issues/3429 Related: https://github.com/skti... — committed to sktime/sktime by fkiraly a year ago
- [BUG] in `_StatsModelsAdapter`, avoid passing `exog` to `get_prediction` of `statsmodels` in `_predict_interval` if parameter is not supported (#4589) Fixes #4587. Depends on #4588. Avoid passing... — committed to sktime/sktime by yarnabrina a year ago
Sorry for that, @ngupta23. There are actually two bugs (one likely in
statsmodels, one insktime), and one instance of missing test coverage, it’s more “hygienic” to keep them apart as we’ll be fixing them separately. Well, possibly with exception of thestatsmodelsissue, but at least we need to track it.Done, please check https://github.com/sktime/sktime/pull/4589/commits/ae69ee86c76f4885a9139d02118dc3c3a26d274e.
ah, that makes sense. Are you testing using #4588?