source: orange/Orange/testing/unit/tests/test_measures.py @ 10655:a228b55811a4

Revision 10655:a228b55811a4, 1.9 KB checked in by markotoplak, 2 years ago (diff)

Moved testing from utils into testing.

Line 
1from Orange.testing import testing
2from Orange.testing.testing import datasets_driven, test_on_data
3from Orange.feature import scoring
4try:
5    import unittest2 as unittest
6except:
7    import unittest
8
9
10@datasets_driven(datasets=testing.CLASSIFICATION_DATASETS,
11                 preprocess=testing.DISCRETIZE_DOMAIN)
12class TestMeasureAttr_GainRatio(testing.MeasureAttributeTestCase):
13    MEASURE = scoring.GainRatio()
14
15
16@datasets_driven(datasets=testing.CLASSIFICATION_DATASETS,
17                 preprocess=testing.DISCRETIZE_DOMAIN)
18class TestMeasureAttr_InfoGain(testing.MeasureAttributeTestCase):
19    MEASURE = scoring.InfoGain()
20
21
22# TODO: Relevance, Cost
23
24@datasets_driven(datasets=testing.CLASSIFICATION_DATASETS,
25                 preprocess=testing.DISCRETIZE_DOMAIN)
26class TestMeasureAttr_Distance(testing.MeasureAttributeTestCase):
27    MEASURE = scoring.Distance()
28
29
30@datasets_driven(datasets=testing.CLASSIFICATION_DATASETS,
31                 preprocess=testing.DISCRETIZE_DOMAIN)
32class TestMeasureAttr_MDL(testing.MeasureAttributeTestCase):
33    MEASURE = scoring.MDL()
34
35
36@datasets_driven(datasets=testing.CLASSIFICATION_DATASETS + \
37                 testing.REGRESSION_DATASETS)
38class TestMeasureAttr_Relief(testing.MeasureAttributeTestCase):
39    MEASURE = scoring.Relief()
40
41
42@datasets_driven(datasets=testing.REGRESSION_DATASETS,
43                 preprocess=testing.DISCRETIZE_DOMAIN)
44class TestMeasureAttr_MSE(testing.MeasureAttributeTestCase):
45    MEASURE = scoring.MSE()
46
47
48@datasets_driven(datasets=testing.CLASSIFICATION_DATASETS)
49class TestScoringUtils(testing.DataTestCase):
50    @test_on_data
51    def test_order_attrs(self, dataset):
52        order = scoring.OrderAttributes(scoring.Relief())
53        orderes_attrs = order(dataset, 0)
54
55    @test_on_data
56    def test_score_all(self, dataset):
57        scoring.score_all(dataset, score=scoring.Relief())
58
59
60if __name__ == "__main__":
61    unittest.main()
Note: See TracBrowser for help on using the repository browser.