Ignore:
Timestamp:
01/08/13 11:31:40 (15 months ago)
Author:
Yuval Greenfield <yuval@…>
Branch:
default
Message:

Added a test case for logreg.dump and a high beta classifier.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • Orange/testing/unit/tests/test_logreg.py

    r10678 r11061  
    77from orngLR import LogRegLearner, Univariate_LogRegLearner, StepWiseFSS, StepWiseFSS_Filter 
    88 
    9 from Orange.classification.logreg import LibLinearLogRegLearner 
     9from Orange.classification.logreg import LibLinearLogRegLearner, dump 
     10import Orange 
     11 
    1012def datasets_iter(): 
    1113    for name, (data,) in testing.datasets_iter(testing.CLASSIFICATION_DATASETS): 
     
    2224        """ 
    2325        if len(dataset) < len(dataset.domain): 
    24             raise unittest.SkipTest("No enough examples") 
     26            raise unittest.SkipTest("Not enough examples") 
    2527        testing.LearnerTestCase.test_learner_on(self, dataset) 
    2628 
     
    4850        testing.LearnerTestCase.test_learner_on(self, dataset) 
    4951 
     52class TestUtils(unittest.TestCase): 
     53    def test_dump(self): 
     54        """Test for dump() failing (OverflowError: math range error on math.exp) 
     55         on classifiers with high beta""" 
     56        quality = Orange.feature.Discrete('quality') 
     57        quality.add_value('low') 
     58        quality.add_value('high') 
     59        price = Orange.feature.Continuous('price') 
     60        variables = [price, quality] 
     61        matrix = [[0.01, 'high'], [0.001, 'low']] 
     62        domain = Orange.data.Domain(variables) 
     63        data = Orange.data.Table(domain, matrix) 
     64        classifier = LogRegLearner(data) 
     65        text_dump = dump(classifier) 
     66 
     67 
    5068if __name__ == "__main__": 
    5169    unittest.main() 
Note: See TracChangeset for help on using the changeset viewer.