mirror of
https://github.com/SheffieldML/GPy.git
synced 2026-05-30 14:35:15 +02:00
Modified likelihoods test to better test multioutput likelihood
This commit is contained in:
parent
292e69ee0d
commit
8e69db51a2
1 changed files with 13 additions and 4 deletions
|
|
@ -129,6 +129,15 @@ class TestNoiseModels(object):
|
||||||
self.Y_metadata = dict()
|
self.Y_metadata = dict()
|
||||||
self.Y_metadata['censored'] = censored
|
self.Y_metadata['censored'] = censored
|
||||||
self.Y_metadata['output_index'] = np.zeros((self.N,1), dtype=int)
|
self.Y_metadata['output_index'] = np.zeros((self.N,1), dtype=int)
|
||||||
|
self.Y_metadata2 = dict()
|
||||||
|
self.Y_metadata2['censored'] = censored
|
||||||
|
inds = np.zeros((self.N,1), dtype=int)
|
||||||
|
inds[5:10] = 1
|
||||||
|
inds[10:] = 2
|
||||||
|
self.Y_metadata2['output_index'] = inds
|
||||||
|
self.combY = self.Y
|
||||||
|
self.combY[10:] = np.where(self.binary_Y[10:] >0, self.binary_Y[10:], 0)
|
||||||
|
print(self.combY)
|
||||||
#Make a bigger step as lower bound can be quite curved
|
#Make a bigger step as lower bound can be quite curved
|
||||||
self.step = 1e-4
|
self.step = 1e-4
|
||||||
|
|
||||||
|
|
@ -294,11 +303,11 @@ class TestNoiseModels(object):
|
||||||
"laplace": True
|
"laplace": True
|
||||||
},
|
},
|
||||||
"multioutput_default": {
|
"multioutput_default": {
|
||||||
"model": GPy.likelihoods.MultioutputLikelihood([GPy.likelihoods.Bernoulli()]),
|
"model": GPy.likelihoods.MultioutputLikelihood([GPy.likelihoods.Gaussian(), GPy.likelihoods.Poisson(), GPy.likelihoods.Bernoulli()]),
|
||||||
"link_f_constraints": [partial(self.constrain_bounded, lower=0, upper=1)],
|
"link_f_constraints": [partial(self.constrain_bounded, lower=0, upper=1)],
|
||||||
"laplace": True,
|
"laplace": True,
|
||||||
"Y": self.binary_Y,
|
"Y": self.combY,
|
||||||
"Y_metadata": self.Y_metadata,
|
"Y_metadata": self.Y_metadata2,
|
||||||
"ep": True,
|
"ep": True,
|
||||||
"variational_expectations": True,
|
"variational_expectations": True,
|
||||||
}
|
}
|
||||||
|
|
@ -627,7 +636,7 @@ class TestNoiseModels(object):
|
||||||
# Y = Y/Y.max()
|
# Y = Y/Y.max()
|
||||||
white_var = 1e-4
|
white_var = 1e-4
|
||||||
kernel = GPy.kern.RBF(X.shape[1]) + GPy.kern.White(X.shape[1])
|
kernel = GPy.kern.RBF(X.shape[1]) + GPy.kern.White(X.shape[1])
|
||||||
ep_inf = GPy.inference.latent_function_inference.EP()
|
ep_inf = GPy.inference.latent_function_inference.EP(always_reset=True)
|
||||||
|
|
||||||
m = GPy.core.GP(X.copy(), Y.copy(), kernel=kernel, likelihood=model, Y_metadata=Y_metadata, inference_method=ep_inf)
|
m = GPy.core.GP(X.copy(), Y.copy(), kernel=kernel, likelihood=model, Y_metadata=Y_metadata, inference_method=ep_inf)
|
||||||
m['.*white'].constrain_fixed(white_var)
|
m['.*white'].constrain_fixed(white_var)
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue