title: scikit-learn svm module and predict function not working
body: <p>I am trying to get an SVM to work using scikit-learn but cannot get the results I am expecting. I would like to use k-means to classify roughly 2-5 data clusters and then use an SVM to build a model for that data, for which I can use newer data to predict/classify on the fly. This did not work for me, so I tried manually giving the labels, 500 samples with 3 classified data clusters, to the SVM. I always get the same predicted value of '1' no matter what random data I try to have the SVM predict. What in tarnation is going on....</p>
  
  <pre><code># Attempting 3 clusters: 500 training samples in asarray (x-y coordinate data)
  clf = svm.SVC(kernel = 'rbf', C=1, gamma = 1)
  clf.fit(asarray,labels)
  realData = [[-0.005, -0.01], [-0.005, -0.024], [-0.0075, -0.01], [-0.007, -0.008]]
  print(clf.predict(realData))
  
  # output: [1 1 1 1]
  </code></pre>
  
  <p>Please keep in mind this... I only have a couple weeks-worth of experience with python and still only have a general knowledge basis for many machine learning topics.</p>
  
  <p>EDIT: Sample data sets for asarray &amp; labels</p>
  
  <p>asarray:</p>
  
  <pre><code> [[-0.001, -0.008]
   [-0.0055, -0.0236]
   [-0.007, -0.0221]
   ... 
   [-0.008, -0.01]
   [-0.0062, -0.015]
   [-0.0025, -0.009]]
  </code></pre>
  
  <p>labels:</p>
  
  <pre><code>[0 2 2 ... 1 1 0]
  </code></pre>
  
  <p>I did not want to list all 500 data elements, so I wrote out a very similar sample instead.</p>