Ignore:
Timestamp:
03/15/11 14:57:05 (3 years ago)
Author:
lanz <lan.zagar@…>
Branch:
default
Convert:
a4d5dd3bc47b1cea11932b6f17ec5c28b3b34b4c
Message:

Corrected the (broken) example scripts for kmeans.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • orange/doc/Orange/rst/code/kmeans-silhouette.py

    r7130 r7743  
    1 import orange 
    2 import Orange.cluster 
     1import Orange 
    32 
    4 data = orange.ExampleTable("voting") 
    5 # data = orange.ExampleTable("iris") 
    6 for k in range(2,5): 
    7     km = Orange.cluster.KMeans(data, k, initialization=Orange.cluster.kmeans_init_diversity) 
    8     score = Orange.cluster.score_silhouette(km) 
     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) 
    99    print k, score 
    1010 
    11 km = Orange.cluster.KMeans(data, 3, initialization=Orange.cluster.kmeans_init_diversity) 
    12 Orange.cluster.plot_silhouette(km, "kmeans-silhouette.png") 
     11km = Orange.clustering.kmeans.Clustering(table, 3, initialization=Orange.clustering.kmeans.init_diversity) 
     12Orange.clustering.kmeans.plot_silhouette(km, "kmeans-silhouette.png") 
Note: See TracChangeset for help on using the changeset viewer.