MLhacker MLhacker - 1 year ago 84
Python Question

Does Sklearn.LogisticRegression add a column of 1?

I have been told that when dealing with multivariate logistic regression, you want to add a column of 1's in the X matrix for the model intercept. When using the model from sklearn, does the module automatically add the column of 1?

Answer Source

The LinearRegression module has a fit_intercept parameter. If you set that to True it will fit the intercept and so will add a column of zeros. If you set it to False it will not. More information is available in the API docs.

Recommended from our users: Dynamic Network Monitoring from WhatsUp Gold from IPSwitch. Free Download