Skip to content

Commit ad01f07

Browse files
ENH: remove random_state from API when actually not used (#599)
1 parent 78b3dbb commit ad01f07

File tree

3 files changed

+7
-15
lines changed

3 files changed

+7
-15
lines changed

doc/v1_migration_guide.rst

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -130,6 +130,12 @@ The aggregation method and technique for combining predictions in ensemble metho
130130
- **v0.9**: Previously, the ``agg_function`` parameter had two usage: to aggregate predictions when setting ``ensemble=True`` in the ``predict`` method, and to specify the aggregation technique in ``JackknifeAfterBootstrapRegressor``.
131131
- **v1**: The ``agg_function`` parameter has been split into two distinct parameters: ``aggregate_predictions`` and ``aggregation_method``. ``aggregate_predictions`` is specific to ``CrossConformalRegressor``, and it specifies how predictions from multiple conformal regressors are aggregated when making point predictions. ``aggregation_method`` is specific to ``JackknifeAfterBootstrapRegressor``, and it specifies the aggregation technique for combining predictions across different bootstrap samples during conformalization.
132132

133+
``random_state``
134+
~~~~~~~~~~~~~~~~~~
135+
136+
- **v0.9**: This parameter was used to control the randomness of the data splitting.
137+
- **v1**: This parameter has been removed in cases where data splitting is now manual. Future evolutions may reintroduce it as a general purpose randomness control parameter.
138+
133139
``Other parameters``
134140
~~~~~~~~~~~~~~~~~~~~
135141
No more parameters with incorrect ``None`` defaults.

mapie_v1/integration_tests/tests/test_regression.py

Lines changed: 1 addition & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -71,7 +71,6 @@
7171
"prefit": False,
7272
"test_size": 0.4,
7373
"fit_params": {"sample_weight": sample_weight_train},
74-
"random_state": RANDOM_STATE,
7574
}
7675
},
7776
{
@@ -89,7 +88,6 @@
8988
"confidence_level": [0.5, 0.5],
9089
"conformity_score": "gamma",
9190
"prefit": False,
92-
"random_state": RANDOM_STATE,
9391
}
9492
},
9593
{
@@ -113,7 +111,6 @@
113111
random_state=RANDOM_STATE
114112
),
115113
"allow_infinite_bounds": True,
116-
"random_state": RANDOM_STATE,
117114
}
118115
},
119116
{
@@ -130,7 +127,6 @@
130127
"estimator": positive_predictor,
131128
"confidence_level": 0.9,
132129
"conformity_score": GammaConformityScore(),
133-
"random_state": RANDOM_STATE,
134130
"test_size": 0.3,
135131
"minimize_interval_width": True
136132
}
@@ -358,7 +354,6 @@ def test_intervals_and_predictions_exact_equality_jackknife(params_jackknife):
358354
"prefit": False,
359355
"test_size": 0.4,
360356
"fit_params": {"sample_weight": sample_weight_train},
361-
"random_state": RANDOM_STATE,
362357
},
363358
},
364359
{
@@ -379,7 +374,6 @@ def test_intervals_and_predictions_exact_equality_jackknife(params_jackknife):
379374
"test_size": 0.2,
380375
"fit_params": {"sample_weight": sample_weight},
381376
"minimize_interval_width": True,
382-
"random_state": RANDOM_STATE,
383377
},
384378
},
385379
{
@@ -398,7 +392,6 @@ def test_intervals_and_predictions_exact_equality_jackknife(params_jackknife):
398392
"prefit": False,
399393
"test_size": 0.3,
400394
"allow_infinite_bounds": True,
401-
"random_state": RANDOM_STATE,
402395
},
403396
},
404397
{
@@ -414,7 +407,6 @@ def test_intervals_and_predictions_exact_equality_jackknife(params_jackknife):
414407
"confidence_level": 0.9,
415408
"prefit": False,
416409
"test_size": 0.3,
417-
"random_state": RANDOM_STATE,
418410
"symmetric_intervals": False,
419411
},
420412
},
@@ -457,7 +449,7 @@ def compare_model_predictions_and_intervals(
457449
prefit: bool = False,
458450
test_size: Optional[float] = None,
459451
sample_weight: Optional[ArrayLike] = None,
460-
random_state: int = 42,
452+
random_state: int = RANDOM_STATE,
461453
) -> None:
462454

463455
if test_size is not None:

mapie_v1/regression.py

Lines changed: 0 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -62,10 +62,6 @@ class SplitConformalRegressor:
6262
Controls the verbosity level.
6363
Higher values increase the output details.
6464
65-
random_state : Optional[Union[int, np.random.RandomState]], default=None
66-
A seed or random state instance to ensure reproducibility in any random
67-
operations within the regressor.
68-
6965
Notes
7066
-----
7167
This implementation currently uses a ShuffleSplit cross-validation scheme
@@ -100,7 +96,6 @@ def __init__(
10096
prefit: bool = False,
10197
n_jobs: Optional[int] = None,
10298
verbose: int = 0,
103-
random_state: Optional[Union[int, np.random.RandomState]] = None,
10499
) -> None:
105100
check_estimator_fit_predict(estimator)
106101
self._estimator = estimator
@@ -118,7 +113,6 @@ def __init__(
118113
n_jobs=n_jobs,
119114
verbose=verbose,
120115
conformity_score=self._conformity_score,
121-
random_state=random_state,
122116
)
123117

124118
self._alphas = transform_confidence_level_to_alpha_list(

0 commit comments

Comments
 (0)