Skip to content

Commit

Permalink
Add small test
Browse files Browse the repository at this point in the history
  • Loading branch information
tiagoleonmelo committed Mar 22, 2024
1 parent 171ecf4 commit 888ea32
Showing 1 changed file with 14 additions and 0 deletions.
14 changes: 14 additions & 0 deletions mapie/tests/test_quantile_regression.py
Original file line number Diff line number Diff line change
Expand Up @@ -791,3 +791,17 @@ def early_stopping_monitor(i, est, locals):

for estimator in mapie.estimators_:
assert estimator.estimators_.shape[0] == 3

def test_random_state_is_set() -> None:
"""
Test that the same result is obtained if the random state
is provided through constructor or through fit()
"""
mapie = MapieQuantileRegressor()
mapie_rand = MapieQuantileRegressor(random_state=random_state)
mapie.fit(X, y, calib_size=0.5, random_state=random_state)
mapie_rand.fit(X, y, calib_size=0.5)
y_pred, y_pis = mapie.predict(X)
y_pred_rand, y_pis_rand = mapie_rand.predict(X)
np.testing.assert_allclose(y_pred, y_pred_rand, rtol=1e-2)
np.testing.assert_allclose(y_pis, y_pis_rand, rtol=1e-2)

0 comments on commit 888ea32

Please sign in to comment.