Closed ssydasheng closed 6 years ago
You are creating two different initializations, try to set the same initializations:
import GPy
import numpy as np
x = np.random.normal(size=[20, 10])
y = np.random.normal(size=[20, 1]) * 0.1
kern = GPy.kern.RBF(10)
model = GPy.models.GPRegression(x, y, kern)
model['Gaussian_noise.variance'].constrain_bounded(1e-5,1)
model.Gaussian_noise.variance = .5
model.optimize()
print(model['Gaussian_noise.variance'])
kern = GPy.kern.RBF(10)
model = GPy.models.GPRegression(x, y, kern, noise_var=0.5)
model['Gaussian_noise.variance'].constrain_bounded(1e-5,1)
model.optimize()
print(model['Gaussian_noise.variance'])
The first prints
1
, the second prints0.00721777
. It seems when the initialization is one of the bounds, it cannot be updated anymore.