title: Get most informative features from very simple scikit-learn SVM classifier
body: <p>I tried to build the a very simple SVM predictor that I would understand with my basic python knowledge. As my code looks so different from this <a href="https://stackoverflow.com/questions/30017491/problems-obtaining-most-informative-features-with-scikit-learn">question</a> and also this <a href="https://stackoverflow.com/questions/11116697/how-to-get-most-informative-features-for-scikit-learn-classifiers">question</a> I don't know how I can find the most important features for SVM prediction in my example.</p>
  
  <p>I have the following 'sample' containing features and class (status):</p>
  
  <pre><code>A B C D E F  status
  1 5 2 5 1 3  1
  1 2 3 2 2 1  0
  3 4 2 3 5 1  1
  1 2 2 1 1 4  0
  </code></pre>
  
  <p>I saved the feature names as 'features':  </p>
  
  <pre><code>A B C D E F
  </code></pre>
  
  <p>The features 'X':</p>
  
  <pre><code>1 5 2 5 1 3  
  1 2 3 2 2 1 
  3 4 2 3 5 1  
  1 2 2 1 1 4  
  </code></pre>
  
  <p>And the status 'y':</p>
  
  <pre><code>1
  0
  1
  0
  </code></pre>
  
  <p>Then I build X and y arrays out of the sample, train &amp; test on half of the sample and count the correct predictions.</p>
  
  <pre><code>import pandas as pd
  import numpy as np
  from sklearn import svm
  
  X = np.array(sample[features].values)
  X = preprocessing.scale(X)    
  X = np.array(X)
  y = sample['status'].values.tolist()
  y = np.array(y)
  
  test_size = int(X.shape[0]/2)
  
  clf = svm.SVC(kernel="linear", C= 1)
  clf.fit(X[:-test_size],y[:-test_size])
  
  correct_count = 0   
  
  for x in range(1, test_size+1):
      if clf.predict(X[-x].reshape(-1, len(features)))[0] == y[-x]:
          correct_count += 1
  accuracy = (float(correct_count)/test_size) * 100.00
  </code></pre>
  
  <p>My problem is now, that I have no idea, how I could implement the code from the questions above so that I could also see, which ones are the most important features.</p>
  
  <p>I would be grateful if you could tell me, if that's even possible for my simple version? And if yes, any tipps on how to do it would be great.</p>