Skip to content

Commit

Permalink
Merge remote-tracking branch 'PAB/solver_dispatcher' into solver_disp…
Browse files Browse the repository at this point in the history
…atcher
  • Loading branch information
Badr-MOUFAD committed Jul 14, 2024
2 parents ccd7cd7 + f3fae3e commit bb15aea
Show file tree
Hide file tree
Showing 5 changed files with 8 additions and 8 deletions.
2 changes: 1 addition & 1 deletion skglm/__init__.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
__version__ = '0.3.2dev'
__version__ = '0.4dev'

from skglm.estimators import ( # noqa F401
Lasso, WeightedLasso, ElasticNet, MCPRegression, MultiTaskLasso, LinearSVC,
Expand Down
2 changes: 1 addition & 1 deletion skglm/solvers/anderson_cd.py
Original file line number Diff line number Diff line change
Expand Up @@ -285,7 +285,7 @@ def custom_compatibility_check(self, X, y, datafit, penalty):
if self.ws_strategy == "subdiff" and not hasattr(penalty, "subdiff_distance"):
raise AttributeError(
"Penalty must implement `subdiff_distance` "
"to use self.ws_strategy='subdiff'."
"to use ws_strategy='subdiff' in solver AndersonCD."
)


Expand Down
2 changes: 1 addition & 1 deletion skglm/solvers/fista.py
Original file line number Diff line number Diff line change
Expand Up @@ -121,5 +121,5 @@ def custom_compatibility_check(self, X, y, datafit, penalty):
if self.opt_strategy == "subdiff" and not hasattr(penalty, "subdiff_distance"):
raise AttributeError(
"Penalty must implement `subdiff_distance` "
"to use self.opt_strategy='subdiff'."
"to use `opt_strategy='subdiff'` in Fista solver."
)
4 changes: 2 additions & 2 deletions skglm/solvers/gram_cd.py
Original file line number Diff line number Diff line change
Expand Up @@ -137,10 +137,10 @@ def solve(self, X, y, datafit, penalty, w_init=None, Xw_init=None):
p_objs_out.append(p_obj)
return w, np.array(p_objs_out), stop_crit

def custom_compatibility_check(self, X, y, datafit):
def custom_compatibility_check(self, X, y, datafit, penalty):
if not isinstance(datafit, Quadratic):
raise AttributeError(
f"`GramCD` supports only `Quadratic` datafit, got {datafit}"
f"`GramCD` supports only `Quadratic` datafit, got {datafit}."
)


Expand Down
6 changes: 3 additions & 3 deletions skglm/utils/validation.py
Original file line number Diff line number Diff line change
Expand Up @@ -77,12 +77,12 @@ def check_obj_solver_attr(obj, solver, required_attr, support_sparse=False):
solver_name = name_matcher.search(str(solver.__class__)).group(1)

if not support_sparse:
err_message = f"{obj_name} is not compatible with {solver_name}."
err_message = f"{obj_name} is not compatible with solver {solver_name}."
else:
err_message = (f"{obj_name} is not compatible with {solver_name}"
err_message = (f"{obj_name} is not compatible with solver {solver_name} "
"with sparse data.")

err_message += (f" It must implement {' and '.join(required_attr)}\n"
err_message += (f" It must implement {' and '.join(required_attr)}.\n"
f"Missing {' and '.join(missing_attrs)}.")

raise AttributeError(err_message)
Expand Down

0 comments on commit bb15aea

Please sign in to comment.