mirror of
https://github.com/SheffieldML/GPy.git
synced 2026-05-12 13:32:39 +02:00
Need to explicitly turn a range object to a list in for these tests
This commit is contained in:
parent
40f5f4b865
commit
8d66b7b4f0
1 changed files with 5 additions and 5 deletions
|
|
@ -121,15 +121,15 @@ class ParameterizedTest(unittest.TestCase):
|
||||||
def test_default_constraints(self):
|
def test_default_constraints(self):
|
||||||
self.assertIs(self.rbf.variance.constraints._param_index_ops, self.rbf.constraints._param_index_ops)
|
self.assertIs(self.rbf.variance.constraints._param_index_ops, self.rbf.constraints._param_index_ops)
|
||||||
self.assertIs(self.test1.constraints, self.rbf.constraints._param_index_ops)
|
self.assertIs(self.test1.constraints, self.rbf.constraints._param_index_ops)
|
||||||
self.assertListEqual(self.rbf.constraints.indices()[0].tolist(), range(2))
|
self.assertListEqual(self.rbf.constraints.indices()[0].tolist(), list(range(2)))
|
||||||
from GPy.core.parameterization.transformations import Logexp
|
from GPy.core.parameterization.transformations import Logexp
|
||||||
kern = self.test1.kern
|
kern = self.test1.kern
|
||||||
self.test1.unlink_parameter(kern)
|
self.test1.unlink_parameter(kern)
|
||||||
self.assertListEqual(kern.constraints[Logexp()].tolist(), range(3))
|
self.assertListEqual(kern.constraints[Logexp()].tolist(), list(range(3)))
|
||||||
|
|
||||||
def test_constraints(self):
|
def test_constraints(self):
|
||||||
self.rbf.constrain(GPy.transformations.Square(), False)
|
self.rbf.constrain(GPy.transformations.Square(), False)
|
||||||
self.assertListEqual(self.test1.constraints[GPy.transformations.Square()].tolist(), range(self.param.size, self.param.size+self.rbf.size))
|
self.assertListEqual(self.test1.constraints[GPy.transformations.Square()].tolist(), list(range(self.param.size, self.param.size+self.rbf.size)))
|
||||||
self.assertListEqual(self.test1.constraints[GPy.transformations.Logexp()].tolist(), [self.param.size+self.rbf.size])
|
self.assertListEqual(self.test1.constraints[GPy.transformations.Logexp()].tolist(), [self.param.size+self.rbf.size])
|
||||||
|
|
||||||
self.test1.kern.unlink_parameter(self.rbf)
|
self.test1.kern.unlink_parameter(self.rbf)
|
||||||
|
|
@ -182,8 +182,8 @@ class ParameterizedTest(unittest.TestCase):
|
||||||
|
|
||||||
def test_add_parameter_in_hierarchy(self):
|
def test_add_parameter_in_hierarchy(self):
|
||||||
self.test1.kern.rbf.link_parameter(Param("NEW", np.random.rand(2), NegativeLogexp()), 1)
|
self.test1.kern.rbf.link_parameter(Param("NEW", np.random.rand(2), NegativeLogexp()), 1)
|
||||||
self.assertListEqual(self.test1.constraints[NegativeLogexp()].tolist(), range(self.param.size+1, self.param.size+1 + 2))
|
self.assertListEqual(self.test1.constraints[NegativeLogexp()].tolist(), list(range(self.param.size+1, self.param.size+1 + 2)))
|
||||||
self.assertListEqual(self.test1.constraints[GPy.transformations.Logistic(0,1)].tolist(), range(self.param.size))
|
self.assertListEqual(self.test1.constraints[GPy.transformations.Logistic(0,1)].tolist(), list(range(self.param.size)))
|
||||||
self.assertListEqual(self.test1.constraints[GPy.transformations.Logexp(0,1)].tolist(), np.r_[50, 53:55].tolist())
|
self.assertListEqual(self.test1.constraints[GPy.transformations.Logexp(0,1)].tolist(), np.r_[50, 53:55].tolist())
|
||||||
|
|
||||||
def test_regular_expression_misc(self):
|
def test_regular_expression_misc(self):
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue