source: orange/docs/reference/rst/code/kmeans-silhouette.py @ 9638:eb3af38491f2

Revision 9638:eb3af38491f2, 479 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
2
3voting = Orange.data.Table("voting")
4# table = Orange.data.Table("iris")
5
6for k in range(2, 8):
7    km = Orange.clustering.kmeans.Clustering(voting, k, initialization=Orange.clustering.kmeans.init_diversity)
8    score = Orange.clustering.kmeans.score_silhouette(km)
9    print k, score
10
11km = Orange.clustering.kmeans.Clustering(voting, 3, initialization=Orange.clustering.kmeans.init_diversity)
12Orange.clustering.kmeans.plot_silhouette(km, "kmeans-silhouette.png")
Note: See TracBrowser for help on using the repository browser.