title: KMeans Clustering - use created clusters in SVM
body: <p>I'm using KMeans clustering to split data into 2 clusters as follows.</p>
  
  <pre><code>import pandas as pd
  import numpy as np
  import matplotlib.pyplot as plt
  from sklearn import cluster
  ##################################################
  
  # load data
  clm = np.genfromtxt('data.csv',delimiter=',', skiprows=1)
  X = clm[:,(1,12)].astype(float)
  
  # define kmeans learner, then fit with data
  kmeans = cluster.KMeans(n_clusters=2)
  kmeans.fit(X)
  
  # define centroids
  centroids = kmeans.cluster_centers_
  labels = kmeans.labels_
  
  #print(centroids)
  #print(labels)
  
  #set color
  colors = ["g.", "r."]
  
  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)
  
  
  # plot
  plt.scatter(centroids[:,0], centroids[:,1], marker = "x", s=150, linewidth = 5, zorder=10)
  plt.xlabel('Read proportion')
  plt.ylabel('Memory_used_Read')
  plt.xlim(0,100)
  plt.ylim(ymin=0)
  plt.show()
  </code></pre>
  
  <p><a href="https://i.stack.imgur.com/YgcSR.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/YgcSR.png" alt="enter image description here"></a></p>
  
  <p>In KMeans clustering, there is no labeled data for set S=(x,y) while in SVM for set S input x and target data y. What I'm up to do is to use created  clusters separately in SVM. I'm not sure how to get X,y for each cluster. Please let me know if you have any suggestion. </p>
  
  <p>Thanks.</p>