コード例 #1
0
 def test_linear_scorer(self):
     data = Table('housing')
     learner = LinearRegressionLearner()
     scores = learner.score_data(data)
     self.assertEqual('NOX',
                      data.domain.attributes[np.argmax(scores)].name)
     self.assertEqual(len(scores), len(data.domain.attributes))
コード例 #2
0
 def test_linear_scorer_feature(self):
     data = Table('housing')
     learner = LinearRegressionLearner()
     scores = learner.score_data(data)
     for i, attr in enumerate(data.domain.attributes):
         score = learner.score_data(data, attr)
         self.assertEqual(score, scores[i])
コード例 #3
0
 def test_linear_scorer(self):
     learner = LinearRegressionLearner()
     scores = learner.score_data(self.housing)
     self.assertEqual("LSTAT", self.housing.domain.attributes[np.argmax(scores[0])].name)
     self.assertEqual(scores.shape[1], len(self.housing.domain.attributes))