source: orange/docs/reference/rst/code/knnExample1.py @ 9638:eb3af38491f2

Revision 9638:eb3af38491f2, 319 bytes checked in by umek@…, 2 years ago (diff)

Changed table to data or name of the data set.

For example - instead of

table = Orange.data.Table("housing")

is changed to

housing = Orange.data.Table("housing")

Line 
1import Orange
2iris = Orange.data.Table("iris")
3
4rndind = Orange.core.MakeRandomIndices2(iris, p0=0.8)
5train = iris.select(rndind, 0)
6test = iris.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.