MCPcopy Create free account
hub / github.com/subbarayudu-j/TheAlgorithms-Python / plot_heterogeneity

Function plot_heterogeneity

machine_learning/k_means_clust.py:115–122  ·  view source on GitHub ↗
(heterogeneity, k)

Source from the content-addressed store, hash-verified

113
114from matplotlib import pyplot as plt
115def plot_heterogeneity(heterogeneity, k):
116 plt.figure(figsize=(7,4))
117 plt.plot(heterogeneity, linewidth=4)
118 plt.xlabel('# Iterations')
119 plt.ylabel('Heterogeneity')
120 plt.title('Heterogeneity of clustering over time, K={0:d}'.format(k))
121 plt.rcParams.update({'font.size': 16})
122 plt.show()
123
124def kmeans(data, k, initial_centroids, maxiter=500, record_heterogeneity=None, verbose=False):
125 '''This function runs k-means on given data and initial set of centroids.

Callers 1

k_means_clust.pyFile · 0.85

Calls 2

updateMethod · 0.45
showMethod · 0.45

Tested by

no test coverage detected