Skip to content

Commit

Permalink
ENH(sr3): refactor threshold and thresholder property (#548)
Browse files Browse the repository at this point in the history
As originally written, "threshold" parameter in SR3 classes referred to the l0 norm. 
Appendix A of the SR3 paper included a conversion from l0 threshold to l0 weight,
which was then used in prox, etc.  However, the name threshold stayed around, even
as it was used as a regularizer.  It even applied the l0-specific conversion to l1 and l2
thresholds.

This PR aims to generalize SR3 to other norm by moving threshold-to-weight
calculation to a separate function that the user can call on: 
`calculate_l0_weight()`
  • Loading branch information
himkwtn authored Sep 17, 2024
1 parent 3d011fc commit 137b19d
Show file tree
Hide file tree
Showing 19 changed files with 3,929 additions and 2,360 deletions.
8 changes: 4 additions & 4 deletions examples/16_noise_robustness/utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -1357,10 +1357,10 @@ def hyperparameter_scan_sr3(
# start with initial guess that all coefs are zero
optimizer = ps.EnsembleOptimizer(
opt=ps.SR3(
threshold=0,
reg_weight_lam=0,
max_iter=max_iter,
normalize_columns=normalize_columns,
nu=nu,
relax_coeff_nu=nu,
),
bagging=True,
n_models=n_models,
Expand Down Expand Up @@ -1418,10 +1418,10 @@ def hyperparameter_scan_sr3(
for i in range(tol_iter):
optimizer = ps.EnsembleOptimizer(
opt=ps.SR3(
threshold=tol,
reg_weight_lam=tol,
max_iter=max_iter,
normalize_columns=normalize_columns,
nu=nu,
relax_coeff_nu=nu,
),
bagging=True,
n_models=n_models,
Expand Down
Loading

0 comments on commit 137b19d

Please sign in to comment.