-
-
Notifications
You must be signed in to change notification settings - Fork 25.9k
[MRG] Change the default of precompute from "auto" to False #3249
New issue
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
Conversation
Based on the benchmarks done in the parent PR it appears that with the current state of the code base, the precomputation of the Gram matrix can never be used to accelerate the solver of The As the If |
BTW, I don't think this specific PR is a priority for the GSoC but of course you can decide about that with your mentors. |
and test with many y are provided so the gram is computed once for many independent targets +1 for not being a priority for the GSOC. It needs to be addressed but no rush. the log reg is more important now. |
The log reg CV is almost done. I just need to add a few more tests. |
@ogrisel @agramfort I am facing some issues which is blocking this PR, #3719 . It slows down the setting |
what are you suggesting? we merge this and have a regression in master |
this PR can stay as it is. No rush. You can integrate the changes one you've made enough progress with the other PR. |
@agramfort I'm sorry for not bring clear. The point is that, the benchmarks that I have reported in the description of the #3719 are when I set To summarize I do not want to use the Gram trick, when precompute is set to "auto" and |
glmnet does the gram trick so how does it do it? it says it precomputes the |
Are you referring to these papers? http://web.stanford.edu/~hastie/glmnet/glmnet_alpha.html I did a quick skim, and a Ctrl + F for Anyhow I am not asking to remove |
look type.gaussian |
Sorry for being a noob, but it states that the inner products are being cached in the form of a covariance matrix (if at all done), instead of doing a run across Don't the intelligent updates in the existing |
@agramfort It does seem that
So I suggest we could just remove the "auto" option for ENet models and keep it for the CV models, since it is hugely beneficial. |
In other words, This comment by you, #3220 (comment) |
fine with setting it to False in Lasso and ElasticNet and only auto in CV classes. make sure it does not affect performance of dict learning classes. |
d3c82f6
to
0667e44
Compare
@agramfort @ogrisel Can you review this now? Have I done the deprecation right? |
995640d
to
9904a04
Compare
Setting precompute to "auto" was found to be slower when n_samples > n_features since the computation of the Gram matrix is computationally expensive and outweighs the benefit of fitting the Gram for just one alpha.
any test that should be updated too? I suspect some now raise warnings. |
@agramfort It does seem that precompute="auto", was never tested explicitly, since it was the default before. I've added a test to test for Deprecation warnings in the last commit. Let me know if its ok. |
y = np.asarray(y, dtype=np.float64) | ||
|
||
if self.precompute == 'auto': | ||
warnings.warn("Setting precompute to 'auto', has found to be " |
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.
has -> was
can you also have a look at OrthogonalMatchingPursuit as suggested by @ogrisel ? |
I will, but it is better to keep both PR's independent, don't you think? |
Do it here please |
I played with this examples for different values of |
can you share the updated graphs from the lasso and omp bencharks: |
@@ -1207,6 +1217,7 @@ def fit(self, X, y): | |||
model.alpha = best_alpha | |||
model.l1_ratio = best_l1_ratio | |||
model.copy_X = copy_X | |||
model.precompute = False |
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.
why not model.precompute = self.precompute
?
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 is the last fit.
- There might be a case where
self.precompute="auto"
, and we have deprecated it. - If
self.precompute=True
and we setmodel.precompute=True
, I think we might be going against our principle of believing that computing the Gram, is useless for doing a single fit.
This is basically to make the last fit as fast as possible.
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.
ok got it.
merged by rebase. Thanks ! |
this PR next? ;) #3719 |
The Gram variant has been found to be slower, then the normal update rules. See the discussion in #3220 . So the default is changed from "auto" to False.