Skip to content

Commit b7ee5f7

Browse files
Fix Linter
1 parent 5806f33 commit b7ee5f7

File tree

1 file changed

+10
-5
lines changed

1 file changed

+10
-5
lines changed

skglm/experimental/solver_strategies.py

Lines changed: 10 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
1-
"""Stagebased tuning of solver hyperparameters for continuation and
2-
other progressiverefinement algorithms.
1+
"""Stage-based tuning of solver hyper-parameters for continuation and
2+
progressive-refinement algorithms.
33
44
Early stages: loose tolerance, few iterations, small working set
55
--> quick coarse answers.
@@ -26,8 +26,10 @@
2626

2727

2828
class StageBasedSolverStrategy:
29-
"""Stage‑wise tuning of a *base_solver* for continuation /
30-
progressive‑smoothing pipelines.
29+
"""Stage-wise tuning of a base solver for continuation and
30+
progressive-smoothing pipelines.
31+
32+
This class adapts solver parameters based on the stage of optimization.
3133
"""
3234

3335
def __init__(self, config=None):
@@ -50,7 +52,7 @@ def __init__(self, config=None):
5052
)
5153

5254
def create_solver_for_stage(self, base_solver, delta, stage, n_features):
53-
"""Clone *base_solver* and adapt tol, max_iter and p0 for the given stage."""
55+
"""Clone base_solver and adapt tol, max_iter and p0 for the given stage."""
5456
solver = self._clone(base_solver)
5557
self._set_tol(solver, delta, stage)
5658
self._set_max_iter(solver, stage)
@@ -66,12 +68,14 @@ def _clone(est):
6668
return copy.deepcopy(est)
6769

6870
def _set_tol(self, solver, delta, stage):
71+
"""Set tolerance based on stage and delta value."""
6972
if hasattr(solver, "tol"):
7073
base = self.config["base_tol"]
7174
solver.tol = base if stage == 0 else max(
7275
base, self.config["tol_delta_factor"] * delta)
7376

7477
def _set_max_iter(self, solver, stage):
78+
"""Set maximum iterations based on stage number."""
7579
if hasattr(solver, "max_iter"):
7680
start = self.config["max_iter_start"]
7781
solver.max_iter = min(
@@ -80,6 +84,7 @@ def _set_max_iter(self, solver, stage):
8084
)
8185

8286
def _set_working_set(self, solver, n_features):
87+
"""Set working set size based on number of features."""
8388
if not hasattr(solver, "p0"):
8489
return
8590

0 commit comments

Comments
 (0)