In [14]:
from sklearn.linear_model import LogisticRegression


LR = LogisticRegression()
LR.fit(X_train, y.reshape((y.shape[0],))) # it is preferable to use y of this shape
print('Ceoficients of LogisticRegression from sklearn are in (%i,%i) dimensional matrix' %LR.coef_.shape)
w1_skl= LR.coef_[0,0]
w2_skl= LR.coef_[0,1]
b_skl = LR.intercept_


print('w1 = %f'%w1_skl)
print('w2 = %f'%w2_skl)
print('b = %f'%b_skl)
print(cm_log_reg)
Ceoficients of LogisticRegression from sklearn are in (1,2) dimensional matrix
w1 = -1.533146
w2 = -1.721702
b = -6.441244
[[498   2]
 [  1 499]]