I'm trying to find the optimal variance and lengthscale of a 2D model using Gaussian Process (by using the GPy package in Python). I already found the code to do just that, you can see it below:
# sample inputs and outputs from 2d model
X2 = np.random.uniform(-3.,3.,(50,2))
Y2 = np.sin(X2[:,0:1]) * np.sin(X2[:,1:2]) + np.random.randn(50,1)*0.05
print(X2, Y2)
# define kernel, notice the number of input dimensions is now 2
ker = GPy.kern.RBF(input_dim=2, ARD=True)
# create simple GP model
m2 = GPy.models.GPRegression(X2,Y2,ker)
m2.optimize()
I tried to run the code using my own data (my data is also 2D, only larger than the data X2, Y2 in the code example) but there's an error: not positive definite, even with jitter
I also tried to add noise using m.gaussian.noise
but it still doesn't work
Does this mean the problem comes from the numbers in my data? Anyone know any solutions for this? Thanks in advance