Changeset 39:5e0e4eb49fd1 in orange-reliability for docs/rst/code/reliability-long.py


Ignore:
Timestamp:
10/02/13 15:47:44 (7 months ago)
Author:
markotoplak
Branch:
default
Message:

Updated examples

File:
1 edited

Legend:

Unmodified
Added
Removed
  • docs/rst/code/reliability-long.py

    r2 r39  
    44# Referenced:  Orange.evaluation.reliability 
    55# Classes:     Orange.evaluation.reliability.Learner 
    6  
    7 import Orange 
    8 Orange.evaluation.reliability.select_with_repeat.random_generator = None 
    9 Orange.evaluation.reliability.select_with_repeat.randseed = 42 
    106 
    117import Orange 
     
    2218print "Estimate               r       p" 
    2319for estimate in reliability_res: 
    24     print "%-20s %7.3f %7.3f" % (Orange.evaluation.reliability.METHOD_NAME[estimate[3]], 
     20    print "%-21s%7.3f %7.3f" % (Orange.evaluation.reliability.METHOD_NAME[estimate[3]], 
    2521                                 estimate[0], estimate[1]) 
    2622 
     
    3430print "Estimate               r       p" 
    3531for estimate in reliability_res: 
    36     print "%-20s %7.3f %7.3f" % (Orange.evaluation.reliability.METHOD_NAME[estimate[3]], 
     32    print "%-21s%7.3f %7.3f" % (Orange.evaluation.reliability.METHOD_NAME[estimate[3]], 
    3733                                 estimate[0], estimate[1]) 
    3834 
     
    4137test = prostate.select(indices, 1) 
    4238 
    43 reliability = Orange.evaluation.reliability.Learner(knn, icv=True) 
    44 res = Orange.evaluation.testing.learn_and_test_on_test_data([reliability], train, test) 
     39reliability = Orange.evaluation.reliability.Learner(knn, estimators=[Orange.evaluation.reliability.ICV()]) 
     40reliabilityc = reliability(train) 
     41res = Orange.evaluation.testing.test_on_data([reliabilityc], train, test) 
     42 
     43METHOD_NAME = Orange.evaluation.reliability.METHOD_NAME 
    4544 
    4645print 
    47 print "Method used in internal cross-validation: ", Orange.evaluation.reliability.METHOD_NAME[res.results[0].probabilities[0].reliability_estimate[0].method] 
     46print "Method used in internal cross-validation: ", METHOD_NAME[reliabilityc.estimation_classifiers[0].chosen[0]] 
    4847 
    4948top5 = sorted((abs(result.probabilities[0].reliability_estimate[0].estimate), id) for id, result in enumerate(res.results))[:5] 
Note: See TracChangeset for help on using the changeset viewer.