source: orange/testing/unittests/tests/test_earth.py @ 9570:2bd46002d5df

Revision 9570:2bd46002d5df, 1.6 KB checked in by ales_erjavec, 2 years ago (diff)

format_model -> to_string

Line 
1from Orange.misc import testing
2from Orange.misc.testing import datasets_driven, test_on_data, test_on_datasets
3from Orange.regression import earth
4import Orange
5import unittest
6
7@datasets_driven(datasets=testing.REGRESSION_DATASETS +\
8                 testing.CLASSIFICATION_DATASETS)
9class TestEarthLearner(testing.LearnerTestCase):
10   
11    def setUp(self):
12        self.learner = earth.EarthLearner(degree=2, terms=10)
13   
14    @test_on_data
15    def test_learner_on(self, dataset):
16        if len(dataset) < 30:
17            raise unittest.SkipTest("Not enough examples.")
18        testing.LearnerTestCase.test_learner_on(self, dataset)
19        str = self.classifier.to_string()
20        evimp = self.classifier.evimp()
21       
22    @test_on_data
23    def test_bagged_evimp(self, dataset):
24        from Orange.ensemble.bagging import BaggedLearner
25        bagged = BaggedLearner(earth.EarthLearner(terms=10, degree=2), t=5)(dataset)
26        evimp = earth.bagged_evimp(bagged, used_only=False)
27   
28   
29@datasets_driven(datasets=testing.REGRESSION_DATASETS +\
30                 testing.CLASSIFICATION_DATASETS)
31class TestScoreEarthImportance(testing.MeasureAttributeTestCase):
32    def setUp(self):
33        from Orange.regression.earth import ScoreEarthImportance
34        self.measure = ScoreEarthImportance(t=5, score_what="rss")
35       
36       
37#@datasets_driven(datasets=testing.REGRESSION_DATASETS,)
38#class TestScoreRSS(testing.MeasureAttributeTestCase):
39#    def setUp(self):
40#        from Orange.regression.earth import ScoreRSS
41#        self.measure = ScoreRSS()
42       
43       
44if __name__ == "__main__":
45    unittest.main()
46       
Note: See TracBrowser for help on using the repository browser.