-
Notifications
You must be signed in to change notification settings - Fork 37
ENH - fit intercept in ProxNewton
solver
#77
New issue
< 8000 details-dialog class="Box Box--overlay d-flex flex-column anim-fade-in fast overflow-auto" aria-label="Sign up for GitHub">Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
ENH - fit intercept in ProxNewton
solver
#77
Conversation
here are the benchmark results and the link to repo to reproduce. I have one concern: I cannot explain why we don't have the same initial objective value with Blitz in the case of any thoughts? |
I'd test the output (intercept and coef_) outside of benchopt for these two solvers on the problematic data. Check that both get 0 (but I don't think they should, cf our discussion on alpha_max with intercept) |
The reason behind this is: Blitz performs an intercept update before entering the So nothing surprising in such behavior. |
past_grads = np.zeros(len(ws)) | ||
X_delta_w_ws = np.zeros(X.shape[0]) | ||
w_ws = w_epoch[ws] | ||
ws_intercept = np.append(ws, -1) if fit_intercept else ws |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This line of code if duplicated 4 times in the file.
It feels like it should be factorized, but I do not have a simple solution to do it right now.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM! Really good work @Badr-MOUFAD thanks!
Co-authored-by: PAB <pierreantoine.bannier@gmail.com>
@@ -24,6 +24,9 @@ class ProxNewton(BaseSolver): | |||
tol : float, default 1e-4 | |||
Tolerance for convergence. | |||
|
|||
fit_intercept : bool, default True |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
My experience with sklearn is that it's quite confusing to fit an intercept by default. Should it be set to False here ?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yes agree! But what about #77 (comment)?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Nitpick (this can be discussed later IMO):
This means that it would be set to False
by default in ProxNewton
, and set to True
by default in SparseLogisticRegression
. This might lead to errors in the future
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks for the great work @Badr-MOUFAD , LGTM!
@@ -24,6 +24,9 @@ class ProxNewton(BaseSolver): | |||
tol : float, default 1e-4 | |||
Tolerance for convergence. | |||
|
|||
fit_intercept : bool, default True |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Nitpick (this can be discussed later IMO):
This means that it would be set to False
by default in ProxNewton
, and set to True
by default in SparseLogisticRegression
. This might lead to errors in the future
Thanks @Badr-MOUFAD ! |
This adds unpenalized intercept support to
ProxNewton
solver and closes #68.It proceeds as follows
View benchmark results
Link to benchmark repository