<commit_before>#! /usr/bin/env python
#-*- coding: utf-8 -*-

import clusters

K = 7

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

coords = clusters.scaledown(data)

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

<commit_msg>Better results with Pearson.<commit_after>#! /usr/bin/env python
#-*- coding: utf-8 -*-

import clusters

K = 7

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

coords = clusters.scaledown(data)

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


{'fraction_non_alphanumeric': 0.15765247410817032, 'fraction_numerical': 0.006904487917146145, 'mean_word_length': 4.2727272727272725, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 3, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '5539756', 'n_tokens_mistral': 323, 'n_tokens_neox': 317, 'n_words': 77}