Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Appearance settings

Commit 2b99c9b

Browse filesBrowse files
committed
Restore non-degenerate alpha check in test
1 parent e6c89fe commit 2b99c9b
Copy full SHA for 2b99c9b

File tree

1 file changed

+9
-0
lines changed
Filter options

1 file changed

+9
-0
lines changed

‎sklearn/linear_model/tests/test_coordinate_descent.py

Copy file name to clipboardExpand all lines: sklearn/linear_model/tests/test_coordinate_descent.py
+9Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1369,9 +1369,18 @@ def test_enet_cv_sample_weight_correctness(
13691369
)
13701370
reg_with_repetitions.fit(X_with_repetitions, y_with_repetitions)
13711371

1372+
# Check that the alpha selection process is the same:
13721373
assert_allclose(reg_with_weights.mse_path_, reg_with_repetitions.mse_path_)
13731374
assert_allclose(reg_with_weights.alphas_, reg_with_repetitions.alphas_)
13741375
assert reg_with_weights.alpha_ == pytest.approx(reg_with_repetitions.alpha_)
1376+
1377+
# Ensure that the models selected a non-boundary alpha to make sure that
1378+
# the sample_weight equivalence test is non-degenerate.
1379+
alphas = reg_with_weights.alphas_
1380+
alpha = reg_with_weights.alpha_
1381+
assert alphas[0] > alpha > alphas[-1]
1382+
1383+
# Check that the final model coefficients are the same:
13751384
assert_allclose(reg_with_weights.coef_, reg_with_repetitions.coef_, atol=1e-10)
13761385
assert reg_with_weights.intercept_ == pytest.approx(reg_with_repetitions.intercept_)
13771386

0 commit comments

Comments
0 (0)
Morty Proxy This is a proxified and sanitized view of the page, visit original site.