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

Add residuals checks #135

Open
capelastegui opened this issue May 8, 2019 · 1 comment
Open

Add residuals checks #135

capelastegui opened this issue May 8, 2019 · 1 comment
Labels
enhancement New feature or request

Comments

@capelastegui
Copy link
Contributor

Our prediction intervals sometimes have a trend, suggesting that the residuals for that model have a non-zero null. This points to a sub-optimal fit - we should check for it and fix it.

@capelastegui
Copy link
Contributor Author

A first step would be to generate a residuals dataframe including all sources and models. Could would be based on the following:

l_cols = ['date', 'source']

df_actuals_unfiltered = df_forecast.loc[df_forecast.is_actuals &
                                        ~df_forecast.y.isnull()]
df_actuals = (df_actuals_unfiltered[['date', 'y']]
              .rename({'y': 'actuals'}, axis=1)
              )
# Compute residuals for filtered actuals
df_residuals_tmp = df_forecast.loc[
    ~df_forecast.is_actuals & ~df_forecast.y.pipe(
        pd.isnull)][l_cols + ['model', 'y']]
df_residuals = df_residuals_tmp.merge(df_actuals, how='inner')
df_residuals['res'] = df_residuals['actuals'] - df_residuals['y']

@capelastegui capelastegui added the enhancement New feature or request label Dec 12, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

1 participant