-
Notifications
You must be signed in to change notification settings - Fork 435
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
Potential bug in SGPR with changepoint kernel #2097
Comments
Thanks for raising an issue! Could you please include more of your example (in particular, what are |
Thank you for your reply and the information! Here is the additional information you requested please let me know if you need anything else. X, Y and the kernels used did not seem to cause the issue as I could run the same model with a different kernels and inputs without issue. This minimal example replicates the error for me: import numpy as np
import gpflow
X = np.array(
[
[0.865], [0.666], [0.804], [0.771], [0.147], [0.866], [0.007], [0.026],
[0.171], [0.889], [0.243], [0.028],
]
)
Y = np.array(
[
[1.57], [3.48], [3.12], [3.91], [3.07], [1.35], [3.80], [3.82], [3.49],
[1.30], [4.00], [3.82],
]
)
inducing_points = np.array([[0.125], [0.375], [0.625], [0.875]])
kernel1 = gpflow.kernels.SquaredExponential()
kernel2 = gpflow.kernels.SquaredExponential()
model = gpflow.models.SGPR(
(X, Y),
kernel=gpflow.kernels.ChangePoints(
kernels=[
kernel1,
kernel2,
],
locations=[0.5],
steepness=0.1,
),
inducing_variable=inducing_points,
)
opt = gpflow.optimizers.Scipy()
opt.minimize(model.training_loss, model.trainable_variables) Specifically the final error reads: |
Thanks. That code example actually runs fine for me without giving any errors! Could you please include which versions of gpflow, tensorflow and python you're using? (You can get these by running |
Huh, strange. Python: 3.9.13, |
Thanks! It seems to work with tensorflow 2.12 but not with 2.15. I will investigate (and ensure our tests are also run against 2.15). |
Thank you very much mine works too now! |
Im trying to create a sparse model with changepoint kernel. The general setup I use works fine when using regular kernels:
model = gpflow.models.SGPR(
(X, Y),
kernel=kernel1,
inducing_variable=X[::100],
)
This works as expected.
When I set it up as follows I get errors:
model = gpflow.models.SGPR(
(X, Y),
kernel=gpflow.kernels.ChangePoints(
kernels=[
kernel1,
kernel2,
],
locations=[x_0],
steepness=0.01,
),
inducing_variable=X[::100],
)
Specifically:
ValueError: Dimension 1 in both shapes must be equal, but are 1000 and 10. Shapes are [10,10] and [10,100]. for '{{node concat_2}} = ConcatV2[N=2, T=DT_DOUBLE, Tidx=DT_INT32](ones_1, mul_7, concat_2/axis)' with input shapes: [10,10,1], [10,1000,0], [] and with computed input tensors: input[2] = <2>.
As far as I can tell this is a bug but I am fairly new to GPflow so I might be wrong about that. After looking around I did find this previous issue with the changepoint kernel which seemed similar. #1440
The text was updated successfully, but these errors were encountered: