-
-
Notifications
You must be signed in to change notification settings - Fork 25.8k
EFF Speed-up MiniBatchDictionaryLearning by avoiding multiple validation #25490
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
EFF Speed-up MiniBatchDictionaryLearning by avoiding multiple validation #25490
Conversation
I opened an alternative in #25493, which involves a lot less refactoring. |
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.
I think this refactoring can make sense whether or not we merge #25493. WDYT?
Well now that it's done :) |
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.
Nice observation, @jeremiedbb! This LGTM.
I just have one remark. I also think we can merge this PR independently from #25493 as @ogrisel mentioned in #25490 (review) once a changelog entry is added. What do you think?
I added a what's new entry. Yes, let's merge this one first. |
MinibatchDictionaryLearning calls public functions that call public classes themselves. We end up validating the parameters and the input/dict twice per minibatch. When the batch size is large it has barely no impact but for small batch sizes it can be very detrimental.
For instance, here's a profiling result in the extreme case batch_size=1

This PR removes the first one. It's a param validation coming from

sparse_encode
. The profiling now givesthe first block is gone. I intend to deal with the other ones in follow up PRs