title: Finding Accuracy for this K-Means model
body: <p>This program predicts the cluster to which the coordinates belong to, where it divides the given points into two clusters 0 and 1.
  How do I get the accuracy of this model for the variable - prediction</p>
  
  <pre><code>import numpy as np  
  import matplotlib.pyplot as plt  
  from sklearn.cluster import KMeans  
  #from sklearn.metrics import accuracy_score  
  X = np.array([[1, 2],[5, 8],[1.5, 1.8],[8, 8],[6,7],[9, 11]])  
  print(X)  
  kmeans = KMeans(n_clusters=2)  
  kmeans.fit(X)  
  centroids = kmeans.cluster_centers_  
  labels = kmeans.labels_  
  print("Centroids :\n ",centroids)  
  print("Labels    : ",labels)  
  colors = ["g.","r.","c.","y."]  
  for i in range(len(X)):  
  print("coordinate:",X[i], "label:", labels[i])  
  plt.plot(X[i][0], X[i][1], colors[labels[i]], markersize = 10)  
  plt.scatter(centroids[:, 0],centroids[:, 1], marker = "x", s=150, linewidths 
  = 5, zorder = 10)  
  plt.show() 
  prediction=kmeans.predict ( [ [ 5,6 ] ] )   
  print(prediction)  
  </code></pre>