Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Training on test sample in CH05 ?? #6

Open
OdysseusU opened this issue Feb 17, 2023 · 1 comment
Open

Training on test sample in CH05 ?? #6

OdysseusU opened this issue Feb 17, 2023 · 1 comment

Comments

@OdysseusU
Copy link

In CH05, your method rolling_forecasting trains on test samples.

In this case :
the df corresponds to all the data (train AND test).
You are fitting SARIMAX to the train AND test samples.

            model = SARIMAX(df[:i], order=(2,0,0))
            res = model.fit(disp=False)
            predictions = res.get_prediction(0, i + window - 1)
            oos_pred = predictions.predicted_mean.iloc[-window:]
            pred_AR.extend(oos_pred)

In order to really do forecasting, your training should be based on train AND prediction sample.

            model = SARIMAX(df_train_estimated[:i], order=(2,0,0))
            res = model.fit(disp=False)
            predictions = res.get_prediction(0, i + window - 1)
            oos_pred = predictions.predicted_mean.iloc[-window:]
            pred_AR.extend(oos_pred)
            df_train_estimated.append({'value': oos_pred.values[0]}) #Adding the last prediction and use it as training
@dominicdill
Copy link

I have the same questions for chapter 4 and 3

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants