Skip to content

Commit 1799819

Browse files
authored
MNT fix failing slope test (#287)
1 parent afdba2a commit 1799819

File tree

2 files changed

+5
-3
lines changed

2 files changed

+5
-3
lines changed

.github/workflows/main.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,7 @@ jobs:
2626
run: |
2727
conda install rpy2 -c conda-forge
2828
pip install statsmodels cvxopt
29-
pip install git+https://github.com/jolars/sortedl1.git
29+
pip install sortedl1
3030
# for testing Cox estimator
3131
pip install lifelines
3232
pip install pandas

skglm/tests/test_penalties.py

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -97,13 +97,15 @@ def test_slope():
9797
# q = 0.1
9898
# alphas = lambda_sequence(
9999
# X, y, fit_intercept=False, reg=alpha / alpha_max, q=q)
100-
clf = SlopeEst(alpha=0.01, fit_intercept=False).fit(X, y)
100+
clf = SlopeEst(
101+
alpha=0.01, fit_intercept=False, tol=1e-6
102+
).fit(X, y)
101103
alphas = clf.lambda_
102104
ours = GeneralizedLinearEstimator(
103105
penalty=SLOPE(clf.alpha * alphas),
104106
solver=FISTA(max_iter=1000, tol=tol, opt_strategy="fixpoint"),
105107
).fit(X, y)
106-
np.testing.assert_allclose(ours.coef_, clf.coef_, rtol=1e-5)
108+
np.testing.assert_allclose(ours.coef_, np.squeeze(clf.coef_), rtol=1e-3)
107109

108110

109111
@pytest.mark.parametrize("fit_intercept", [True, False])

0 commit comments

Comments
 (0)