Skip to content

Commit

Permalink
feat: add max_iter and tol parameters to Slope
Browse files Browse the repository at this point in the history
  • Loading branch information
jolars committed Dec 8, 2023
1 parent 7294370 commit 46ec82d
Showing 1 changed file with 18 additions and 4 deletions.
22 changes: 18 additions & 4 deletions sortedl1/estimators.py
Original file line number Diff line number Diff line change
Expand Up @@ -21,18 +21,32 @@ class Slope(BaseEstimator, RegressorMixin):
Whether to fit an intercept term. Default is True.
standardize : bool, optional
Whether to standardize the features. Default is False.
max_iter : int, optional
Maximum number of iterations for the inner loop.
tol : float, optional
Tolerance for the stopping criterion.
Attributes
----------
coef_ : ndarray
The estimated regression coefficients.
"""

def __init__(self, lam=None, alpha=1.0, fit_intercept=True, standardize=False):
def __init__(
self,
lam=None,
alpha=1.0,
fit_intercept=True,
standardize=False,
max_iter=100_000,
tol=1e-4,
):
self.lam = lam
self.alpha = alpha
self.fit_intercept = fit_intercept
self.standardize = standardize
self.max_iter = max_iter
self.tol = tol

def fit(self, X, y):
"""
Expand Down Expand Up @@ -75,9 +89,9 @@ def fit(self, X, y):
"path_length": 1,
"alpha_min_ratio": -1,
"pgd_freq": 10,
"tol": 1e-4,
"max_it": 1_000_00,
"max_it_outer": 30,
"tol": self.tol,
"max_it": self.max_iter,
"max_it_outer": 2,
"update_clusters": False,
"print_level": 0,
}
Expand Down

0 comments on commit 46ec82d

Please sign in to comment.