Skip to content

Commit 1b0d416

Browse files
Merge pull request #225 from scikit-learn-contrib/fix_cqr_issues
Fix cqr issues
2 parents e142b2d + ab47c61 commit 1b0d416

File tree

2 files changed

+21
-1
lines changed

2 files changed

+21
-1
lines changed

mapie/quantile_regression.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -131,7 +131,7 @@ class MapieQuantileRegressor(MapieRegressor):
131131
},
132132
"HistGradientBoostingRegressor": {
133133
"loss_name": "loss",
134-
"alpha_name": "alpha"
134+
"alpha_name": "quantile"
135135
},
136136
"LGBMRegressor": {
137137
"loss_name": "objective",

mapie/tests/test_utils.py

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -298,3 +298,23 @@ def test_compute_quantiles_2D_and_3D(alphas: NDArray):
298298
quantiles2 = compute_quantiles(vector2, alphas)
299299

300300
assert (quantiles1 == quantiles2).all()
301+
302+
303+
@pytest.mark.parametrize("estimator", [-1, 3, 0.2])
304+
def test_quantile_prefit_non_iterable(estimator: Any) -> None:
305+
"""
306+
Test that there is a list of estimators provided when cv='prefit'
307+
is called for MapieQuantileRegressor.
308+
"""
309+
with pytest.raises(
310+
ValueError,
311+
match=r".*Estimator for prefit must be an iterable object.*",
312+
):
313+
mapie_reg = MapieQuantileRegressor(
314+
estimator=estimator,
315+
cv="prefit"
316+
)
317+
mapie_reg.fit(
318+
[1, 2, 3],
319+
[4, 5, 6]
320+
)

0 commit comments

Comments
 (0)