Ignore:
Timestamp:
02/06/12 20:01:02 (2 years ago)
Author:
lanumek
Branch:
default
Children:
9835:e48466fc6eb2, 9841:05a160804431
rebase_source:
8cf30121654f25c9cb6d8ac9bdaf163e305d62da
Message:

Changed names of data sets (table replaced with data or name of the data set).

File:
1 edited

Legend:

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

    r9372 r9823  
    77import Orange 
    88 
    9 data = Orange.data.Table("iris") 
    10 tree = Orange.classification.tree.C45Learner(data) 
     9iris = Orange.data.Table("iris") 
     10tree = Orange.classification.tree.C45Learner(iris) 
    1111 
    1212print "\n\nC4.5 with default arguments" 
    13 for i in data[:5]: 
     13for i in iris[:5]: 
    1414    print tree(i), i.getclass() 
    1515 
    1616print "\n\nC4.5 with m=100" 
    17 tree = Orange.classification.tree.C45Learner(data, m=100) 
    18 for i in data[:5]: 
     17tree = Orange.classification.tree.C45Learner(iris, m=100) 
     18for i in iris[:5]: 
    1919    print tree(i), i.getclass() 
    2020 
    2121print "\n\nC4.5 with minObjs=100" 
    22 tree = Orange.classification.tree.C45Learner(data, minObjs=100) 
    23 for i in data[:5]: 
     22tree = Orange.classification.tree.C45Learner(iris, minObjs=100) 
     23for i in iris[:5]: 
    2424    print tree(i), i.getclass() 
    2525 
     
    2727lrn = Orange.classification.tree.C45Learner() 
    2828lrn.commandline("-m 1 -s") 
    29 tree = lrn(data) 
    30 for i in data: 
     29tree = lrn(iris) 
     30for i in iris: 
    3131    if i.getclass() != tree(i): 
    3232        print i, tree(i) 
    3333 
    34 tree = Orange.classification.tree.C45Learner(data) 
     34tree = Orange.classification.tree.C45Learner(iris) 
    3535print tree 
    3636print 
     
    3838 
    3939res = Orange.evaluation.testing.cross_validation([Orange.classification.tree.C45Learner(),  
    40     Orange.classification.tree.C45Learner(convertToOrange=1)], data) 
     40    Orange.classification.tree.C45Learner(convertToOrange=1)], iris) 
    4141print "Classification accuracy: %5.3f (converted to tree: %5.3f)" % tuple(Orange.evaluation.scoring.CA(res)) 
    4242print "Brier score: %5.3f (converted to tree: %5.3f)" % tuple(Orange.evaluation.scoring.Brier_score(res)) 
Note: See TracChangeset for help on using the changeset viewer.