def test_goodness_of_fit(self): trial = 100 vals = [self.rs.choice(3, 1, True, [0.3, 0.3, 0.4]).get() for _ in six.moves.xrange(trial)] counts = numpy.histogram(vals, bins=numpy.arange(4))[0] expected = numpy.array([30, 30, 40]) self.assertTrue(hypothesis.chi_square_test(counts, expected))
def test_goodness_of_fit(self): trial = 100 vals = self.generate_many(3, 1, True, [0.3, 0.3, 0.4], _count=trial) vals = [val.get() for val in vals] counts = numpy.histogram(vals, bins=numpy.arange(4))[0] expected = numpy.array([30, 30, 40]) assert hypothesis.chi_square_test(counts, expected)
def test_goodness_of_fit(self): mx = 5 trial = 100 vals = [random.randint(mx).get() for _ in six.moves.xrange(trial)] counts = numpy.histogram(vals, bins=numpy.arange(mx + 1))[0] expected = numpy.array([float(trial) / mx] * mx) self.assertTrue(hypothesis.chi_square_test(counts, expected))
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)
def test_goodness_of_fit(self): mx = 5 trial = 100 vals = [self.rs.interval(mx, None).get() for _ in six.moves.xrange(trial)] counts = numpy.histogram(vals, bins=numpy.arange(mx + 2))[0] expected = numpy.array([float(trial) / (mx + 1)] * (mx + 1)) self.assertTrue(hypothesis.chi_square_test(counts, expected))
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)
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)
def test_goodness_of_fit_2(self): mx = 5 vals = self.rs.interval(mx, (5, 5)).get() counts = numpy.histogram(vals, bins=numpy.arange(mx + 2))[0] expected = numpy.array([float(vals.size) / mx + 1] * (mx + 1)) self.assertTrue(hypothesis.chi_square_test(counts, expected))
def test_goodness_of_fit_2(self): mx = 5 vals = random.randint(mx, size=(5, 20)).get() counts = numpy.histogram(vals, bins=numpy.arange(mx + 1))[0] expected = numpy.array([float(vals.size) / mx] * mx) self.assertTrue(hypothesis.chi_square_test(counts, expected))
def test_goodness_of_fit_2(self): vals = self.rs.choice(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]) self.assertTrue(hypothesis.chi_square_test(counts, expected))