Exemple #1
0
    def test_stat_quantiles(self):
        v = DoubleVector()
        for i in range(100000):
            v.append(random.random())

        self.assertAlmostEqual(quantile(v, 0.1), 0.1, 2)
        self.assertAlmostEqual(quantile_sorted(v, 0.2), 0.2, 2)
        self.assertAlmostEqual(quantile_sorted(v, 0.3), 0.3, 2)
        self.assertAlmostEqual(quantile_sorted(v, 0.4), 0.4, 2)
        self.assertAlmostEqual(quantile_sorted(v, 0.5), 0.5, 2)
Exemple #2
0
    def test_stat_quantiles(self):
        v = DoubleVector()
        for i in range(100000):
            v.append(random.random())

        self.assertAlmostEqual(quantile(v, 0.1), 0.1, 2)
        self.assertAlmostEqual(quantile_sorted(v, 0.2), 0.2, 2)
        self.assertAlmostEqual(quantile_sorted(v, 0.3), 0.3, 2)
        self.assertAlmostEqual(quantile_sorted(v, 0.4), 0.4, 2)
        self.assertAlmostEqual(quantile_sorted(v, 0.5), 0.5, 2)
Exemple #3
0
    def test_stat_quantiles(self):
        rng = RandomNumberGenerator()
        rng.setState("0123456789ABCDEF")
        v = DoubleVector()
        for i in range(100000):
            v.append(rng.getDouble( ))

        self.assertAlmostEqual(quantile(v, 0.1), 0.1, 2)
        self.assertAlmostEqual(quantile_sorted(v, 0.2), 0.2, 2)
        self.assertAlmostEqual(quantile_sorted(v, 0.3), 0.3, 2)
        self.assertAlmostEqual(quantile_sorted(v, 0.4), 0.4, 2)
        self.assertAlmostEqual(quantile_sorted(v, 0.5), 0.5, 2)