title: Scikit-learn returning incorrect classification report and accuracy score
body: <p>I'm training an SVM on 1200 examples of label 2 and 1200 examples of label 1 with an RBF kernel. I thought I was getting 77% accuracy, and I was getting accuracy using <code>sklearn.metrics.accuracy_score</code>. But when I hand-rolled my own precision score, like so:</p>
  
  <pre><code>def naive_accuracy(true, pred):
      number_correct = 0
      i = 0
      for y in true:
          if pred[i] == y:
              number_correct += 1.0
      return number_correct / len(true)
  </code></pre>
  
  <p>It got 50%. I believe I've wasted weeks of work based on a false accuracy score and classification report. Can anyone supply me with an explanation for why this has happened? I'm very, very confused as to how this could have happened. I don't see what I'm doing wrong. And when I tested the metrics.accuracy_score function on some dummy data like <code>pred = [1, 1, 2, 2];</code> <code>test = [1, 2, 1, 2]</code>, and it gave me 50% like you'd expect. I think accuracy_score might be erring due to my specific data somehow.</p>
  
  <p>I have 27-feature vectors and 1200 vectors of class 1 and 1200 vectors of class 2. My code is the following:</p>
  
  <pre><code>X = scale(np.asarray(X))
  y = np.asarray(y)
  X_train, X_test, y_train, y_test = train_test_split(X, y)
  
  ######## SVM ########
  clf = svm.SVC()
  clf.fit(X_train, y_train)
  y_pred = clf.predict(X_test)
  # 77%
  print "SVM Accuracy:", accuracy_score(y_test, y_pred) # debugging
  # 50%
  print "*True* SVM Accuracy:", naive_accuracy(y_test, y_pred) # in-house debugging
  # also 77%!
  print "Classification report:\n", classification_report(y_test, y_pred) # debugging
  </code></pre>