mirror of
https://github.com/SheffieldML/GPy.git
synced 2026-05-11 04:52:37 +02:00
working on psi cross terms
This commit is contained in:
parent
84119a19b3
commit
05ca5cfe6d
3 changed files with 30 additions and 6 deletions
|
|
@ -444,9 +444,9 @@ class kern(parameterised):
|
||||||
pass
|
pass
|
||||||
#rbf X bias
|
#rbf X bias
|
||||||
elif p1.name=='bias' and p2.name=='rbf':
|
elif p1.name=='bias' and p2.name=='rbf':
|
||||||
target += p2.dpsi1_dX(dL_dpsi2.sum(1)*p1.variance,Z,mu,S,target)
|
p2.dpsi1_dX(dL_dpsi2.sum(1)*p1.variance,Z,mu,S,target)
|
||||||
elif p2.name=='bias' and p1.name=='rbf':
|
elif p2.name=='bias' and p1.name=='rbf':
|
||||||
target += p1.dpsi1_dZ(dL_dpsi2.sum(2)*p2.variance,Z,mu,S,target)
|
p1.dpsi1_dZ(dL_dpsi2.sum(2)*p2.variance,Z,mu,S,target)
|
||||||
#rbf X linear
|
#rbf X linear
|
||||||
elif p1.name=='linear' and p2.name=='rbf':
|
elif p1.name=='linear' and p2.name=='rbf':
|
||||||
raise NotImplementedError #TODO
|
raise NotImplementedError #TODO
|
||||||
|
|
@ -471,9 +471,9 @@ class kern(parameterised):
|
||||||
pass
|
pass
|
||||||
#rbf X bias
|
#rbf X bias
|
||||||
elif p1.name=='bias' and p2.name=='rbf':
|
elif p1.name=='bias' and p2.name=='rbf':
|
||||||
target += p2.dpsi1_dmuS(partial.sum(1)*p1.variance,Z,mu,S,target_mu,target_S)
|
p2.dpsi1_dmuS(partial.sum(1)*p1.variance,Z,mu,S,target_mu,target_S)
|
||||||
elif p2.name=='bias' and p1.name=='rbf':
|
elif p2.name=='bias' and p1.name=='rbf':
|
||||||
target += p1.dpsi1_dmuS(partial.sum(2)*p2.variance,Z,mu,S,target_mu,target_S)
|
p1.dpsi1_dmuS(partial.sum(2)*p2.variance,Z,mu,S,target_mu,target_S)
|
||||||
#rbf X linear
|
#rbf X linear
|
||||||
elif p1.name=='linear' and p2.name=='rbf':
|
elif p1.name=='linear' and p2.name=='rbf':
|
||||||
raise NotImplementedError #TODO
|
raise NotImplementedError #TODO
|
||||||
|
|
|
||||||
|
|
@ -45,6 +45,32 @@ class BGPLVMTests(unittest.TestCase):
|
||||||
m.randomize()
|
m.randomize()
|
||||||
self.assertTrue(m.checkgrad())
|
self.assertTrue(m.checkgrad())
|
||||||
|
|
||||||
|
def test_rbf_bias_kern(self):
|
||||||
|
N, M, Q, D = 10, 3, 2, 4
|
||||||
|
X = np.random.rand(N, Q)
|
||||||
|
k = GPy.kern.rbf(Q) + GPy.kern.bias(Q) + GPy.kern.white(Q, 0.00001)
|
||||||
|
K = k.K(X)
|
||||||
|
Y = np.random.multivariate_normal(np.zeros(N),K,D).T
|
||||||
|
Y -= Y.mean(axis=0)
|
||||||
|
k = GPy.kern.rbf(Q) + GPy.kern.bias(Q) + GPy.kern.white(Q, 0.00001)
|
||||||
|
m = GPy.models.Bayesian_GPLVM(Y, Q, kernel = k, M=M)
|
||||||
|
m.constrain_positive('(rbf|bias|noise|white|S)')
|
||||||
|
m.randomize()
|
||||||
|
self.assertTrue(m.checkgrad())
|
||||||
|
|
||||||
|
def test_linear_bias_kern(self):
|
||||||
|
N, M, Q, D = 10, 3, 2, 4
|
||||||
|
X = np.random.rand(N, Q)
|
||||||
|
k = GPy.kern.linear(Q) + GPy.kern.bias(Q) + GPy.kern.white(Q, 0.00001)
|
||||||
|
K = k.K(X)
|
||||||
|
Y = np.random.multivariate_normal(np.zeros(N),K,D).T
|
||||||
|
Y -= Y.mean(axis=0)
|
||||||
|
k = GPy.kern.linear(Q) + GPy.kern.bias(Q) + GPy.kern.white(Q, 0.00001)
|
||||||
|
m = GPy.models.Bayesian_GPLVM(Y, Q, kernel = k, M=M)
|
||||||
|
m.constrain_positive('(linear|bias|noise|white|S)')
|
||||||
|
m.randomize()
|
||||||
|
self.assertTrue(m.checkgrad())
|
||||||
|
|
||||||
|
|
||||||
if __name__ == "__main__":
|
if __name__ == "__main__":
|
||||||
print "Running unit tests, please be (very) patient..."
|
print "Running unit tests, please be (very) patient..."
|
||||||
|
|
|
||||||
2
setup.py
2
setup.py
|
|
@ -32,7 +32,5 @@ setup(name = 'GPy',
|
||||||
#setup_requires=['sphinx'],
|
#setup_requires=['sphinx'],
|
||||||
#cmdclass = {'build_sphinx': BuildDoc},
|
#cmdclass = {'build_sphinx': BuildDoc},
|
||||||
classifiers=[
|
classifiers=[
|
||||||
"Development Status :: 1 - Alpha",
|
|
||||||
"Topic :: Machine Learning",
|
|
||||||
"License :: OSI Approved :: BSD License"],
|
"License :: OSI Approved :: BSD License"],
|
||||||
)
|
)
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue