source: orange/Orange/doc/modules/kmeans-cmp-init.py @ 9671:a7b056375472

Revision 9671:a7b056375472, 699 bytes checked in by anze <anze.staric@…>, 2 years ago (diff)

Moved orange to Orange (part 2)

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.