Skip to content
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

ENH use weights in penalties #131

Merged
merged 9 commits into from
Nov 6, 2020
Merged

ENH use weights in penalties #131

merged 9 commits into from
Nov 6, 2020

Conversation

mathurinm
Copy link
Owner

paves the way for non convex solvers solved with MM approachs (MCP, AdaptiveLasso)
also allows finer policies in GroupLasso case

@mathurinm mathurinm force-pushed the weights branch 2 times, most recently from b3a060e to 17cf4f8 Compare June 9, 2020 13:33
@codecov-commenter
Copy link

codecov-commenter commented Jun 10, 2020

Codecov Report

Merging #131 into master will increase coverage by 0.53%.
The diff coverage is 96.96%.

Impacted file tree graph

@@            Coverage Diff             @@
##           master     #131      +/-   ##
==========================================
+ Coverage   79.26%   79.80%   +0.53%     
==========================================
  Files          12       12              
  Lines        1008     1030      +22     
  Branches      147      148       +1     
==========================================
+ Hits          799      822      +23     
+ Misses        168      167       -1     
  Partials       41       41              
Impacted Files Coverage Δ
celer/homotopy.py 87.30% <94.73%> (+1.06%) ⬆️
celer/dropin_sklearn.py 89.20% <100.00%> (+0.07%) ⬆️
celer/tests/test_lasso.py 100.00% <100.00%> (ø)

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update 20a06a4...93e402b. Read the comment docs.

@mathurinm
Copy link
Owner Author

Remains todo: implement weights usage for groups.
Prox Newton solver support should come after #109 has been fixed.

@mathurinm
Copy link
Owner Author

@QB3 this needs a benchmark to check that it does not slow down classic Lasso, but it should be useful for you.

@codecov-io
Copy link

codecov-io commented Nov 6, 2020

Codecov Report

Merging #131 into master will increase coverage by 0.45%.
The diff coverage is 96.96%.

Impacted file tree graph

@@            Coverage Diff             @@
##           master     #131      +/-   ##
==========================================
+ Coverage   84.35%   84.81%   +0.45%     
==========================================
  Files          12       12              
  Lines         959      981      +22     
  Branches      136      137       +1     
==========================================
+ Hits          809      832      +23     
+ Misses        109      108       -1     
  Partials       41       41              
Impacted Files Coverage Δ
celer/homotopy.py 87.30% <94.73%> (+1.06%) ⬆️
celer/dropin_sklearn.py 96.42% <100.00%> (+0.02%) ⬆️
celer/tests/test_lasso.py 100.00% <100.00%> (ø)

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update 1783b7c...f168e29. Read the comment docs.

@mathurinm
Copy link
Owner Author

This PR:

In [1]: import numpy as np

In [2]: from libsvmdata import fetch_libsvm

In [3]: from celer import Lasso

In [4]: X, y = fetch_libsvm("news20")
Dataset: news20

In [5]: alpha = np.linalg.norm(X.T @ y, ord=np.inf) / len(y) / 100

In [6]: %timeit -n 1 -r 15 clf = Lasso(alpha=alpha).fit(X, y)
6.38 s ± 240 ms per loop (mean ± std. dev. of 15 runs, 1 loop each)

Master:

In [1]: import numpy as np

In [2]: from libsvmdata import fetch_libsvm

In [3]: from celer import Lasso

In [4]: X, y = fetch_libsvm("news20")
Dataset: news20

In [5]: alpha = np.linalg.norm(X.T @ y, ord=np.inf) / len(y) / 100

In [6]: %timeit -n 1 -r 15 clf = Lasso(alpha=alpha).fit(X, y)
6.38 s ± 68.9 ms per loop (mean ± std. dev. of 15 runs, 1 loop each)

There should be a way to automate this on every PR

@mathurinm mathurinm changed the title WIP: use weights in penalties ENH use weights in penalties Nov 6, 2020
@mathurinm mathurinm merged commit 76090e0 into master Nov 6, 2020
@mathurinm mathurinm deleted the weights branch November 10, 2020 09:49
This pull request was closed.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants