Fixed deg free gradient

This commit is contained in:
Alan Saul 2015-04-28 10:51:13 +01:00
parent 75ebe4bf10
commit 1acbcd2593
2 changed files with 29 additions and 29 deletions

View file

@ -93,6 +93,9 @@ def dparam_checkgrad(func, dfunc, params, params_names, args, constraints=None,
if not grad.checkgrad(verbose=True):
gradchecking = False
if not grad.checkgrad(verbose=True):
gradchecking = False
return gradchecking
@ -116,6 +119,7 @@ class TestNoiseModels(object):
self.integer_Y = np.where(tmp > 0, tmp, 0)
self.var = 0.2
self.deg_free = 4.0
#Make a bigger step as lower bound can be quite curved
self.step = 1e-4
@ -135,56 +139,56 @@ class TestNoiseModels(object):
}
"""
self.noise_models = {"Student_t_default": {
"model": GPy.likelihoods.StudentT(deg_free=5, sigma2=self.var),
"model": GPy.likelihoods.StudentT(deg_free=self.deg_free, sigma2=self.var),
"grad_params": {
"names": [".*t_scale2"],
"vals": [self.var],
"constraints": [(".*t_scale2", self.constrain_positive), (".*deg_free", self.constrain_fixed)]
"names": [".*t_scale2", ".*deg_free"],
"vals": [self.var, self.deg_free],
"constraints": [(".*t_scale2", self.constrain_positive), (".*deg_free", self.constrain_positive)]
},
"laplace": True
},
"Student_t_1_var": {
"model": GPy.likelihoods.StudentT(deg_free=5, sigma2=self.var),
"model": GPy.likelihoods.StudentT(deg_free=self.deg_free, sigma2=self.var),
"grad_params": {
"names": [".*t_scale2"],
"vals": [1.0],
"constraints": [(".*t_scale2", self.constrain_positive), (".*deg_free", self.constrain_fixed)]
"names": [".*t_scale2", ".*deg_free"],
"vals": [1.0, 8.0],
"constraints": [(".*t_scale2", self.constrain_positive), (".*deg_free", self.constrain_positive)]
},
"laplace": True
},
"Student_t_small_deg_free": {
"model": GPy.likelihoods.StudentT(deg_free=1.5, sigma2=self.var),
"grad_params": {
"names": [".*t_scale2"],
"vals": [self.var],
"constraints": [(".*t_scale2", self.constrain_positive), (".*deg_free", self.constrain_fixed)]
"names": [".*t_scale2", ".*deg_free"],
"vals": [self.var, 1.5],
"constraints": [(".*t_scale2", self.constrain_positive), (".*deg_free", self.constrain_positive)]
},
"laplace": True
},
"Student_t_small_var": {
"model": GPy.likelihoods.StudentT(deg_free=5, sigma2=self.var),
"model": GPy.likelihoods.StudentT(deg_free=self.deg_free, sigma2=self.var),
"grad_params": {
"names": [".*t_scale2"],
"vals": [0.001],
"constraints": [(".*t_scale2", self.constrain_positive), (".*deg_free", self.constrain_fixed)]
"names": [".*t_scale2", ".*deg_free"],
"vals": [0.001, self.deg_free],
"constraints": [(".*t_scale2", self.constrain_positive), (".*deg_free", self.constrain_positive)]
},
"laplace": True
},
"Student_t_large_var": {
"model": GPy.likelihoods.StudentT(deg_free=5, sigma2=self.var),
"model": GPy.likelihoods.StudentT(deg_free=self.deg_free, sigma2=self.var),
"grad_params": {
"names": [".*t_scale2"],
"vals": [10.0],
"constraints": [(".*t_scale2", self.constrain_positive), (".*deg_free", self.constrain_fixed)]
"names": [".*t_scale2", ".*deg_free"],
"vals": [10.0, self.deg_free],
"constraints": [(".*t_scale2", self.constrain_positive), (".*deg_free", self.constrain_positive)]
},
"laplace": True
},
"Student_t_approx_gauss": {
"model": GPy.likelihoods.StudentT(deg_free=1000, sigma2=self.var),
"grad_params": {
"names": [".*t_scale2"],
"vals": [self.var],
"constraints": [(".*t_scale2", self.constrain_positive), (".*deg_free", self.constrain_fixed)]
"names": [".*t_scale2", ".*deg_free"],
"vals": [self.var, 1000],
"constraints": [(".*t_scale2", self.constrain_positive), (".*deg_free", self.constrain_positive)]
},
"laplace": True
},