()
| 13 | |
| 14 | |
| 15 | def main(): |
| 16 | X = get_simple_data() |
| 17 | |
| 18 | plt.scatter(X[:,0], X[:,1]) |
| 19 | plt.show() |
| 20 | |
| 21 | costs = np.empty(10) |
| 22 | costs[0] = None |
| 23 | for k in range(1, 10): |
| 24 | M, R = plot_k_means(X, k, show_plots=False) |
| 25 | c = cost(X, R, M) |
| 26 | costs[k] = c |
| 27 | |
| 28 | plt.plot(costs) |
| 29 | plt.title("Cost vs K") |
| 30 | plt.show() |
| 31 | |
| 32 | |
| 33 | if __name__ == '__main__': |
no test coverage detected