@@ -2431,7 +2431,7 @@ def quantile_transform(X, axis=0, n_quantiles=1000,
24312431                       ignore_implicit_zeros = False ,
24322432                       subsample = int (1e5 ),
24332433                       random_state = None ,
2434-                        copy = False ):
2434+                        copy = "warn" ):
24352435    """Transform features using quantiles information. 
24362436
24372437    This method transforms the features to follow a uniform or a normal 
@@ -2489,9 +2489,18 @@ def quantile_transform(X, axis=0, n_quantiles=1000,
24892489        by np.random. Note that this is used by subsampling and smoothing 
24902490        noise. 
24912491
2492-     copy : boolean, optional, (default=True ) 
2492+     copy : boolean, optional, (default="warn" ) 
24932493        Set to False to perform inplace transformation and avoid a copy (if the 
2494-         input is already a numpy array). 
2494+         input is already a numpy array). If True, a copy of `X` is transformed, 
2495+         leaving the original `X` unchanged 
2496+ 
2497+         .. deprecated:: 0.21 
2498+             The default value of parameter `copy` will be changed from False 
2499+             to True in 0.23. The current default of False is being changed to 
2500+             make it more consistent with the default `copy` values of other 
2501+             functions in :mod:`sklearn.preprocessing.data`. Furthermore, the 
2502+             current default of False may have unexpected side effects by 
2503+             modifying the value of `X` inplace 
24952504
24962505    Returns 
24972506    ------- 
@@ -2504,7 +2513,7 @@ def quantile_transform(X, axis=0, n_quantiles=1000,
25042513    >>> from sklearn.preprocessing import quantile_transform 
25052514    >>> rng = np.random.RandomState(0) 
25062515    >>> X = np.sort(rng.normal(loc=0.5, scale=0.25, size=(25, 1)), axis=0) 
2507-     >>> quantile_transform(X, n_quantiles=10, random_state=0) 
2516+     >>> quantile_transform(X, n_quantiles=10, random_state=0, copy=True ) 
25082517    ... # doctest: +ELLIPSIS 
25092518    array([...]) 
25102519
@@ -2529,6 +2538,17 @@ def quantile_transform(X, axis=0, n_quantiles=1000,
25292538    see :ref:`examples/preprocessing/plot_all_scaling.py 
25302539    <sphx_glr_auto_examples_preprocessing_plot_all_scaling.py>`. 
25312540    """ 
2541+     if  copy  ==  "warn" :
2542+         warnings .warn ("The default value of `copy` will change from False to " 
2543+                       "True in 0.23 in order to make it more consistent with " 
2544+                       "the default `copy` values of other functions in " 
2545+                       ":mod:`sklearn.preprocessing.data` and prevent " 
2546+                       "unexpected side effects by modifying the value of `X` " 
2547+                       "inplace. To avoid inplace modifications of `X`, it is " 
2548+                       "recommended to explicitly set `copy=True`" ,
2549+                       FutureWarning )
2550+         copy  =  False 
2551+ 
25322552    n  =  QuantileTransformer (n_quantiles = n_quantiles ,
25332553                            output_distribution = output_distribution ,
25342554                            subsample = subsample ,
0 commit comments