예제 #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_gini(self):
     scorer = score.Gini()
     correct = [0.11893, 0.10427, 0.13117, 0.14650, 0.05973]
     np.testing.assert_almost_equal([scorer(a, self.zoo) for a in range(5)],
                                    correct,
                                    decimal=5)