Пример #1
0
 def test_ridge_scorer_feature(self):
     data = Table('housing')
     learner = RidgeRegressionLearner()
     scores = learner.score_data(data)
     for i, attr in enumerate(data.domain.attributes):
         score = learner.score_data(data, attr)
         self.assertEqual(score, scores[i])
Пример #2
0
 def test_ridge_scorer_feature(self):
     data = Table('housing')
     learner = RidgeRegressionLearner()
     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_deprecated_normalize(self):
     """ When this test starts to fail:
     - remove normalize=False kwargs from Orange.regression.
     - remove _remove_deprecated_normalize and its calls
     - remove this test
     """
     import Orange  # pylint: disable=import-outside-toplevel
     self.assertLess(Orange.__version__, "3.33")
     with self.assertWarns(OrangeDeprecationWarning):
         RidgeRegressionLearner(normalize=True)
Пример #4
0
 def test_scorer_feature(self):
     learners = [LinearRegressionLearner(),
                 RidgeRegressionLearner(),
                 LassoRegressionLearner(alpha=0.01),
                 ElasticNetLearner(alpha=0.01)]
     for learner in learners:
         scores = learner.score_data(self.housing)
         for i, attr in enumerate(self.housing.domain.attributes):
             score = learner.score_data(self.housing, attr)
             self.assertEqual(score, scores[i])
Пример #5
0
 def test_scorer(self):
     learners = [LinearRegressionLearner(),
                 RidgeRegressionLearner(),
                 LassoRegressionLearner(alpha=0.01),
                 ElasticNetLearner(alpha=0.01)]
     for learner in learners:
         scores = learner.score_data(self.housing)
         self.assertEqual('LSTAT',
                          self.housing.domain.attributes[np.argmax(scores)].name)
         self.assertEqual(len(scores), len(self.housing.domain.attributes))
 def test_Regression(self):
     ridge = RidgeRegressionLearner()
     lasso = LassoRegressionLearner()
     elastic = ElasticNetLearner()
     elasticCV = ElasticNetCVLearner()
     mean = MeanLearner()
     learners = [ridge, lasso, elastic, elasticCV, mean]
     res = CrossValidation(self.housing, learners, k=2)
     rmse = RMSE(res)
     for i in range(len(learners) - 1):
         self.assertLess(rmse[i], rmse[-1])
Пример #7
0
 def test_scorer(self):
     data = Table('housing')
     learners = [
         LinearRegressionLearner(),
         RidgeRegressionLearner(),
         LassoRegressionLearner(alpha=0.01),
         ElasticNetLearner(alpha=0.01)
     ]
     for learner in learners:
         scores = learner.score_data(data)
         self.assertEqual('NOX',
                          data.domain.attributes[np.argmax(scores)].name)
         self.assertEqual(len(scores), len(data.domain.attributes))
Пример #8
0
 def __init__(self,
              learners,
              aggregate=RidgeRegressionLearner(),
              k=5,
              preprocessors=None):
     super().__init__(learners, aggregate, k=k, preprocessors=preprocessors)
Пример #9
0
 def test_ridge_scorer(self):
     data = Table('housing')
     learner = RidgeRegressionLearner()
     scores = learner.score_data(data)
     self.assertEqual(len(scores), len(data.domain.attributes))
Пример #10
0
 def test_ridge_scorer(self):
     data = Table('housing')
     learner = RidgeRegressionLearner()
     scores = learner.score_data(data)
     self.assertEqual(len(scores), len(data.domain.attributes))
Пример #11
0
 def __init__(self, learners, aggregate=RidgeRegressionLearner(), k=5):
     super().__init__(learners=learners, aggregate=aggregate, k=k)