-
-
Notifications
You must be signed in to change notification settings - Fork 26.1k
ENH speedup enet_coordinate_descent_gram #31880
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
* safe one call of _axpy in inner loop
BenchmarkingSee notebook in 8022fc6 (link to notebook) gives timings ![]() Results as numbers: columns: timing, value objective function, mean(|coef - optimal_coef|)
Also very interesting, within the debug/profiling commit - indented lines add up to the next unindented line below: X, y = make_regression(
n_samples=50_000, n_features=1000, noise=0.1, n_informative=100, random_state=seed
)
X = np.asfortranarray(X)
%time ElasticNet(alpha=0.19, l1_ratio=l1_ratio, precompute=True, verbose=1).fit(X, y);
and %time ElasticNet(alpha=0.19, l1_ratio=l1_ratio, precompute=False, verbose=1).fit(X, y);
|
This reverts commit 8022fc6.
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. Thank you @lorentzenchr
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.
Irrespective of the performance improvement, I like the more readable code of the diff.
doc/whats_new/upcoming_changes/sklearn.linear_model/31880.enhancement.rst
Outdated
Show resolved
Hide resolved
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.
Looks good. Thank you for the updates @lorentzenchr
Reference Issues/PRs
None
What does this implement/fix? Explain your changes.
This PR speeds up
enet_coordinate_descent_gram
by saving one call of_axpy
(BLAS level 1) in the inner loop.Any other comments?
Benchmarking is tricky because the bottleneck is usually the data preprocessing (like validating, i.e. copying, and centering of X and y).