示例#1
0
 def test_too_many_vars(self):
     P = JointNormal(
         mu=[0, 0],
         labels=['x', 'y'],
         cov=[
             [1, 0],
             [0, 1],
         ], N=10)
     with self.assertRaises(ValueError):
         P.percentile(x=.75, y=.2)
示例#2
0
 def test_correct_value(self):
     P = JointNormal(
         mu=[0, 0],
         labels=['x', 'y'],
         cov=[
             [1, 0],
             [0, 1],
         ], N=10)
     percentile_value = P.percentile(x=.75)
     self.assertAlmostEqual(P.probability(x__lt=percentile_value), .75, places=12)
示例#3
0
 def test_iterable(self):
     P = JointNormal(
         mu=[0, 0],
         labels=['x', 'y'],
         cov=[
             [1, 0],
             [0, 1],
         ], N=10)
     percentiles = [.25, .5, .75]
     values_at_percentiles = P.percentile(x=percentiles)
     new_percentiles = P.probability(x__lt=values_at_percentiles)
     self.assertAlmostEqual(new_percentiles[0], percentiles[0])
     self.assertAlmostEqual(new_percentiles[1], percentiles[1])
     self.assertAlmostEqual(new_percentiles[2], percentiles[2])