()
| 33 | |
| 34 | |
| 35 | def 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 |
no test coverage detected