Esempio n. 1
0
    def test_rad_estimate(self):
        self.assertAlmostEqual(
            1.0, rademacher_estimate(self._full_shatter, self._hypotheses, num_samples=1000, random_seed=3), places=1
        )

        self.assertAlmostEqual(
            0.0, rademacher_estimate([(0, 0)], constant_hypotheses, num_samples=1000, random_seed=3), places=1
        )

        self.assertAlmostEqual(
            0.625, rademacher_estimate(self._half_shatter, self._hypotheses, num_samples=1000, random_seed=3), places=1
        )
Esempio n. 2
0
    def test_rad_estimate(self):
        self.assertAlmostEqual(1.0, rademacher_estimate(self._full_shatter,
                                                        self._hypotheses,
                                                        num_samples=1000,
                                                        random_seed=3),
                               places=1)

        self.assertAlmostEqual(0.0, rademacher_estimate([(0, 0)],
                                                        constant_hypotheses,
                                                        num_samples=1000,
                                                        random_seed=3),
                               places=1)

        self.assertAlmostEqual(0.625, rademacher_estimate(self._half_shatter,
                                                          self._hypotheses,
                                                          num_samples=1000,
                                                          random_seed=3),
                               places=1)