Reputation: 3
I have been following this tutorial: https://www.analyticsvidhya.com/blog/2021/11/basic-understanding-of-time-series-modelling-with-auto-arimax/
I was fitting it on my dataset. It was working fine but when I ran it again the next day model.predict function started returning series rather than a list. And it is not giving proper results like it did previously.
model = pm.auto_arima(df_train["farm rate"], exogenous=df_train[exogenous_features], trace=True, error_action="ignore", suppress_warnings=True)
model.fit(df_train["farm rate"], exogenous=df_train[exogenous_features])
forecast = model.predict(n_periods=len(df_valid), exogenous=df_valid[exogenous_features])
df_valid["Forecast_ARIMAX"] = forecast
My df looks like this
date day doc farm rate open close price month year day_of_week week doc_mean_3 open_mean_3 close_mean_3 price_mean_3
date
2015-01-01 2015-01-01 1.0 51.5 165.0 170.0 170.0 2375.0 1.0 2015.0 3.0 1.0 38.574580 155.158973 150.355472 3418.872350
2015-01-02 2015-01-02 2.0 48.5 165.0 170.0 160.0 2375.0 1.0 2015.0 4.0 1.0 38.574580 155.158973 150.355472 3418.872350
2015-01-03 2015-01-03 3.0 44.5 150.0 180.0 167.5 2375.0 1.0 2015.0 5.0 1.0 48.166667 173.333333 165.833333 2375.000000
2015-01-05 2015-01-05 5.0 40.5 150.0 165.0 155.0 2375.0 1.0 2015.0 0.0 2.0 44.500000 171.666667 160.833333 2375.000000
2015-01-06 2015-01-06 6.0 36.5 140.0 155.0 152.5 2375.0 1.0 2015.0 1.0 2.0 40.500000 166.666667 158.333333 2375.000000
2015-01-07 2015-01-07 7.0 35.5 140.0 155.0 150.0 2375.0 1.0 2015.0 2.0 2.0 37.500000 158.333333 152.500000 2375.000000
2015-01-08 2015-01-08 8.0 35.5 140.0 162.5 155.0 2375.0 1.0 2015.0 3.0 2.0 35.833333 157.500000 152.500000 2375.000000
2015-01-09 2015-01-09 9.0 37.5 145.0 165.0 157.5 2375.0 1.0 2015.0 4.0 2.0 36.166667 160.833333
I have data from 2015 to 2022.Exogenous features are : ["doc", "open","close","doc_mean_3", "open_mean_3", "close_mean_3", "price_mean_3"] They are calculated using this method:
def calc_lag_features(df, feature, window):
df[f"{feature}_mean_{window}"] = df[feature].rolling(window=window).mean()
return df
Edit: These are the results I get. Completely flat graph. Adding or removing exogenous variables isnt making any difference. Previously, it was able to capture the true graph to quite an extent. OUTPUT
Depending on exogenous variables straight line only goes up and down and is not able to capture the true trend.
Upvotes: 0
Views: 170