Closed david26694 closed 1 year ago
Hi, thanks for the book, it's very good.
In this code snippet in here:
@curry def residuals(df, state, null, intervention_start, window, model): null_data = with_effect(df, state, null, intervention_start, window) model.fit(null_data.drop(columns=[state]), null_data[state]) y0_est = pd.Series(model.predict(null_data.drop(columns=[state])), index=null_data.index) residuals = null_data[state] - y0_est test_mask = (null_data.index >= intervention_start) & (null_data.index < (intervention_start + window)) return pd.DataFrame({ "y0": null_data[state], "y0_est": y0_est, "residuals": residuals, "post_intervention": test_mask })[lambda d: d.index < (intervention_start + window)] # just discard points after the defined effect window
I believe the model.fit should be called on training (pre-intervention) data, while it's being called on all data. Is this right?
model.fit
Hi, thanks for the book, it's very good.
In this code snippet in here:
I believe the
model.fit
should be called on training (pre-intervention) data, while it's being called on all data. Is this right?