dfm / tess-atlas

MIT License
9 stars 8 forks source link

GP overfitting data #183

Closed avivajpeyi closed 2 years ago

avivajpeyi commented 2 years ago

Overfit GP EGs

TOI 103:

iTerm2 Tb6Ky4 diagnostic_flux_vs_time iTerm2 2pGTTz diagnostic_trace_plot iTerm2 1Y52Xi phase_plot_1 iTerm2 CZPUaC data_ci_phase_plot_1 iTerm2 ByzqO0 folded_flux_vs_time

Notebook: toi_103.ipynb.zip

TOI 1006

iTerm2 eHPXR6 diagnostic_flux_vs_time

iTerm2 QCdxkZ diagnostic_trace_plot

iTerm2 dgZzMU planet_0_posteriors

Some others

iTerm2 9didNA diagnostic_flux_vs_time iTerm2 mJT4ef diagnostic_flux_vs_time iTerm2 otreUm diagnostic_flux_vs_time

iTerm2 PM89bc diagnostic_flux_vs_time iTerm2 NuWdUv diagnostic_flux_vs_time

Note: appears to be performing ok(?) in some cases

iTerm2 Y4do0m diagnostic_flux_vs_time

iTerm2 AlN7xg diagnostic_flux_vs_time

avivajpeyi commented 2 years ago

TOI 178:

diagnostic_flux_vs_time

phase_plot_2 phase_plot_3 phase_plot_4

phase_plot_1 diagnostic_trace_plot

avivajpeyi commented 2 years ago

There was a mistake in the model :expressionless:... a very silly mistake:

The original code

residual = y - lightcurve
gp = GaussianProcess(
    kernel, t=t, diag=yerr ** 2 + jitter_prior ** 2, mean=lightcurve
)
gp.marginal(name="obs", observed=y)

This makes the GP fit the raw relative flux data, and makes the GP mean->lc

Screen Shot 2022-02-18 at 5 51 45 pm

Here we see that the GP is fitting the transit, and the transit model does not fit all the transit data.

Modified model

residual = y - lightcurve
gp = GaussianProcess(
    kernel, t=t, diag=yerr ** 2 + jitter_prior ** 2.0
)
gp.marginal(name="obs", observed=residual)

Making the GP fit the residual and removing the mean-->lc, we get the following:

Screen Shot 2022-02-18 at 5 51 32 pm

This seems better -- Ill merge it in but should check in with Dan to see if it is correct.

dfm commented 2 years ago

That looks perfect! Good find.