nespinoza / juliet

A versatile modelling tool for transiting and non-transiting (single and multiple) exoplanetary systems
MIT License
53 stars 31 forks source link

Make GP lazier #18

Open JohannesBuchner opened 4 years ago

JohannesBuchner commented 4 years ago

If I have a gaussian process where all parameters are fixed, it seems that currently the GP is recomputed. How can I disable this unnecessary and costly recomputation? I want to keep sigma free though.

nespinoza commented 4 years ago

Hi @JohannesBuchner --- good call on this one. If the model is a global model (meaning, you are fitting for a common realization of a GP on different datasets), then this is the expected behavior in the case in which you want to keep sigma free (because you have to recompute the covariance matrix). If this is a different GP realization for each instrument, then this could be implemented, yes --- but it would take a little bit of work (it should be an if statement when we calculate the likelihood basically, where we would just evaluate --- and not re-compute --- the GP).

JohannesBuchner commented 4 years ago

Ok, for me it was the former. I was under the impression that in george one could modify the diagonal a bit faster with https://george.readthedocs.io/en/latest/user/gp/#george.GP.white_noise

nespinoza commented 4 years ago

Yeah, but I remember that only worked if you had only one sigma, whereas in the case of different instruments, you usually have a different sigma for each instrument. Because the global model in practice is one huge covariance matrix accounting for all the instruments, you have to add the corresponding sigma to the diagonal elements corresponding to the different instruments, and to my knowledge there is no easy way of doing that at least within George (I remember asking about this to Dan, and I think we concluded there was no easy way of doing this). There might be a smart way of creating that covariance matrix without computing the whole thing again, but haven't put much thought about it.

Does this make sense? Am I missing something?

JohannesBuchner commented 4 years ago

Hmm, ok. I only have one instrument.

nespinoza commented 4 years ago

Yeah, in that case, the white-noise George solution should work. I should then create an if-statement for one-RV-instrument cases where this lazy evaluation is performed.