Ignore:
Timestamp:
02/07/12 19:59:36 (2 years ago)
Author:
markotoplak
Branch:
default
Message:

Updated examples (remove Orange.core).

File:
1 edited

Legend:

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

    r9823 r9946  
    99 
    1010print "Testing using euclidean distance" 
    11 rndind = Orange.core.MakeRandomIndices2(iris, p0=0.8) 
     11rndind = Orange.data.sample.SubsetIndices2(iris, p0=0.8) 
    1212train = iris.select(rndind, 0) 
    1313test = iris.select(rndind, 1) 
     
    1515knn = Orange.classification.knn.kNNLearner(train, k=10) 
    1616for i in range(5): 
    17     instance = test.randomexample() 
     17    instance = test.random_example() 
    1818    print instance.getclass(), knn(instance) 
    1919 
     
    2323knn = Orange.classification.knn.kNNLearner() 
    2424knn.k = 10 
    25 knn.distanceConstructor = Orange.core.ExamplesDistanceConstructor_Hamming() 
     25knn.distance_constructor = Orange.distance.Hamming() 
    2626knn = knn(train) 
    2727for i in range(5): 
    28     instance = test.randomexample() 
     28    instance = test.random_example() 
    2929    print instance.getclass(), knn(instance) 
Note: See TracChangeset for help on using the changeset viewer.