Changeset 7658:dfa7ee711741 in orange


Ignore:
Timestamp:
02/12/11 16:38:11 (3 years ago)
Author:
janezd <janez.demsar@…>
Branch:
default
Convert:
edc37ad5c05d9bdfc3539d74bc68d6ea9865aa2a
Message:

Changed names in example scripts for Orange.statistics to underscore format

Location:
orange/doc/Orange/rst/code
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • orange/doc/Orange/rst/code/statistics-contingency2.py

    r7657 r7658  
    44cont = Orange.statistics.contingency.Table(table.domain["e"], table.domain.classVar) 
    55for ins in table: 
    6     cont [ins["e"]] [ins.getclass()] += 1 
     6    cont [ins["e"]] [ins.get_class()] += 1 
    77 
    88print "Contingency items:" 
     
    1313 
    1414for ins in table: 
    15     cont.add(ins["e"], ins.getclass())  
     15    cont.add(ins["e"], ins.get_class()) 
  • orange/doc/Orange/rst/code/statistics-contingency3.py

    r7657 r7658  
    44cont = Orange.statistics.contingency.VarClass("e", table) 
    55 
    6 print "Inner variable: ", cont.innerVariable.name 
    7 print "Outer variable: ", cont.outerVariable.name 
     6print "Inner variable: ", cont.inner_variable.name 
     7print "Outer variable: ", cont.outer_variable.name 
    88print 
    9 print "Class variable: ", cont.classVar.name 
     9print "Class variable: ", cont.class_var.name 
    1010print "Feature:      ", cont.variable.name 
    1111print 
     
    1616print 
    1717 
    18 firstclass = Orange.data.Value(cont.classVar, 1) 
    19 firstnative = firstclass.native() 
    20 print "Probabilities of class '%s'" % firstnative 
     18first_class = Orange.data.Value(cont.class_var, 1) 
     19first_native = first_class.native() 
     20print "Probabilities of class '%s'" % first_native 
    2121for val in cont.variable: 
    22     print "  p(%s|%s) = %5.3f" % (firstnative, val.native(), cont.p_class(val, firstclass)) 
     22    print "  p(%s|%s) = %5.3f" % (first_native, val.native(),  
     23                                  cont.p_class(val, first_class)) 
    2324print 
    2425 
    25 cont = Orange.statistics.contingency.VarClass(table.domain["e"], table.domain.classVar) 
     26cont = Orange.statistics.contingency.VarClass(table.domain["e"], 
     27                                              table.domain.class_var) 
    2628for ins in table: 
    27     cont.add_attrclass(ins["e"], ins.getclass()) 
     29    cont.add_var_class(ins["e"], ins.getclass()) 
    2830 
    2931print "Distributions from a matrix computed manually:" 
Note: See TracChangeset for help on using the changeset viewer.