Skip to content

Commit e1408d0

Browse files
authored
MNT better error message in RidgeCV (#19020)
1 parent d304331 commit e1408d0

File tree

2 files changed

+3
-3
lines changed

2 files changed

+3
-3
lines changed

sklearn/linear_model/_ridge.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1466,7 +1466,7 @@ def fit(self, X, y, sample_weight=None):
14661466

14671467
if np.any(self.alphas <= 0):
14681468
raise ValueError(
1469-
"alphas must be positive. Got {} containing some "
1469+
"alphas must be strictly positive. Got {} containing some "
14701470
"negative or null value instead.".format(self.alphas))
14711471

14721472
X, y, X_offset, y_offset, X_scale = LinearModel._preprocess_data(

sklearn/linear_model/tests/test_ridge.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1126,13 +1126,13 @@ def test_ridgecv_negative_alphas():
11261126
# Negative integers
11271127
ridge = RidgeCV(alphas=(-1, -10, -100))
11281128
assert_raises_regex(ValueError,
1129-
"alphas must be positive",
1129+
"alphas must be strictly positive",
11301130
ridge.fit, X, y)
11311131

11321132
# Negative floats
11331133
ridge = RidgeCV(alphas=(-0.1, -1.0, -10.0))
11341134
assert_raises_regex(ValueError,
1135-
"alphas must be positive",
1135+
"alphas must be strictly positive",
11361136
ridge.fit, X, y)
11371137

11381138

0 commit comments

Comments
 (0)