Changeset 9335:e785f03deb26 in orange


Ignore:
Timestamp:
12/12/11 21:19:30 (2 years ago)
Author:
markotoplak
Branch:
default
Convert:
69942b8b85c509bbcc6214a86fdeda0900d7073d
Message:

Removed eval from accuracy8.py

File:
1 edited

Legend:

Unmodified
Added
Removed
  • orange/doc/ofb-rst/code/accuracy8.py

    r6866 r9335  
    2121        classIndex=data.domain.classVar.values.index('democrat')) 
    2222 
    23 stat = (('CA', 'CA(res)'), 
    24         ('Sens', 'sens(cm)'), 
    25         ('Spec', 'spec(cm)'), 
    26         ('AUC', 'AUC(res)'), 
    27         ('IS', 'IS(res)'), 
    28         ('Brier', 'BrierScore(res)'), 
    29         ('F1', 'F1(cm)'), 
    30         ('F2', 'Falpha(cm, alpha=2.0)'), 
    31         ('MCC', 'MCC(cm)'), 
    32         ('sPi', 'scottsPi(cm)'), 
     23stat = (('CA', lambda res,cm: orngStat.CA(res)), 
     24        ('Sens', lambda res,cm: orngStat.sens(cm)), 
     25        ('Spec', lambda res,cm: orngStat.spec(cm)), 
     26        ('AUC', lambda res,cm: orngStat.AUC(res)), 
     27        ('IS', lambda res,cm: orngStat.IS(res)), 
     28        ('Brier', lambda res,cm: orngStat.BrierScore(res)), 
     29        ('F1', lambda res,cm: orngStat.F1(cm)), 
     30        ('F2', lambda res,cm: orngStat.Falpha(cm, alpha=2.0)), 
     31        ('MCC', lambda res,cm: orngStat.MCC(cm)), 
     32        ('sPi', lambda res,cm: orngStat.scottsPi(cm)), 
    3333        ) 
    3434 
    35 scores = [eval("orngStat."+s[1]) for s in stat] 
     35scores = [s[1](res,cm) for s in stat] 
    3636print 
    3737print "Learner  " + "".join(["%-7s" % s[0] for s in stat]) 
Note: See TracChangeset for help on using the changeset viewer.