Esempio n. 1
0
 def test_empirical_quantiles_vector(self):
     out = utilities.empirical_quantiles(np.linspace(10, 20,
                                                     num=10).reshape(10, 1),
                                         p=np.array([0.22, 0.57345]))
     exact = np.array([[12.2], [15.7345]])
     comp = np.linalg.norm(out - exact)
     self.assertAlmostEqual(comp, 0)
Esempio n. 2
0
 def test_does_non_default_empirical_quantiles_return_2_element_array(self):
     test_out = utilities.empirical_quantiles(np.random.rand(10, 1),
                                              p=np.array([0.2, 0.5]))
     self.assertEqual(test_out.shape, (2, 1),
                      msg='Non-default output shape should be (2,1)')
Esempio n. 3
0
 def test_empirical_quantiles_should_not_support_list_input(self):
     with self.assertRaises(AttributeError):
         utilities.empirical_quantiles([-1, 0, 1])
Esempio n. 4
0
 def test_does_default_empirical_quantiles_return_3_element_array(self):
     test_out = utilities.empirical_quantiles(np.random.rand(10, 1))
     self.assertEqual(test_out.shape, (3, 1),
                      msg='Default output shape is (3,1)')