20
20
from ..base import RegressorMixin , _fit_context
21
21
from ..exceptions import ConvergenceWarning
22
22
from ..utils import check_random_state
23
- from ..utils ._param_validation import Interval
23
+ from ..utils ._param_validation import Hidden , Interval , StrOptions
24
24
from ..utils .parallel import Parallel , delayed
25
25
from ._base import LinearModel
26
26
@@ -228,6 +228,10 @@ class TheilSenRegressor(RegressorMixin, LinearModel):
228
228
copy_X : bool, default=True
229
229
If True, X will be copied; else, it may be overwritten.
230
230
231
+ .. deprecated:: 1.6
232
+ `copy_X` was deprecated in 1.6 and will be removed in 1.8.
233
+ It has no effect as a copy is always made.
234
+
231
235
max_subpopulation : int, default=1e4
232
236
Instead of computing with a set of cardinality 'n choose k', where n is
233
237
the number of samples and k is the number of subsamples (at least
@@ -324,7 +328,7 @@ class TheilSenRegressor(RegressorMixin, LinearModel):
324
328
325
329
_parameter_constraints : dict = {
326
330
"fit_intercept" : ["boolean" ],
327
- "copy_X" : ["boolean" ],
331
+ "copy_X" : ["boolean" , Hidden ( StrOptions ({ "deprecated" })) ],
328
332
# target_type should be Integral but can accept Real for backward compatibility
329
333
"max_subpopulation" : [Interval (Real , 1 , None , closed = "left" )],
330
334
"n_subsamples" : [None , Integral ],
@@ -339,7 +343,7 @@ def __init__(
339
343
self ,
340
344
* ,
341
345
fit_intercept = True ,
342
- copy_X = True ,
346
+ copy_X = "deprecated" ,
343
347
max_subpopulation = 1e4 ,
344
348
n_subsamples = None ,
345
349
max_iter = 300 ,
@@ -411,6 +415,14 @@ def fit(self, X, y):
411
415
self : returns an instance of self.
412
416
Fitted `TheilSenRegressor` estimator.
413
417
"""
418
+ if self .copy_X != "deprecated" :
419
+ warnings .warn (
420
+ "`copy_X` was deprecated in 1.6 and will be removed in 1.8 since it "
421
+ "has no effect internally. Simply leave this parameter to its default "
422
+ "value to avoid this warning." ,
423
+ FutureWarning ,
424
+ )
425
+
414
426
8000
random_state = check_random_state (self .random_state )
415
427
X , y = self ._validate_data (X , y , y_numeric = True )
416
428
n_samples , n_features = X .shape
0 commit comments