title: Logistic Regression - Model accuracy score and prediction do not tally
body: <p>A very simple scikit-learn logistic regression model was created for a binary classification task.
  Train and test set was split.
  Random forest model and decision tree using the same data set gives about 0.9 accuracy.</p>
  <p>Here is the logistic regression model:</p>
  <pre><code>logreg_model = LogisticRegression(random_state=99).fit(X_train, y_train)
  logreg_acc = logreg_model.score(X_test, y_test)
  logreg_pred = logreg_model.predict(X_test) 
  print(&quot;Log reg model accuracy:&quot;, logreg_acc)
  print(&quot;Log reg prediction:&quot;, logreg_pred)
  print(&quot;Actual:&quot;,y_test)
  </code></pre>
  <p>Here are the results:</p>
  <pre><code>Log reg model accuracy: 0.8701298701298701
  Log reg prediction: [0 1 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0
   0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0
   0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0
   0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0
   0 0 0 0 0 0]
  Actual: [1 0 0 0 0 0 0 0 0 0 0 0 0 0 0 1 1 0 0 0 0 0 0 0 0 0 0 0 1 0 0 0 0 0 0 0 0
   0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 1 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 1 0
   0 0 0 0 0 0 0 0 0 1 0 0 0 1 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0
   0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0
   0 0 1 0 0 0]
  </code></pre>
  <p>How can the accuracy be 0.87 while the prediction got all of the classifications wrong?
  What are the bugs here?
  What am I missing?</p>
  <p>Thank you.</p>