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

Revision 9638:eb3af38491f2, 297 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
4knn = Orange.classification.knn.kNNLearner()
5knn.k = 10
6knn.distance_constructor = Orange.core.ExamplesDistanceConstructor_Hamming()
7knn = knn(iris)
8for i in range(5):
9    instance = iris.randomexample()
10    print instance.getclass(), knn(instance)
Note: See TracBrowser for help on using the repository browser.