Skip to content

Serious issue in Python for Finance 5.ipynb #1

@alexmera88

Description

@alexmera88

Hi Derek,
first of all, let me say I appreciate your work a lot, your Youtube tutorials are really helping me.

After watching your video "Stock Market Prediction: Python for Finance 5", I've been working with the code, and I think I found a serious problem. In section Regression Time Series Example with AutoReg, the regression model is initialized as

train_model = AutoReg(a_df['Adj Close'], 500).fit(cov_type="HC0")

The problem is that it uses a_df to train the model, the whole dataset instead of just train_df, the training dataset. This is a serious problem because this way we are also using test data to train the model, this is "cheating"!

I tried fixing this with train_model = AutoReg(train_df['Adj Close'], 500).fit(cov_type="HC0"), and played with the lag parameter, but the correctly trained model is a really bad predictor for test_df.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions