Skip to content

Commit

Permalink
[BUG] fix STLForecaster tag ignores-exogenous-X to be correctly s…
Browse files Browse the repository at this point in the history
…et for composites (#5365)

Sets the `ignores-exogenous-X` tag of `STLForecaster` to `False` if and only if at least one of the used
forecaster has it as `False`, and `True` otherwise.
  • Loading branch information
yarnabrina committed Oct 7, 2023
1 parent 5df92d3 commit a1ad02c
Showing 1 changed file with 15 additions and 0 deletions.
15 changes: 15 additions & 0 deletions sktime/forecasting/trend/_stl_forecaster.py
Expand Up @@ -180,6 +180,21 @@ def __init__(
self.forecaster_resid = forecaster_resid
super().__init__()

for forecaster in (
self.forecaster_trend,
self.forecaster_seasonal,
self.forecaster_resid,
):
if forecaster is not None and not forecaster.get_tag(
"ignores-exogeneous-X"
):
ignore_exogenous = False
break
else: # none of the forecasters (if provided) use exogenous feature variables
ignore_exogenous = True # corresponding to NaiveForecaster in missing case

self.set_tags(**{"ignores-exogeneous-X": ignore_exogenous})

def _fit(self, y, X, fh):
"""Fit forecaster to training data.
Expand Down

0 comments on commit a1ad02c

Please sign in to comment.