|
|
@ -8,7 +8,7 @@ import matplotlib.pyplot as plt |
|
|
|
from scipy.spatial import ConvexHull |
|
|
|
from scipy.spatial import ConvexHull |
|
|
|
from scipy.spatial.qhull import QhullError |
|
|
|
from scipy.spatial.qhull import QhullError |
|
|
|
|
|
|
|
|
|
|
|
from kmeans.algorithms import unweighted_k_means |
|
|
|
from kmeans.algorithms import k_means |
|
|
|
from kmeans.clustering.cluster import Cluster |
|
|
|
from kmeans.clustering.cluster import Cluster |
|
|
|
from kmeans.clustering.point import Point |
|
|
|
from kmeans.clustering.point import Point |
|
|
|
|
|
|
|
|
|
|
@ -69,7 +69,7 @@ def main(): |
|
|
|
plt.plot(xs, ys, 'o') |
|
|
|
plt.plot(xs, ys, 'o') |
|
|
|
plt.show() |
|
|
|
plt.show() |
|
|
|
|
|
|
|
|
|
|
|
clusters = unweighted_k_means(points, 4, 0.001) |
|
|
|
clusters = k_means(points, 4, 0.001) |
|
|
|
|
|
|
|
|
|
|
|
# Color clusters |
|
|
|
# Color clusters |
|
|
|
assigned_colors = plt.cm.gist_ncar(np.linspace(0, 1, 4)) |
|
|
|
assigned_colors = plt.cm.gist_ncar(np.linspace(0, 1, 4)) |
|
|
|