-
Notifications
You must be signed in to change notification settings - Fork 36
/
main.py
32 lines (25 loc) · 863 Bytes
/
main.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
import numpy as np
from cluster import (
KMeans,
Silhouette,
make_clusters,
plot_clusters,
plot_multipanel)
def main():
# create tight clusters
clusters, labels = make_clusters(scale=0.3)
plot_clusters(clusters, labels, filename="figures/tight_clusters.png")
# create loose clusters
clusters, labels = make_clusters(scale=2)
plot_clusters(clusters, labels, filename="figures/loose_clusters.png")
"""
uncomment this section once you are ready to visualize your kmeans + silhouette implementation
"""
# clusters, labels = make_clusters(k=4, scale=1)
# km = KMeans(k=4)
# km.fit(clusters)
# pred = km.predict(clusters)
# scores = Silhouette().score(clusters, pred)
# plot_multipanel(clusters, labels, pred, scores)
if __name__ == "__main__":
main()