title: How to get coefficients of multinomial logistic regression?
body: <p>I need to calculate coefficients of a multiple logistic regression using sklearn:</p>
  
  <p>X =</p>
  
  <pre><code>x1          x2          x3   x4         x5    x6
  0.300000    0.100000    0.0  0.0000     0.5   0.0
  0.000000    0.006000    0.0  0.0000     0.2   0.0
  0.010000    0.678000    0.0  0.0000     2.0   0.0
  0.000000    0.333000    1.0  12.3966    0.1   4.0
  0.200000    0.005000    1.0  0.4050     1.0   0.0
  0.000000    0.340000    1.0  15.7025    0.5   0.0
  0.000000    0.440000    1.0  8.2645     0.0   4.0
  0.500000    0.055000    1.0  18.1818    0.0   4.0
  </code></pre>
  
  <p>The values of <code>y</code> are categorical in range [1; 4].</p>
  
  <p>y =</p>
  
  <pre><code>1
  2
  1
  3
  4
  1
  2
  3
  </code></pre>
  
  <p>This is what I do:</p>
  
  <pre><code>import pandas as pd
  from sklearn import linear_modelion
  from sklearn.metrics import mean_squared_error, r2_score
  import numpy as np
  
  h = .02
  
  logreg = linear_model.LogisticRegression(C=1e5)
  
  logreg.fit(X, y)
  
  # print the coefficients
  print(logreg.intercept_)
  print(logreg.coef_)
  </code></pre>
  
  <p>However, I get 6 columns in the output of <code>logreg.intercept_</code> and 6 columns in the output of <code>logreg.coef_</code> How can I get 1 coefficient per feature, e.g. <code>a - f</code> values?</p>
  
  <pre><code>y = a*x1 + b*x2 + c*x3 + d*x4 + e*x5 + f*x6
  </code></pre>
  
  <p>Also, probably I am doing something wrong, because <code>y_pred = logreg.predict(X)</code> gives me the value of <code>1</code> for all rows.</p>