Exemplo n.º 1
0
 def test_goodness_of_fit(self):
     mx = 5
     trial = 300
     vals = self.generate_many(mx, None, _count=trial)
     vals = [val.get() for val in vals]
     counts = numpy.histogram(vals, bins=numpy.arange(mx + 2))[0]
     expected = numpy.array([float(trial) / (mx + 1)] * (mx + 1))
     assert _hypothesis.chi_square_test(counts, expected)
Exemplo n.º 2
0
 def test_goodness_of_fit_2(self):
     mx = 5
     vals = random.randint(0, mx, (5, 20)).get()
     counts = numpy.histogram(vals, bins=numpy.arange(mx + 1))[0]
     expected = numpy.array([float(vals.size) / mx] * mx)
     assert _hypothesis.chi_square_test(counts, expected)
Exemplo n.º 3
0
 def test_goodness_of_fit_2(self):
     mx = 5
     vals = self.generate(mx, (5, 5)).get()
     counts = numpy.histogram(vals, bins=numpy.arange(mx + 2))[0]
     expected = numpy.array([float(vals.size) / (mx + 1)] * (mx + 1))
     assert _hypothesis.chi_square_test(counts, expected)
Exemplo n.º 4
0
 def test_goodness_of_fit_2(self):
     vals = self.generate(3, (5, 20), True, [0.3, 0.3, 0.4]).get()
     counts = numpy.histogram(vals, bins=numpy.arange(4))[0]
     expected = numpy.array([30, 30, 40])
     assert _hypothesis.chi_square_test(counts, expected)