Scikit Learn: Logistic Regression model coefficients: Clarification
take a look at the documentations (http://scikit-learn.org/stable/modules/generated/sklearn.linear_model.LogisticRegression.html), offset coefficient isn't stored by lr.coef_
coef_ array, shape = [n_classes-1, n_features] Coefficient of the features in the decision function. coef_ is readonly property derived from raw_coef_ that follows the internal memory layout of liblinear. intercept_ array, shape = [n_classes-1] Intercept (a.k.a. bias) added to the decision function. It is available only when parameter intercept is set to True.
try:
sigmoid( dot([val1, val2], lr.coef_) + lr.intercept_ )
The easiest way is by calling coef_
attribute of LR classifier:
Definition of coef_
please check Scikit-Learn document:
See example:
from sklearn.linear_model import LogisticRegressionclf = LogisticRegression() clf.fit(x_train,y_train) weight = classifier.coef_