source: orange/docs/reference/rst/code/knnExample1.py @ 9372:aef193695ea9

Revision 9372:aef193695ea9, 323 bytes checked in by mitar, 2 years ago (diff)

Moved documentation to the separate directory.

Line 
1import Orange
2table = Orange.data.Table("iris")
3
4rndind = Orange.core.MakeRandomIndices2(table, p0=0.8)
5train = table.select(rndind, 0)
6test = table.select(rndind, 1)
7
8knn = Orange.classification.knn.kNNLearner(train, k=10)
9for i in range(5):
10    instance = test.randomexample()
11    print instance.getclass(), knn(instance)
Note: See TracBrowser for help on using the repository browser.