File tree 2 files changed +10
-10
lines changed 2 files changed +10
-10
lines changed Original file line number Diff line number Diff line change @@ -163,8 +163,8 @@ Changelog
163
163
:pr: `19564 ` by `Thomas Fan `_.
164
164
165
165
- |Enhancement | Documented and tested support of the Poisson criterion for
166
- :class: `ensemble.RandomForestRegressor `. :pr: `19836 ` by
167
- :user: `Brian Sun <bsun94> `.
166
+ :class: `ensemble.RandomForestRegressor `. :pr: `19836 ` by
167
+ :user: `Brian Sun <bsun94> `.
168
168
169
169
:mod: `sklearn.feature_extraction `
170
170
.................................
Original file line number Diff line number Diff line change @@ -1358,24 +1358,24 @@ def test_min_impurity_decrease():
1358
1358
# will suffice for the actual working of this param
1359
1359
assert tree .min_impurity_decrease == 0.1
1360
1360
1361
+
1361
1362
def test_poisson_y_positive_check ():
1362
1363
est = RandomForestRegressor (criterion = "poisson" )
1363
1364
X = np .zeros ((3 , 3 ))
1364
1365
1365
1366
y = [- 1 , 1 , 3 ]
1366
- with pytest .raises (
1367
- ValueError ,
1368
- match = "Some.*y are negative.*Poisson.*\."
1369
- ):
1367
+ err_msg = (r"Some value\(s\) of y are negative which is "
1368
+ r"not allowed for Poisson regression." )
1369
+ with pytest .raises (ValueError , match = err_msg ):
1370
1370
est .fit (X , y )
1371
1371
1372
1372
y = [0 , 0 , 0 ]
1373
- with pytest .raises (
1374
- ValueError ,
1375
- match = "Sum of y is not positive.*Poisson regression\."
1376
- ):
1373
+ err_msg = (r"Sum of y is not strictly positive which "
1374
+ r"is necessary for Poisson regression." )
1375
+ with pytest .raises (ValueError , match = err_msg ):
1377
1376
est .fit (X , y )
1378
1377
1378
+
1379
1379
# mypy error: Variable "DEFAULT_JOBLIB_BACKEND" is not valid type
1380
1380
class MyBackend (DEFAULT_JOBLIB_BACKEND ): # type: ignore
1381
1381
def __init__ (self , * args , ** kwargs ):
You can’t perform that action at this time.
0 commit comments