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/testing-test.py

    r9696 r9823  
    44import Orange.evaluation.testing 
    55 
    6 table = Orange.data.Table("voting") 
     6voting = Orange.data.Table("voting") 
    77 
    88bayes = Orange.classification.bayes.NaiveLearner(name="bayes") 
     
    1919print "\nproportionsTest that will always give the same results" 
    2020for i in range(3): 
    21     res = Orange.evaluation.testing.proportion_test(learners, table, 0.7) 
     21    res = Orange.evaluation.testing.proportion_test(learners, voting, 0.7) 
    2222    printResults(res) 
    2323 
    2424print "\nproportionsTest that will give different results, \ 
    2525but the same each time the script is run" 
    26 myRandom = Orange.misc.Random() 
     26myRandom = Orange.core.RandomGenerator() 
    2727for i in range(3): 
    28     res = Orange.evaluation.testing.proportion_test(learners, table, 0.7, 
    29         random_generator=myRandom) 
     28    res = Orange.evaluation.testing.proportion_test(learners, voting, 0.7, 
     29        randomGenerator=myRandom) 
    3030    printResults(res) 
    3131# End 
     
    3434    print "\nproportionsTest that will give different results each time it is run" 
    3535    for i in range(3): 
    36         res = Orange.evaluation.testing.proportion_test(learners, table, 0.7, 
     36        res = Orange.evaluation.testing.proportion_test(learners, voting, 0.7, 
    3737            randseed=random.randint(0, 100)) 
    3838        printResults(res) 
     
    4040 
    4141print "\nproportionsTest + storing classifiers" 
    42 res = Orange.evaluation.testing.proportion_test(learners, table, 0.7, 100, 
     42res = Orange.evaluation.testing.proportion_test(learners, voting, 0.7, 100, 
    4343    storeClassifiers=1) 
    4444print "#iter %i, #classifiers %i" % \ 
     
    4646 
    4747print "\nGood old 10-fold cross validation" 
    48 res = Orange.evaluation.testing.cross_validation(learners, table) 
     48res = Orange.evaluation.testing.cross_validation(learners, voting) 
    4949printResults(res) 
    5050 
    5151print "\nLearning curve" 
    5252prop = Orange.core.frange(0.2, 1.0, 0.2) 
    53 res = Orange.evaluation.testing.learning_curve_n(learners, table, folds=5, 
     53res = Orange.evaluation.testing.learning_curve_n(learners, voting, folds=5, 
    5454    proportions=prop) 
    5555for i in range(len(prop)): 
     
    5959 
    6060print "\nLearning curve with pre-separated data" 
    61 indices = Orange.core.MakeRandomIndices2(table, p0=0.7) 
    62 train = table.select(indices, 0) 
    63 test = table.select(indices, 1) 
     61indices = Orange.core.MakeRandomIndices2(voting, p0=0.7) 
     62train = voting.select(indices, 0) 
     63test = voting.select(indices, 1) 
    6464res = Orange.evaluation.testing.learning_curve_with_test_data(learners, train, 
    6565    test, times=5, proportions=prop) 
     
    7474 
    7575print "\nLearning and testing on the same data" 
    76 res = Orange.evaluation.testing.learn_and_test_on_learn_data(learners, table) 
     76res = Orange.evaluation.testing.learn_and_test_on_learn_data(learners, voting) 
    7777printResults(res) 
Note: See TracChangeset for help on using the changeset viewer.