-
Notifications
You must be signed in to change notification settings - Fork 11
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 support for variable coefficients in celerite models #34
Comments
And easy way to do this would be to simply compute the likelihood for the two data sets separately.
Eric Agol
Astronomy Professor
University of Washington
… On Sep 19, 2019, at 12:09 AM, John Livingston ***@***.***> wrote:
I'm interested in being able to model different subsets of the data with different kernels, i.e. K = K1 + K2, where K2 could have zeros everywhere except blocks corresponding to the target data subset. As you mentioned this isn't trivial with celerite, but could work in principle, i.e. by generalizing the kernel to be k(tau=|ti-tj|) = a_1(ti) * a_2(tj) * exp(-ctau) * cos(dtau) + b_1(ti) * b_2(tj) * exp(-ctau) * sin(dtau)
—
You are receiving this because you are subscribed to this thread.
Reply to this email directly, view it on GitHub, or mute the thread.
|
@ericagol: The catch here is actually that K1 will be dense (in the celerite sense), but then K2 will be block diagonal (with celerite kernels in each block). The idea here is that you might want to model in transit data using an extra kernel for spot crossings, etc. I think that this could be implemented using variable The same machinery will be needed by exoplanet-dev/exoplanet#51. |
Yes, I see! |
So - I worked out how to do this. Basically, if you want a kernel with the form:
you can just use:
and:
Which means that Here's a simple example in Python for a masked GP (ie. where the GP only acts at specific times). I'm still thinking about the best interface to actually combine this with the existing terms but I wanted to write this here so I didn't lose it. import numpy as np
import matplotlib.pyplot as plt
import exoplanet as xo
import pymc3 as pm
import theano.tensor as tt
class VariableKernel:
def __init__(self, *, a1, a2, b1, b2, c, d):
self.a1 = a1
self.a2 = a2
self.b1 = b1
self.b2 = b2
self.c = tt.as_tensor_variable(c)
self.d = tt.as_tensor_variable(d)
self.J = 4
def get_celerite_matrices(self, x, diag):
x = tt.as_tensor_variable(x)
diag = tt.as_tensor_variable(diag)
a1 = self.a1(x)
a2 = self.a2(x)
b1 = self.b1(x)
b2 = self.b2(x)
a = diag + a1 * a2
cos = tt.cos(self.d * x)
sin = tt.sin(self.d * x)
U = tt.stack([
a1 * sin,
a1 * cos,
-b1 * cos,
b1 * sin,
], axis=-1)
V = tt.stack([
a2 * sin,
a2 * cos,
b2 * sin,
b2 * cos,
], axis=-1)
dx = x[1:] - x[:-1]
p0 = tt.exp(-self.c * dx)
P = tt.stack([
p0,
p0,
p0,
p0,
], axis=-1)
return a, U, V, P
x = np.sort(np.random.uniform(0, 10, 500))
diag = 0.01 ** 2 * np.ones_like(x)
a = lambda x: 1.0 * (x < 5.0) * (2.0 < x)
b = lambda x: 1.0 * (x < 5.0) * (2.0 < x)
kernel = VariableKernel(a1=a, a2=a, b1=b, b2=b, c=0.3, d=0.1)
gp = xo.gp.GP(kernel, x, diag)
y = gp.dot_l(np.random.randn(len(x), 1))[:, 0].eval()
plt.plot(x, y) |
I'm interested in being able to model different subsets of the data with different kernels, i.e. K = K1 + K2, where K2 could have zeros everywhere except blocks corresponding to the target data subset. As you mentioned this isn't trivial with celerite, but could work in principle, i.e. by generalizing the kernel to be k(tau=|ti-tj|) = a_1(ti) * a_2(tj) * exp(-ctau) * cos(dtau) + b_1(ti) * b_2(tj) * exp(-ctau) * sin(dtau)
The text was updated successfully, but these errors were encountered: