예제 #1
0
 def test_bounded_normal_floor_ceil(self):
     """
     Test the bounded normal with floor and ceil.
     """
     standard = BoundedNormalDistribution(0, 1, floor=-1, ceil=1)
     for idx in xrange(100000):
         event = standard.next()
         self.assertGreaterEqual(event, -1)
         self.assertLessEqual(event, 1)
예제 #2
0
 def test_bounded_normal(self):
     """
     Perform same normal test with an unbounded, bounded normal.
     """
     standard = BoundedNormalDistribution(0, 1)
     for idx in xrange(100000):
         event = standard.next()
         self.assertGreater(event, -6)
         self.assertLess(event, 6)
예제 #3
0
 def test_bounded_normal_floor(self):
     """
     Test the bounded normal with only a floor.
     """
     standard = BoundedNormalDistribution(0, 1, floor=-1)
     for idx in xrange(100000):
         event = standard.next()
         self.assertGreaterEqual(event, -1)
         self.assertLess(event, 6)
예제 #4
0
 def test_bounded_normal_floor_ceil(self):
     """
     Test the bounded normal with floor and ceil.
     """
     standard = BoundedNormalDistribution(0, 1, floor=-1, ceil=1)
     for idx in xrange(100000):
         event = standard.next()
         self.assertGreaterEqual(event, -1)
         self.assertLessEqual(event, 1)
예제 #5
0
 def test_bounded_normal_floor(self):
     """
     Test the bounded normal with only a floor.
     """
     standard = BoundedNormalDistribution(0, 1, floor=-1)
     for idx in xrange(100000):
         event = standard.next()
         self.assertGreaterEqual(event, -1)
         self.assertLess(event, 6)
예제 #6
0
 def test_bounded_normal(self):
     """
     Perform same normal test with an unbounded, bounded normal.
     """
     standard = BoundedNormalDistribution(0, 1)
     for idx in xrange(100000):
         event = standard.next()
         self.assertGreater(event, -6)
         self.assertLess(event, 6)
예제 #7
0
    def test_bounded_normal_mean(self):
        """
        Perform same normal mean approximation with an unbounded, bounded normal.
        """
        dist    = BoundedNormalDistribution(0, 1)
        samples = 1000000
        total   = sum(dist.next() for idx in xrange(samples))
        mean    = total / samples

        self.assertAlmostEqual(mean, 0.0, places=2)
예제 #8
0
    def test_bounded_normal_mean(self):
        """
        Perform same normal mean approximation with an unbounded, bounded normal.
        """
        dist = BoundedNormalDistribution(0, 1)
        samples = 1000000
        total = sum(dist.next() for idx in xrange(samples))
        mean = total / samples

        self.assertAlmostEqual(mean, 0.0, places=2)