Ignore:
Timestamp:
03/23/12 20:20:57 (2 years ago)
Author:
mstajdohar
Branch:
default
Message:

Changed obsolete names.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • docs/reference/rst/code/statExamples.py

    r10429 r10633  
    66import Orange 
    77 
    8 learners = [ Orange.classification.bayes.NaiveLearner(name = "bayes"), 
     8learners = [ Orange.classification.bayes.NaiveLearner(name="bayes"), 
    99             Orange.classification.tree.TreeLearner(name="tree"), 
    1010             Orange.classification.majority.MajorityLearner(name="majrty")] 
     
    2929 
    3030 
    31 CAs = Orange.evaluation.scoring.CA(res, reportSE=True) 
    32 APs = Orange.evaluation.scoring.AP(res, reportSE=True) 
    33 Briers = Orange.evaluation.scoring.Brier_score(res, reportSE=True) 
    34 ISs = Orange.evaluation.scoring.IS(res, reportSE=True) 
     31CAs = Orange.evaluation.scoring.CA(res, report_se=True) 
     32APs = Orange.evaluation.scoring.AP(res, report_se=True) 
     33Briers = Orange.evaluation.scoring.Brier_score(res, report_se=True) 
     34ISs = Orange.evaluation.scoring.IS(res, report_se=True) 
    3535 
    3636print 
    3737print "method\tCA\tAP\tBrier\tIS" 
    3838for l in range(len(learners)): 
    39     print "%s\t%5.3f+-%5.3f\t%5.3f+-%5.3f\t%5.3f+-%5.3f\t%6.3f+-%5.3f" % ((learners[l].name, ) + CAs[l] + APs[l] + Briers[l] + ISs[l]) 
     39    print "%s\t%5.3f+-%5.3f\t%5.3f+-%5.3f\t%5.3f+-%5.3f\t%6.3f+-%5.3f" % ((learners[l].name,) + CAs[l] + APs[l] + Briers[l] + ISs[l]) 
    4040 
    4141 
     
    6363cm = Orange.evaluation.scoring.confusion_matrices(resVeh)[0] 
    6464classes = vehicle.domain.class_var.values 
    65 print "\t"+"\t".join(classes) 
     65print "\t" + "\t".join(classes) 
    6666for className, classConfusions in zip(classes, cm): 
    67     print ("%s" + ("\t%i" * len(classes))) % ((className, ) + tuple(classConfusions)) 
     67    print ("%s" + ("\t%i" * len(classes))) % ((className,) + tuple(classConfusions)) 
    6868 
    6969cm = Orange.evaluation.scoring.confusion_matrices(res) 
     
    105105for i in range(4): 
    106106    AUCs = Orange.evaluation.scoring.AUC(resVeh, i) 
    107     print "%25s: \t%5.3f\t%5.3f\t%5.3f" % ((methods[i], ) + tuple(AUCs)) 
     107    print "%25s: \t%5.3f\t%5.3f\t%5.3f" % ((methods[i],) + tuple(AUCs)) 
    108108 
    109109 
     
    113113print 
    114114print "AUC for detecting class 'van' in 'vehicle'" 
    115 AUCs = Orange.evaluation.scoring.AUC_single(resVeh, classIndex = vehicle.domain.class_var.values.index("van")) 
     115AUCs = Orange.evaluation.scoring.AUC_single(resVeh, class_index=vehicle.domain.class_var.values.index("van")) 
    116116print "%5.3f\t%5.3f\t%5.3f" % tuple(AUCs) 
    117117 
    118118print 
    119119print "AUCs for detecting various classes in 'vehicle'" 
    120 for c,s in enumerate(classes): 
    121     print "%s (%5.3f) vs others: \t%5.3f\t%5.3f\t%5.3f" % ((s, classDist[c] ) + tuple(Orange.evaluation.scoring.AUC_single(resVeh, c))) 
     120for c, s in enumerate(classes): 
     121    print "%s (%5.3f) vs others: \t%5.3f\t%5.3f\t%5.3f" % ((s, classDist[c]) + tuple(Orange.evaluation.scoring.AUC_for_single_class(resVeh, c))) 
    122122 
    123123print 
    124124classes = vehicle.domain.class_var.values 
    125125AUCmatrix = Orange.evaluation.scoring.AUC_matrix(resVeh)[0] 
    126 print "\t"+"\t".join(classes[:-1]) 
     126print "\t" + "\t".join(classes[:-1]) 
    127127for className, AUCrow in zip(classes[1:], AUCmatrix[1:]): 
    128     print ("%s" + ("\t%5.3f" * len(AUCrow))) % ((className, ) + tuple(AUCrow)) 
     128    print ("%s" + ("\t%5.3f" * len(AUCrow))) % ((className,) + tuple(AUCrow)) 
    129129 
    130130print 
     
    132132for c1, s1 in enumerate(classes): 
    133133    for c2 in range(c1): 
    134         print "%s vs %s: \t%5.3f\t%5.3f\t%5.3f" % ((s1, classes[c2]) + tuple(Orange.evaluation.scoring.AUC_pair(resVeh, c1, c2))) 
     134        print "%s vs %s: \t%5.3f\t%5.3f\t%5.3f" % ((s1, classes[c2]) + tuple(Orange.evaluation.scoring.AUC_for_pair_of_classes(resVeh, c1, c2))) 
    135135 
    136136 
Note: See TracChangeset for help on using the changeset viewer.