source: orange/orange/doc/Orange/rst/code/logreg-stepwise.py @ 7747:b8cd550d6e36

Revision 7747:b8cd550d6e36, 1.0 KB checked in by jzbontar <jure.zbontar@…>, 3 years ago (diff)

Rename camel case identifiers in logistic regression.

Line 
1import orngTest
2import orngFSS
3from Orange import *
4import Orange.evaluation.testing
5
6
7table = data.Table("ionosphere.tab")
8
9lr = classification.logreg.LogRegLearner(removeSingular=1)
10learners = (
11  classification.logreg.LogRegLearner(name='logistic', removeSingular=1),
12  feature.selection.FilteredLearner(lr,
13     filter=Orange.classification.logreg.StepWiseFSSFilter(addCrit=0.05, deleteCrit=0.9),
14     name='filtered')
15)
16results = Orange.evaluation.testing.crossValidation(learners, table, storeClassifiers=1)
17
18# output the results
19print "Learner      CA"
20for i in range(len(learners)):
21    print "%-12s %5.3f" % (learners[i].name, evaluation.scoring.CA(results)[i])
22
23# find out which features were retained by filtering
24
25print "\nNumber of times features were used in cross-validation:"
26featuresUsed = {}
27for i in range(10):
28    for a in results.classifiers[i][1].atts():
29        if a.name in featuresUsed.keys():
30            featuresUsed[a.name] += 1
31        else:
32            featuresUsed[a.name] = 1
33for k in featuresUsed:
34    print "%2d x %s" % (featuresUsed[k], k)
Note: See TracBrowser for help on using the repository browser.