def uniform_hypothesis(distribution: dist.Distribution, size: int):
    sample = distribution.create_sample(size)
    characteristics = Characteristics(sample)
    hypothesis = Hypothesis()
    hyp_distribution = dist.UniformDistribution(characteristics.min(),
                                                characteristics.max())
    hypothesis.check_hypothesis(sample, hyp_distribution)
def main():
    size = 100
    normal_distribution = dist.NormalDistribution(0, 1)
    print('Normal for Normal')
    normal_hypothesis(normal_distribution, size)

    size = 20

    laplace_distribution = dist.LaplaceDistribution(0, 1 / (2**0.5))
    uniform_distribution = dist.UniformDistribution(-3**0.5, 3**0.5)

    print('Laplace for Normal')
    normal_hypothesis(laplace_distribution, size)
    print('Uniform for Normal')
    normal_hypothesis(uniform_distribution, size)

    print('Normal for Laplace')
    laplace_hypothesis(normal_distribution, size)
    print('Normal for Uniform')
    uniform_hypothesis(normal_distribution, size)

    return 0
Example #3
0
 def test_uniform_incorrect_lowest(self):
     test_class = dis.UniformDistribution()
     self.assertRaises(Exception, test_class.set_variables, -1, 2, 3, 4, 5)
Example #4
0
 def test_uniform_five_to_ten(self):
     test_class = dis.UniformDistribution()
     test_class.set_variables(5, 10)
     self.assertTrue(5.0 <= test_class.bootstrap() <= 10.0)
Example #5
0
 def test_uniform_eleven_constant(self):
     test_class = dis.UniformDistribution()
     test_class.set_variables(11, 11)
     self.assertEqual(test_class.bootstrap(), 11.0)
Example #6
0
 def test_uniform_five_constant(self):
     test_class = dis.UniformDistribution()
     test_class.set_variables(5, 5, 3, 4, 5)
     self.assertEqual(test_class.bootstrap(), 5.0)
Example #7
0
 def test_uniform_incorrect_multiplication_value(self):
     test_class = dis.UniformDistribution()
     self.assertRaises(Exception, test_class.set_variables, 1, 2, 3, -4, 5)