title: Inverse of prediction is correct in Scikit Learn Logistic Legression
body: <p>In the following minimal reproducible dataset, I split a dataset into train and test dataset, fit a logistic regression to the training dataset with scikit learn and predict y based on the <code>x_test</code>.</p>
  
  <p>However the <code>y_pred</code> or y predictions, are correct only if inversed (e.g 0 = 1, and 1 = 0) calculated like so: <code>1 - y_pred</code>. 
  Why is this the case? I cant figure out if it is something relating to the scaling of x (I have tried with and without the <code>StandardScaler</code>), something related to the logistic regression, or the accuacy score calculation. </p>
  
  <p>In my larger dataset, this is also the case even when using different seeds as random state. I have also tried <a href="https://medium.com/@martinpella/logistic-regression-from-scratch-in-python-124c5636b8ac" rel="nofollow noreferrer">this Logistic Regression</a> with the same result.</p>
  
  <p><strong>EDIT</strong> as pointed out by @Nester it works without standard scaler for this minimal dataset. Larger dataset avaliable <a href="https://pastebin.com/SmdVnuWS" rel="nofollow noreferrer">here</a>, <code>standardScaler</code> does nothing on this larger dataset, I'll keep the OP smaller dataset as it might help in explaining the problem. </p>
  
  <pre><code># imports
  from sklearn.linear_model import LogisticRegression
  from sklearn.model_selection import train_test_split
  from sklearn.pipeline import make_pipeline
  from sklearn.metrics import accuracy_score
  from sklearn.preprocessing import StandardScaler
  
  # small dataset
  Y = [1, 0, 0, 0, 0, 1, 0, 1, 1, 0, 0, 0, 1, 1, 1, 0, 1, 1, 0]
  X =[[0.38373581],[0.56824121],[0.39078066],[0.41532221],[0.3996311 ]
      ,[0.3455455 ],[0.55867358],[0.51977073],[0.51937625],[0.48718916]
      ,[0.37019272],[0.49478954],[0.37277804],[0.6108499 ],[0.39718093]
      ,[0.33776591],[0.36384773],[0.50663667],[0.3247984 ]]
  
  
  x_train, x_test, y_train, y_test = train_test_split(X, Y, test_size=0.15, random_state=42, stratify=Y)
  clf = make_pipeline(StandardScaler(), LogisticRegression())
  clf.fit(x_train, y_train)
  y_pred = clf.predict(x_test)
  
  y_pred = 1 - y_pred #          &lt;- why?
  
  accuracy_score(y_test,y_pred)
  1.0
  </code></pre>
  
  <p>Larger dataset accuracy: </p>
  
  <pre><code>accuracy_score(y_test,y_pred)
  0.7  # if inversed
  </code></pre>
  
  <p>thanks for reading</p>