MCPcopy Create free account
hub / github.com/lazyprogrammer/machine_learning_examples / main

Function main

unsupervised_class/kmeans_fail.py:35–50  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

33
34
35def main():
36 # donut
37 X = donut()
38 plot_k_means(X, 2, beta=0.1, show_plots=True)
39
40 # elongated clusters
41 X = np.zeros((1000, 2))
42 X[:500,:] = np.random.multivariate_normal([0, 0], [[1, 0], [0, 20]], 500)
43 X[500:,:] = np.random.multivariate_normal([5, 0], [[1, 0], [0, 20]], 500)
44 plot_k_means(X, 2, beta=0.1, show_plots=True)
45
46 # different density
47 X = np.zeros((1000, 2))
48 X[:950,:] = np.array([0,0]) + np.random.randn(950, 2)
49 X[950:,:] = np.array([3,0]) + np.random.randn(50, 2)
50 plot_k_means(X, 2, show_plots=True)
51
52
53

Callers 1

kmeans_fail.pyFile · 0.70

Calls 2

plot_k_meansFunction · 0.90
donutFunction · 0.70

Tested by

no test coverage detected