source: orange/orange/doc/Orange/rst/code/kmeans-silhouette.py @ 7743:5277d8c12ca8

Revision 7743:5277d8c12ca8, 476 bytes checked in by lanz <lan.zagar@…>, 3 years ago (diff)

Corrected the (broken) example scripts for kmeans.

Line 
1import Orange
2
3table = Orange.data.Table("voting")
4# table = Orange.data.Table("iris")
5
6for k in range(2, 8):
7    km = Orange.clustering.kmeans.Clustering(table, 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(table, 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.