dfm / george

Fast and flexible Gaussian Process regression in Python
http://george.readthedocs.io
MIT License
445 stars 128 forks source link

White noise: Different value for different instruments modelled by the same kernel #165

Closed odemangeon closed 7 months ago

odemangeon commented 7 months ago

Hello,

I must not be the first one to have tried to do this, but I've looked at the doc and the existing issues and I could not find anything relating to this.

I have data coming from different instruments (of the same class, like high relative precision photometer) that I would like to fit with the same GP kernel. The thing is that I want to allow for a different jitter (white noise amplitude for each instrument). My understanding of the current "white_noise" argument of the GP class is that, if I provide it a float value, it will add the same value to the covariance matrix diagonal for all data points, when I would like to add different values for different instruments. To be honest, I have not tried to play with the Model class yet, but reading the doc, I think that I could define a Model that I would provide to "white_noise" that based on the time will provide different white noise values. However, the observations from my different instruments are overlapping in time which would make this solution too fastidious to implement. Meaning that the only solution that I can think of is to add my white noise components myself to the yerr data, but that means that when I fit within an mcmc I need to do compute(t, yerr) at every single iteration, when I have the impression that, if I was using "white_noise", I would not have to and the code would be faster. Am I correct about this last part ?

Is there some way to implement this multiple instrument through the "white_noise", that I have missed ?

Thanks in advance for your help.

dfm commented 7 months ago

There isn't any simple way to do this and my recommendation would be to update the yerr manually, adding the jitters in quadrature, as you've suggested. I don't actually expect that you would get any performance hit because even when you're fitting a WhiteNoise kernel it calls compute in the background automatically for each likelihood evaluation. Give it a shot!