mirror of
https://github.com/SheffieldML/GPy.git
synced 2026-05-12 05:22:38 +02:00
finished mrd and added plotting functions
This commit is contained in:
parent
de6b00ebfd
commit
51ff92e591
7 changed files with 130 additions and 75 deletions
|
|
@ -10,23 +10,23 @@ import unittest
|
|||
import numpy as np
|
||||
import GPy
|
||||
|
||||
# class MRDTests(unittest.TestCase):
|
||||
#
|
||||
# # @unittest.skip('')
|
||||
# def test_gradients(self):
|
||||
# num_m = 2
|
||||
# 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)
|
||||
# Ylist = [np.random.multivariate_normal(np.zeros(N), K, D).T for _ in range(num_m)]
|
||||
#
|
||||
# m = GPy.models.MRD(*Ylist, Q=Q, kernel=k, M=M)
|
||||
# m._debug = True
|
||||
# m.ensure_default_constraints()
|
||||
# m.randomize()
|
||||
# self.assertTrue(m.checkgrad())
|
||||
#
|
||||
# if __name__ == "__main__":
|
||||
# print "Running unit tests, please be (very) patient..."
|
||||
# # unittest.main()
|
||||
class MRDTests(unittest.TestCase):
|
||||
|
||||
def test_gradients(self):
|
||||
num_m = 3
|
||||
N, M, Q, D = 20, 8, 5, 50
|
||||
X = np.random.rand(N, Q)
|
||||
|
||||
k = GPy.kern.linear(Q) + GPy.kern.bias(Q) + GPy.kern.white(Q)
|
||||
K = k.K(X)
|
||||
Ylist = [np.random.multivariate_normal(np.zeros(N), K, D).T for _ in range(num_m)]
|
||||
|
||||
m = GPy.models.MRD(*Ylist, Q=Q, kernel=k, M=M)
|
||||
m.ensure_default_constraints()
|
||||
m.randomize()
|
||||
|
||||
self.assertTrue(m.checkgrad())
|
||||
|
||||
if __name__ == "__main__":
|
||||
print "Running unit tests, please be (very) patient..."
|
||||
unittest.main()
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue