source: orange/orange/doc/modules/kmeans-cmp-init.py @ 5785:54b78237372d

Revision 5785:54b78237372d, 699 bytes checked in by blaz <blaz.zupan@…>, 5 years ago (diff)

an example script that goes with orngClustering documentation

Line 
1import orange
2import orngClustering
3import random
4
5data_names = ["iris", "housing", "vehicle"]
6data_sets = [orange.ExampleTable(name) for name in data_names]
7
8print "%10s %3s %3s %3s" % ("", "Rnd", "Div", "HC")
9for data, name in zip(data_sets, data_names):
10    random.seed(42)
11    km_random = orngClustering.KMeans(data, centroids = 3)
12    km_diversity = orngClustering.KMeans(data, centroids = 3, \
13        initialization=orngClustering.kmeans_init_diversity)
14    km_hc = orngClustering.KMeans(data, centroids = 3, \
15        initialization=orngClustering.KMeans_init_hierarchicalClustering(n=100))
16    print "%10s %3d %3d %3d" % (name, km_random.iteration, km_diversity.iteration, km_hc.iteration)
Note: See TracBrowser for help on using the repository browser.