Skip to content

Commit

Permalink
0.5.3 a4
Browse files Browse the repository at this point in the history
  • Loading branch information
winedarksea committed Dec 23, 2022
1 parent ba1d522 commit ad3ff5a
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 8 deletions.
13 changes: 6 additions & 7 deletions autots/models/cassandra.py
Original file line number Diff line number Diff line change
Expand Up @@ -1518,25 +1518,24 @@ def predict(
if (
self.past_impacts is not None
and forecast_length is not None
and future_impacts is not None
):
future_impts = pd.DataFrame(
np.repeat(
self.past_impacts.iloc[-1:].to_numpy(), forecast_length, axis=0
),
index=future_impacts.index,
columns=future_impacts.columns,
index=df_forecast.forecast.index[-forecast_length:],
columns=self.past_impacts.columns,
)
if future_impacts is not None:
future_impts = future_impts + future_impacts
else:
future_impts = pd.DataFrame()
if self.past_impacts is not None or future_impacts is not None:
impts = 1 + pd.concat([past_impacts, future_impts], axis=0).reindex(
df_forecast.forecast.index
).fillna(
1
) # minus or plus
index=df_forecast.forecast.index,
columns=df_forecast.forecast.columns,
fill_value=1,
) # minus or plus
self.impacts = impts
if include_organic:
df_forecast.organic_forecast = df_forecast.forecast.copy()
Expand Down
6 changes: 5 additions & 1 deletion autots/tools/anomaly_utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -672,7 +672,11 @@ def anomaly_df_to_holidays(
agg_dict['avg_anomaly_score'] = 'mean'

dates = stacked.index.get_level_values('date').unique()
year_range = dates.year.max() - dates.year.min() + 1
try:
year_range = dates.year.max() - dates.year.min() + 1
except Exception as e:
raise Exception(f"unrecognized dates: {dates}") from e

if year_range <= 1:
raise ValueError("more than 1 year of data is required for holiday detection.")

Expand Down

0 comments on commit ad3ff5a

Please sign in to comment.