mirror of
https://github.com/SheffieldML/GPy.git
synced 2026-05-18 13:55:14 +02:00
Added binomial derivative and test
This commit is contained in:
parent
91bebc8161
commit
378ac0ad06
2 changed files with 44 additions and 14 deletions
|
|
@ -117,7 +117,10 @@ class TestNoiseModels(object):
|
|||
self.positive_Y = np.exp(self.Y.copy())
|
||||
tmp = np.round(self.X[:, 0]*3-3)[:, None] + np.random.randint(0,3, self.X.shape[0])[:, None]
|
||||
self.integer_Y = np.where(tmp > 0, tmp, 0)
|
||||
|
||||
self.ns = np.random.poisson(50, size=self.N)[:, None]
|
||||
p = np.abs(np.cos(2*np.pi*self.X + np.random.normal(scale=.2, size=(self.N, self.D)))).mean(1)
|
||||
self.binomial_Y = np.array([np.random.binomial(self.ns[i], p[i]) for i in range(p.shape[0])])[:, None]
|
||||
|
||||
self.var = 0.2
|
||||
self.deg_free = 4.0
|
||||
|
||||
|
|
@ -204,15 +207,6 @@ class TestNoiseModels(object):
|
|||
},
|
||||
"laplace": True
|
||||
},
|
||||
#"Student_t_log": {
|
||||
#"model": GPy.likelihoods.StudentT(gp_link=link_functions.Log(), deg_free=5, sigma2=self.var),
|
||||
#"grad_params": {
|
||||
#"names": [".*t_noise"],
|
||||
#"vals": [self.var],
|
||||
#"constraints": [(".*t_noise", self.constrain_positive), (".*deg_free", self.constrain_fixed)]
|
||||
#},
|
||||
#"laplace": True
|
||||
#},
|
||||
"Gaussian_default": {
|
||||
"model": GPy.likelihoods.Gaussian(variance=self.var),
|
||||
"grad_params": {
|
||||
|
|
@ -273,6 +267,13 @@ class TestNoiseModels(object):
|
|||
"laplace": True,
|
||||
"ep": False #Should work though...
|
||||
},
|
||||
"Binomial_default": {
|
||||
"model": GPy.likelihoods.Binomial(),
|
||||
"link_f_constraints": [partial(self.constrain_bounded, lower=0, upper=1)],
|
||||
"Y": self.binomial_Y,
|
||||
"Y_metadata": {'trials': self.ns},
|
||||
"laplace": True,
|
||||
},
|
||||
#,
|
||||
#GAMMA needs some work!"Gamma_default": {
|
||||
#"model": GPy.likelihoods.Gamma(),
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue