Пример #1
0
 def test_classless(self):
     classless = Table(Domain(self.zoo.domain.attributes), self.zoo[:,
                                                                    0:-1])
     scorers = [score.Gini(), score.InfoGain(), score.GainRatio()]
     for scorer in scorers:
         with self.assertRaises(ValueError):
             scorer(0, classless)
Пример #2
0
    def test_wrong_class_type(self):
        scorers = [score.Gini(), score.InfoGain(), score.GainRatio()]
        for scorer in scorers:
            with self.assertRaises(ValueError):
                scorer(0, self.housing)

        with self.assertRaises(ValueError):
            score.Chi2(2, self.housing)
        with self.assertRaises(ValueError):
            score.ANOVA(2, self.housing)
        score.UnivariateLinearRegression(2, self.housing)
Пример #3
0
 def test_gain_ratio(self):
     scorer = score.GainRatio()
     correct = [0.80351, 1.00000, 0.84754, 1.00000, 0.59376]
     np.testing.assert_almost_equal([scorer(a, self.zoo) for a in range(5)],
                                    correct,
                                    decimal=5)