David Ojeda
2016-03-15 09:03:07 UTC
Hello scikit-learners,
A while back, I used this wonderful library to replicate some work that was
done previously on R. I really liked the design of this library; kudos!
I mainly used a LogisticRegression with L1 regularization, but I ran into
some problems when trying to understand why my results were slightly
different. In fact, I found out that scikit-learn does not regularize as
advertised in the user guide (cf.
http://scikit-learn.org/stable/modules/linear_model.html#logistic-regression).
Here, it is said that the objective function is C * (the entropy part) +
||w||_1, which is the L1 norm of the weight vector. In this formula, the
intercept c is not regularized. However, the internal code of scikit-learn
does ||W||_1 where W is [w0,...,wn,c]. In other words, c is regularized.
I have two questions regarding this:
1. Does anyone know the effect of regularizing the intercept? To me, it
doesn't seem entirely correct.
2. Shouldn't the user guide show the correct formula ?
Have a nice day...
David
A while back, I used this wonderful library to replicate some work that was
done previously on R. I really liked the design of this library; kudos!
I mainly used a LogisticRegression with L1 regularization, but I ran into
some problems when trying to understand why my results were slightly
different. In fact, I found out that scikit-learn does not regularize as
advertised in the user guide (cf.
http://scikit-learn.org/stable/modules/linear_model.html#logistic-regression).
Here, it is said that the objective function is C * (the entropy part) +
||w||_1, which is the L1 norm of the weight vector. In this formula, the
intercept c is not regularized. However, the internal code of scikit-learn
does ||W||_1 where W is [w0,...,wn,c]. In other words, c is regularized.
I have two questions regarding this:
1. Does anyone know the effect of regularizing the intercept? To me, it
doesn't seem entirely correct.
2. Shouldn't the user guide show the correct formula ?
Have a nice day...
David