Ignore:
Timestamp:
02/06/12 09:11:20 (2 years ago)
Author:
Miha Stajdohar <miha.stajdohar@…>
Branch:
default
Message:

To Orange25.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • docs/reference/rst/code/selection-filtered-learner.py

    r9372 r9661  
    88# Classes:     Orange.feature.selection.FilteredLearner 
    99 
    10 import Orange, orngTest, orngStat 
    11 table = Orange.data.Table("voting") 
     10import Orange 
     11 
     12voting = Orange.data.Table("voting") 
    1213 
    1314nb = Orange.classification.bayes.NaiveLearner() 
    14 fl = Orange.feature.selection.FilteredLearner(nb,  
    15      filter=Orange.feature.selection.FilterBestNAtts(n=1), name='filtered') 
     15fl = Orange.feature.selection.FilteredLearner(nb, 
     16     filter=Orange.feature.selection.FilterBestN(n=1), name='filtered') 
    1617learners = (Orange.classification.bayes.NaiveLearner(name='bayes'), fl) 
    17 results = orngTest.crossValidation(learners, table, storeClassifiers=1) 
     18results = Orange.evaluation.testing.cross_validation(learners, voting, storeClassifiers=1) 
    1819 
    1920# output the results 
    2021print "Learner      CA" 
    2122for i in range(len(learners)): 
    22     print "%-12s %5.3f" % (learners[i].name, orngStat.CA(results)[i]) 
     23    print "%-12s %5.3f" % (learners[i].name, Orange.evaluation.scoring.CA(results)[i]) 
    2324 
    2425# find out which attributes were retained by filtering 
Note: See TracChangeset for help on using the changeset viewer.