source: orange/Orange/testing/regression/tests_20/modules_kmeans-cmp-init.py @ 9952:986e9cd806f4

Revision 9952:986e9cd806f4, 699 bytes checked in by Miha Stajdohar <miha.stajdohar@…>, 2 years ago (diff)

Tests moved and renamed from orange 20.

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.