def test_get_array(self): p = CombinationHyperparameters([ CovariateHyperparameters(23.6), LocalHyperparameters(log_sigma=0.1, log_rho=1.2) ]) numpy.testing.assert_equal([23.6, 0.1, 1.2], p.get_array())
def test_set_array(self): p = CombinationHyperparameters([ CovariateHyperparameters(23.6), LocalHyperparameters(log_sigma=0.1, log_rho=1.2), CovariateHyperparameters(24.7) ]) p.set_array(numpy.array([1.4, 1.5, 1.6, 1.7])) self.assertEqual(3, len(p.elementparameters)) self.assertEqual(1.4, p.elementparameters[0].value) self.assertEqual(1.5, p.elementparameters[1].log_sigma) self.assertEqual(1.6, p.elementparameters[1].log_rho) self.assertEqual(1.7, p.elementparameters[2].value) numpy.testing.assert_equal([1.4, 1.5, 1.6, 1.7], p.get_array())