source: orange/Orange/testing/unit/tests/test_preprocessors.py @ 9679:3879dea56188

Revision 9679:3879dea56188, 6.1 KB checked in by Miha Stajdohar <miha.stajdohar@…>, 2 years ago (diff)

Moved and renamed testing.

Line 
1import unittest
2
3from Orange.preprocess import (Preprocessor_addCensorWeight,
4         Preprocessor_addClassNoise,
5         Preprocessor_addClassWeight, 
6         Preprocessor_addGaussianClassNoise,
7         Preprocessor_addGaussianNoise,
8         Preprocessor_addMissing,
9         Preprocessor_addMissingClasses,
10         Preprocessor_addNoise,
11         Preprocessor_discretize,
12         Preprocessor_drop,
13         Preprocessor_dropMissing,
14         Preprocessor_dropMissingClasses,
15         Preprocessor_filter,
16         Preprocessor_ignore,
17         Preprocessor_imputeByLearner,
18         Preprocessor_removeDuplicates,
19         Preprocessor_select,
20         Preprocessor_shuffle,
21         Preprocessor_take,
22         Preprocessor_takeMissing,
23         Preprocessor_takeMissingClasses,
24         Preprocessor_discretizeEntropy,
25         Preprocessor_removeContinuous,
26         Preprocessor_removeDiscrete,
27         Preprocessor_continuize,
28         Preprocessor_impute,
29         Preprocessor_featureSelection,
30         Preprocessor_RFE,
31         Preprocessor_sample,
32         Preprocessor_preprocessorList,
33         )
34
35import orange
36
37import Orange.misc.testing as testing
38   
39@testing.datasets_driven(datasets=testing.CLASSIFICATION_DATASETS)
40class TestAddClassNoise(testing.PreprocessorTestCase):
41    """ Test Preprocessor_addClassNoise
42    """
43    PREPROCESSOR = Preprocessor_addClassNoise
44   
45
46@testing.datasets_driven(datasets=testing.CLASSIFICATION_DATASETS)
47class TestAddClassWeight(testing.PreprocessorTestCase):
48    PREPROCESSOR = Preprocessor_addClassWeight
49
50
51@testing.datasets_driven(datasets=testing.REGRESSION_DATASETS)
52class TestAddGaussianClassNoise(testing.PreprocessorTestCase):
53    """ Test Preprocessor_addGaussianClassNoise
54    """
55    PREPROCESSOR = Preprocessor_addGaussianClassNoise
56
57
58@testing.datasets_driven
59class TestAddGaussianNoise(testing.PreprocessorTestCase):
60    """ Test Preprocessor_addGaussianNoise
61    """
62    PREPROCESSOR = Preprocessor_addGaussianNoise
63
64   
65@testing.datasets_driven
66class TestAddMissing(testing.PreprocessorTestCase):
67    PREPROCESSOR = Preprocessor_addMissing
68
69
70@testing.datasets_driven(datasets=testing.CLASSIFICATION_DATASETS + \
71                         testing.REGRESSION_DATASETS)
72class TestAddMissingClasses(testing.PreprocessorTestCase):
73    PREPROCESSOR = Preprocessor_addMissingClasses
74
75   
76@testing.datasets_driven
77class TestAddMissing(testing.PreprocessorTestCase):
78    PREPROCESSOR = Preprocessor_addMissing
79
80
81@testing.datasets_driven
82class TestAddNoise(testing.PreprocessorTestCase):
83    PREPROCESSOR = Preprocessor_addNoise
84
85   
86@testing.datasets_driven
87class TestDiscretizeEquiN(testing.PreprocessorTestCase):
88    PREPROCESSOR = Preprocessor_discretize(method=orange.EquiNDiscretization())
89
90
91@testing.datasets_driven
92class TestDiscretizeEquiDist(testing.PreprocessorTestCase):
93    PREPROCESSOR = Preprocessor_discretize(method=orange.EquiDistDiscretization())
94   
95   
96@testing.datasets_driven(datasets=testing.CLASSIFICATION_DATASETS)
97class TestDiscretizeEntropy(testing.PreprocessorTestCase):
98    PREPROCESSOR = Preprocessor_discretize(method=orange.EntropyDiscretization())
99
100##########
101# This crashes with std::bad_cast
102##########
103#@testing.datasets_driven
104#class TestDiscretizeBiModal(testing.PreprocessorTestCase):
105#    PREPROCESSOR = Preprocessor_discretize(method=orange.BiModalDiscretization())
106
107#####
108# Pickling throws a segfault
109#####
110#@testing.datasets_driven
111#class TestFilter(testing.PreprocessorTestCase):
112#    PREPROCESSOR = Preprocessor_filter(filter=orange.Filter_random(prob = 0.7, randomGenerator = 24))
113   
114@testing.datasets_driven
115class TestDropMissingClasses(testing.PreprocessorTestCase):
116    PREPROCESSOR = Preprocessor_dropMissingClasses
117   
118@testing.datasets_driven
119class TestIgnore(testing.PreprocessorTestCase):
120    PREPROCESSOR = Preprocessor_ignore
121   
122@testing.datasets_driven
123class TestImputeByLearner(testing.PreprocessorTestCase):
124    PREPROCESSOR = Preprocessor_imputeByLearner(learner=orange.MajorityLearner())
125   
126@testing.datasets_driven(datasets=testing.ALL_DATASETS + ["lenses"])
127class TestRemoveDuplicates(testing.PreprocessorTestCase):
128    PREPROCESSOR = Preprocessor_removeDuplicates
129   
130@testing.datasets_driven
131class TestSelect(testing.PreprocessorTestCase):
132    PREPROCESSOR = Preprocessor_select
133   
134@testing.datasets_driven
135class TestShuffle(testing.PreprocessorTestCase):
136    PREPROCESSOR = Preprocessor_shuffle
137   
138@testing.datasets_driven
139class TestTake(testing.PreprocessorTestCase):
140    PREPROCESSOR = Preprocessor_take
141   
142@testing.datasets_driven
143class TestTakeMissing(testing.PreprocessorTestCase):
144    PREPROCESSOR = Preprocessor_takeMissing
145   
146@testing.datasets_driven
147class TestTakeMissingClasses(testing.PreprocessorTestCase):
148    PREPROCESSOR = Preprocessor_takeMissingClasses
149   
150@testing.datasets_driven(datasets=testing.CLASSIFICATION_DATASETS)
151class TestDiscretizeEntropy(testing.PreprocessorTestCase):
152    PREPROCESSOR = Preprocessor_discretizeEntropy
153   
154@testing.datasets_driven
155class TestRemoveContinuous(testing.PreprocessorTestCase):
156    PREPROCESSOR = Preprocessor_removeContinuous
157   
158@testing.datasets_driven
159class TestRemoveDiscrete(testing.PreprocessorTestCase):
160    PREPROCESSOR = Preprocessor_removeDiscrete
161   
162@testing.datasets_driven
163class TestContinuize(testing.PreprocessorTestCase):
164    PREPROCESSOR = Preprocessor_continuize
165   
166@testing.datasets_driven
167class TestImpute(testing.PreprocessorTestCase):
168    PREPROCESSOR = Preprocessor_impute
169   
170@testing.datasets_driven(datasets=testing.CLASSIFICATION_DATASETS + \
171                         testing.REGRESSION_DATASETS)
172class TestFeatureSelection(testing.PreprocessorTestCase):
173    PREPROCESSOR = Preprocessor_featureSelection
174   
175@testing.datasets_driven(datasets=testing.CLASSIFICATION_DATASETS)
176class TestRFE(testing.PreprocessorTestCase):
177    PREPROCESSOR = Preprocessor_RFE
178   
179@testing.datasets_driven
180class TestSample(testing.PreprocessorTestCase):
181    PREPROCESSOR = Preprocessor_sample
182   
183@testing.datasets_driven
184class TestSelect(testing.PreprocessorTestCase):
185    PREPROCESSOR = Preprocessor_preprocessorList(preprocessors=[Preprocessor_sample, Preprocessor_takeMissing])
186   
187if __name__ == "__main__":
188    unittest.main()
189
190   
191         
Note: See TracBrowser for help on using the repository browser.