mirror of
https://github.com/SheffieldML/GPy.git
synced 2026-05-10 20:42:39 +02:00
[setxy] was bugged
This commit is contained in:
parent
22d7e20429
commit
375f3e0d6c
2 changed files with 8 additions and 6 deletions
|
|
@ -148,14 +148,16 @@ class GP(Model):
|
|||
# LVM models
|
||||
if isinstance(self.X, VariationalPosterior):
|
||||
assert isinstance(X, type(self.X)), "The given X must have the same type as the X in the model!"
|
||||
index = self.X._parent_index_
|
||||
self.unlink_parameter(self.X)
|
||||
self.X = X
|
||||
self.link_parameter(self.X)
|
||||
self.link_parameter(self.X, index=index)
|
||||
else:
|
||||
index = self.X._parent_index_
|
||||
self.unlink_parameter(self.X)
|
||||
from ..core import Param
|
||||
self.X = Param('latent mean',X)
|
||||
self.link_parameter(self.X)
|
||||
self.X = Param('latent mean', X)
|
||||
self.link_parameter(self.X, index=index)
|
||||
else:
|
||||
self.X = ObsAr(X)
|
||||
self.update_model(True)
|
||||
|
|
|
|||
|
|
@ -24,9 +24,9 @@ class Test(unittest.TestCase):
|
|||
k = GPy.kern.RBF(1)
|
||||
m = GPy.models.BayesianGPLVM(self.Y, 1, kernel=k)
|
||||
mu, var = m.predict(m.X)
|
||||
X = m.X.copy()
|
||||
X = m.X
|
||||
Xnew = NormalPosterior(m.X.mean[:10].copy(), m.X.variance[:10].copy())
|
||||
m.set_XY(Xnew, m.Y[:10])
|
||||
m.set_XY(Xnew, m.Y[:10].copy())
|
||||
assert(m.checkgrad())
|
||||
m.set_XY(X, self.Y)
|
||||
mu2, var2 = m.predict(m.X)
|
||||
|
|
@ -40,7 +40,7 @@ class Test(unittest.TestCase):
|
|||
mu, var = m.predict(m.X)
|
||||
X = m.X.copy()
|
||||
Xnew = X[:10].copy()
|
||||
m.set_XY(Xnew, m.Y[:10])
|
||||
m.set_XY(Xnew, m.Y[:10].copy())
|
||||
assert(m.checkgrad())
|
||||
m.set_XY(X, self.Y)
|
||||
mu2, var2 = m.predict(m.X)
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue