Open fuku10 opened 2 years ago
It seems that (2) was solved by using copy.deepcopy().
I added import copy
and changed
best_params = {
"lengthscales" : model.kernel.lengthscales,
"k_variance" : model.kernel.variance,
"l_variance" : model.likelihood.variance}
to
best_params = {
"lengthscales" : copy.deepcopy(model.kernel.lengthscales),
"k_variance" : copy.deepcopy(model.kernel.variance),
"l_variance" : copy.deepcopy(model.likelihood.variance)}
Moreover, I changed
best_params["k_lengthscales"] = model.kernel.lengthscales
best_params["k_variance"] = model.kernel.variance
best_params["l_variance"] = model.likelihood.variance
to
best_params["lengthscales"] = copy.deepcopy(model.kernel.lengthscales)
best_params["k_variance"] = copy.deepcopy(model.kernel.variance)
best_params["l_variance"] = copy.deepcopy(model.likelihood.variance)
(Note that "k_lengthscales"
is also changed to "lengthscales"
.)
Hello, I found a strange behavior in model optimization of mgpr.py.
(1) Is
best_params["k_lengthscales"] = model.kernel.lengthscales
best_params["lengthscales"] = model.kernel.lengthscales
?(2) It seems that
best_params
is updated whenoptimizer.minimize(model.training_loss, model.trainable_variables)
is executed. It means that the values ofbest_params
always changes regardless of whetherif loss < best_loss
isTrue
orFalse
.My environment is; Python 3.7.12 tensorflow 2.9.1 gpflow 2.5.2 gym 0.18.0
Thanks,