source: orange/testing/unittests/tests/test_linregression.py @ 8825:348e066a9f1f

Revision 8825:348e066a9f1f, 1.0 KB checked in by ales_erjavec <ales.erjavec@…>, 3 years ago (diff)

Added basic tests for linear and lasso regression.

Line 
1from Orange.misc import testing
2from Orange.misc.testing import datasets_driven, test_on_data, test_on_datasets
3from Orange.regression import linear
4import Orange
5import unittest
6
7@datasets_driven(datasets=testing.REGRESSION_DATASETS)
8class TestLinearRegressionLearner(testing.LearnerTestCase):
9   
10    def setUp(self):
11        self.learner = linear.LinearRegressionLearner()
12   
13    @test_on_data
14    def test_learner_on(self, dataset):
15        testing.LearnerTestCase.test_learner_on(self, dataset)
16        linear.print_linear_regression_model(self.classifier)
17       
18@datasets_driven(datasets=testing.REGRESSION_DATASETS)
19class TestRidgeRegressionLearner(testing.LearnerTestCase):
20   
21    def setUp(self):
22        self.learner = linear.LinearRegressionLearner(ridgeLambda=2)
23   
24    @test_on_data
25    def test_learner_on(self, dataset):
26        testing.LearnerTestCase.test_learner_on(self, dataset)
27        if self.classifier.p_vals:
28            linear.print_linear_regression_model(self.classifier)
29   
30       
31if __name__ == "__main__":
32    unittest.main()
Note: See TracBrowser for help on using the repository browser.