aboutsummaryrefslogtreecommitdiff
path: root/source/testclusters.py
blob: 0e1e2a3225c2c187a0130475c5b8dd686509a7b9 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
# -*- coding: utf-8 -*-

import clusters

K = 10

blognames,labels,data = clusters.readfile("blogdata1.txt")

#coords = clusters.scaledown(data)

print "Generating clusters..."
kclust = clusters.kcluster(data, k=K)
print
print "Clusters:"
for i in range(K):
    print "Cluster" + str(i)
    print ", ".join([blognames[r] for r in kclust[i]])
    print




#clusters.draw2d(coords,blognames,jpeg='mds2d.jpg')
bgstack15