def main(): X = create_sample_data() plt.scatter(X[:, 0], X[:, 1]) plt.show() costs = np.empty(10) costs[0] = None for k in range(1, 10): M, R = plot_k_means(X, k, show_plots=False) costs[k] = cost(X, R, M) plt.plot(costs) plt.title("Cost vs K") plt.show()
def main(): X = get_simple_data() plt.scatter(X[:,0], X[:,1]) plt.show() costs = np.empty(10) costs[0] = None for k in range(1, 10): M, R = plot_k_means(X, k, show_plots=False) c = cost(X, R, M) costs[k] = c plt.plot(costs) plt.title("Cost vs K") plt.show()
>>>>>>> upstream/master import numpy as np import matplotlib.pyplot as plt from kmeans import plot_k_means, get_simple_data, cost def main(): X = get_simple_data() plt.scatter(X[:,0], X[:,1]) plt.show() costs = np.empty(10) costs[0] = None <<<<<<< HEAD for k in xrange(1, 10): ======= for k in range(1, 10): >>>>>>> upstream/master M, R = plot_k_means(X, k, show_plots=False) c = cost(X, R, M) costs[k] = c plt.plot(costs) plt.title("Cost vs K") plt.show() if __name__ == '__main__': main()