source: orange/Orange/testing/regression/tests_20/modules_kmeans-cmp-init.py @ 9957:4ba6c6d1bb61

Revision 9957:4ba6c6d1bb61, 705 bytes checked in by Miha Stajdohar <miha.stajdohar@…>, 2 years ago (diff)

Moved also required datasets.

Line 
1import orange
2import orngClustering
3import random
4
5data_names = ["iris.tab", "housing.tab", "vehicle.tab"]
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.