Ignore:
Timestamp:
02/06/12 20:00:44 (2 years ago)
Author:
Matija Polajnar <matija.polajnar@…>
Branch:
default
rebase_source:
50b865d3d6764767b1ca538019c5b08631aee272
Message:

Finish the logreg refactoring, along with documentation improvement.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • docs/reference/rst/code/logreg-stepwise.py

    r9372 r9818  
    33ionosphere = Orange.data.Table("ionosphere.tab") 
    44 
    5 lr = Orange.classification.logreg.LogRegLearner(removeSingular=1) 
     5lr = Orange.classification.logreg.LogRegLearner(remove_singular=1) 
    66learners = ( 
    7   Orange.classification.logreg.LogRegLearner(name='logistic', removeSingular=1), 
     7  Orange.classification.logreg.LogRegLearner(name='logistic', 
     8      remove_singular=1), 
    89  Orange.feature.selection.FilteredLearner(lr, 
    9      filter=Orange.classification.logreg.StepWiseFSSFilter(addCrit=0.05, deleteCrit=0.9), 
    10      name='filtered') 
     10     filter=Orange.classification.logreg.StepWiseFSSFilter(add_crit=0.05, 
     11         delete_crit=0.9), name='filtered') 
    1112) 
    1213results = Orange.evaluation.testing.cross_validation(learners, ionosphere, store_classifiers=1) 
     
    2021 
    2122print "\nNumber of times features were used in cross-validation:" 
    22 featuresUsed = {} 
     23features_used = {} 
    2324for i in range(10): 
    2425    for a in results.classifiers[i][1].atts(): 
    25         if a.name in featuresUsed.keys(): 
    26             featuresUsed[a.name] += 1 
     26        if a.name in features_used.keys(): 
     27            features_used[a.name] += 1 
    2728        else: 
    28             featuresUsed[a.name] = 1 
    29 for k in featuresUsed: 
    30     print "%2d x %s" % (featuresUsed[k], k) 
     29            features_used[a.name] = 1 
     30for k in features_used: 
     31    print "%2d x %s" % (features_used[k], k) 
Note: See TracChangeset for help on using the changeset viewer.