Skip to content

Commit 4422ce8

Browse files
authored
Historical fitted values for the AutoTS model (#518)
2 parents aecf4d6 + fd2875c commit 4422ce8

File tree

1 file changed

+5
-0
lines changed
  • ads/opctl/operator/lowcode/forecast/model

1 file changed

+5
-0
lines changed

ads/opctl/operator/lowcode/forecast/model/autots.py

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -176,6 +176,7 @@ def _build_model(self) -> pd.DataFrame:
176176
output_col = pd.DataFrame()
177177
yhat_upper_name = ForecastOutputColumns.UPPER_BOUND
178178
yhat_lower_name = ForecastOutputColumns.LOWER_BOUND
179+
hist_df = model.back_forecast().forecast
179180

180181
for cat in self.categories:
181182
output_i = pd.DataFrame()
@@ -194,6 +195,10 @@ def _build_model(self) -> pd.DataFrame:
194195
output_i["forecast_value"] = self.prediction.forecast[[cat_target]]
195196
output_i[yhat_upper_name] = self.prediction.upper_forecast[[cat_target]]
196197
output_i[yhat_lower_name] = self.prediction.lower_forecast[[cat_target]]
198+
output_i.iloc[
199+
-hist_df.shape[0] - self.spec.horizon : -self.spec.horizon,
200+
output_i.columns.get_loc(f"fitted_value"),
201+
] = hist_df[cat_target]
197202

198203
output_i = output_i.reset_index()
199204
output_col = pd.concat([output_col, output_i])

0 commit comments

Comments
 (0)