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 - Add Pinball datafit #134

Merged
merged 31 commits into from
Dec 9, 2022
Merged
Changes from 1 commit
Commits
Show all changes
31 commits
Select commit Hold shift + click to select a range
413ef54
remove sqrt n_samples
Badr-MOUFAD Nov 30, 2022
2ef5eb7
update unittest
Badr-MOUFAD Nov 30, 2022
5c0bedc
info comment statsmodels
Badr-MOUFAD Dec 1, 2022
ca6ece7
add prox subdiff to sqrt df
Badr-MOUFAD Dec 1, 2022
a6303e5
implement ``PDCD_WS``
Badr-MOUFAD Dec 1, 2022
e8fcee3
r sqrt_n from CB
Badr-MOUFAD Dec 1, 2022
339e98f
Merge branch 'r-sqrt-n' of https://github.com/Badr-MOUFAD/skglm into …
Badr-MOUFAD Dec 1, 2022
19a0ea9
bug w and subdiff
Badr-MOUFAD Dec 1, 2022
e01451d
unittest sqrt
Badr-MOUFAD Dec 1, 2022
dd36b88
add docs
Badr-MOUFAD Dec 1, 2022
523419b
fix docs SqrtQuadratic
Badr-MOUFAD Dec 1, 2022
71de179
Merge branch 'main' of https://github.com/scikit-learn-contrib/skglm …
Badr-MOUFAD Dec 2, 2022
63a547b
subdiff --> fixed_point
Badr-MOUFAD Dec 4, 2022
f78d17d
efficient prox conjugate && fix tests
Badr-MOUFAD Dec 5, 2022
d0ae3a4
remove go
Badr-MOUFAD Dec 5, 2022
ad36485
MM remarks
Badr-MOUFAD Dec 5, 2022
f60bd59
fix test && clean ups
Badr-MOUFAD Dec 5, 2022
5a5f1ba
MM round 2 remarks
Badr-MOUFAD Dec 5, 2022
4f27c56
CI Trigger
Badr-MOUFAD Dec 5, 2022
fe45faa
implement pinball
Badr-MOUFAD Dec 6, 2022
3ce886f
unittest
Badr-MOUFAD Dec 6, 2022
6928502
fix pinball value && ST step
Badr-MOUFAD Dec 6, 2022
1271288
more unittest
Badr-MOUFAD Dec 6, 2022
bd1984a
fix bug prox pinball
Badr-MOUFAD Dec 6, 2022
36100c7
Merge branch 'main' of https://github.com/scikit-learn-contrib/skglm …
Badr-MOUFAD Dec 8, 2022
1a03c60
MM remarks
Badr-MOUFAD Dec 8, 2022
4b3ea45
Update skglm/experimental/quantile_regression.py
mathurinm Dec 8, 2022
9cf2216
pinball expression
Badr-MOUFAD Dec 8, 2022
626b71d
Merge branch 'pinball-df' of https://github.com/Badr-MOUFAD/skglm int…
Badr-MOUFAD Dec 8, 2022
8e93720
sqrt --> pinball
Badr-MOUFAD Dec 8, 2022
0a247f0
quantile --> quantile_level
Badr-MOUFAD Dec 9, 2022
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
add docs
  • Loading branch information
Badr-MOUFAD committed Dec 1, 2022
commit dd36b883aec5bab9cb5c99cb5e6232d81a549ef5
50 changes: 46 additions & 4 deletions skglm/experimental/pdcd_ws.py
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,48 @@


class PDCD_WS:
Badr-MOUFAD marked this conversation as resolved.
Show resolved Hide resolved
"""Primal-Dual Coordinate Descent solver with working sets.

Solver inspired by [1] that uses working sets.

Parameters
----------
max_iter : int, optional
The maximum number of iterations or equivalently the
the maximum number solved subproblems.

max_epochs : int, optional
Maximum number of CD epochs on each subproblem.

p0 : int, optional
First working set size.

tol : float, optional
The tolerance for the optimization.

dual_init : array, shape (n_samples,) default None
The initialization of dual variables.
If None, they are initialized as the 0 vector ``np.zeros(n_samples)``.

return_p_objs : bool, default False
If True, returns the values of the objective in each iteration.
Otherwise returns an empty array.

verbose : bool or int, default False
Amount of verbosity. 0/False is silent.

References
----------
.. [1] Olivier Fercoq and Pascal Bianchi,
"A Coordinate-Descent Primal-Dual Algorithm with Large Step Size and Possibly
Nonseparable Functions", SIAM Journal on Optimization, 2020,
https://epubs.siam.org/doi/10.1137/18M1168480,
code: https://github.com/Badr-MOUFAD/Fercoq-Bianchi-solver

.. [2] Mathurin Massias, Alexandre Gramfort, Joseph Salmon,
"From safe screening rules to working sets for faster Lasso-type solvers",
OPTML workshop at NIPS 2017, https://arxiv.org/abs/1703.07285v2
"""

def __init__(self, max_iter=1000, max_epochs=1000, p0=100, tol=1e-6,
dual_init=None, return_p_objs=False, verbose=False):
Expand Down Expand Up @@ -131,11 +173,11 @@ def _solve_subproblem(y, X, w, Xw, z, z_bar, datafit, penalty,
break

@staticmethod
def _validate_init(datafit, penalty):
def _validate_init(datafit_, penalty_):
# validate datafit
missing_attrs = []
for attr in ('prox_conjugate', 'subdiff_distance'):
if not hasattr(datafit, attr):
if not hasattr(datafit_, attr):
missing_attrs.append(f"`{attr}`")

if len(missing_attrs):
Expand All @@ -146,7 +188,7 @@ def _validate_init(datafit, penalty):
)

# jit compile classes
compiled_datafit = compiled_clone(datafit)
compiled_penalty = compiled_clone(penalty)
compiled_datafit = compiled_clone(datafit_)
compiled_penalty = compiled_clone(penalty_)

return compiled_datafit, compiled_penalty