MLhacker - 7 months ago 49

Python Question

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

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.

Source (Stackoverflow)