<commit_before>import kmeans
import random
import matplotlib.pyplot as plt


dataset = [(random.randint(0, 1000), random.randint(0, 1000)) for _ in range(200)]
k = 5
clustering, centroids = kmeans.lloyds_algorithm(dataset, k)
plt.plot([x[0] for x in dataset], [x[1] for x in dataset], 'ro', [c[0] for c in centroids], [c[1] for c in centroids], 'bo')
plt.show()<commit_msg>generate sample data so clusters will be more visible<commit_after>import kmeans
import random
import matplotlib.pyplot as plt


dataset = [(random.randint(0, 100), random.randint(0, 100)) for _ in range(20)] + \
[(random.randint(100, 200), random.randint(100, 200)) for _ in range(20)] + \
[(random.randint(200, 300), random.randint(200, 300)) for _ in range(20)] + \
[(random.randint(300, 400), random.randint(300, 400)) for _ in range(20)] + \
[(random.randint(400, 500), random.randint(400, 500)) for _ in range(20)]

k = 5
clustering, centroids = kmeans.lloyds_algorithm(dataset, k)
plt.plot([x[0] for x in dataset], [x[1] for x in dataset], 'ro', [c[0] for c in centroids], [c[1] for c in centroids], 'bo')
plt.show()
{'fraction_non_alphanumeric': 0.1678832116788321, 'fraction_numerical': 0.0812043795620438, 'mean_word_length': 5.304597701149425, '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': '3323694', 'n_tokens_mistral': 473, 'n_tokens_neox': 403, 'n_words': 125}