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

[BUG] error in error message when unknown strategy for FISTA #220

Open
mathurinm opened this issue Mar 31, 2022 · 0 comments
Open

[BUG] error in error message when unknown strategy for FISTA #220

mathurinm opened this issue Mar 31, 2022 · 0 comments
Assignees
Labels

Comments

@mathurinm
Copy link

System setup
With the develop branch

Describe the bug
Passing an unknown restart strategy to ForwardBackward does not say it is unknown, but raises a lower level error.

File ~/workspace/ModOpt/modopt/opt/algorithms/forward_backward.py:106, in FISTA.__init__(self, restart_strategy, min_beta, s_greedy, xi_restart, a_cd, p_lazy, q_lazy, r_lazy, **kwargs)
    102 else:
    103     message = 'Restarting strategy must be one of {0}.'
    104     raise ValueError(
    105         message.format(
--> 106             ', '.join(self._restarting_strategies),
    107         ),
    108     )
    109 self._t_now = 1.0
    110 self._t_prev = 1.0

TypeError: sequence item 6: expected str instance, NoneType found

To Reproduce

import numpy as np

from modopt.opt.algorithms import ForwardBackward
from modopt.opt.proximity import SparseThreshold
from modopt.opt.linear import Identity
from modopt.opt.gradient import GradBasic


X = np.random.randn(10, 20)
y = np.random.randn(10)

lmbd = 0.5 * np.max(np.abs(X.T @ y))

restart_strategy = "nonexistentstrategy"
min_beta = None
s_greedy = None
p_lazy = 1 / 30
q_lazy = 1 / 10


def op(w):
    return X @ w


fb = ForwardBackward(
    x=np.zeros(X.shape[1]),
    grad=GradBasic(
        input_data=y, op=op,
        trans_op=lambda res: X.T@res,
        input_data_writeable=True,
    ),
    prox=SparseThreshold(Identity(), lmbd),
    beta_param=1.0,
    min_beta=min_beta,
    metric_call_period=None,
    restart_strategy=restart_strategy,
    xi_restart=0.96,
    s_greedy=s_greedy,
    p_lazy=p_lazy,
    q_lazy=q_lazy,
    auto_iterate=False,
    progress=False,
    cost=None,
)
@mathurinm mathurinm added the bug label Mar 31, 2022
@sfarrens sfarrens self-assigned this Mar 31, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

2 participants