@@ -68,7 +68,7 @@ def make_dataset(X, y, sample_weight, random_state=None):
68
68
69
69
# TODO: this reproduces the behavior prior 0.17
70
70
# Must be remove in 0.19
71
- def _sparse_center_data (X , y , fit_intercept , normalize = None ):
71
+ def _deprecated_sparse_center_data (X , y , fit_intercept , normalize = None ):
72
72
if fit_intercept :
73
73
# we might require not to change the csr matrix sometimes
74
74
# store a copy if normalize is True.
@@ -112,7 +112,7 @@ def sparse_center_data(X, y, fit_intercept, normalize=False,
112
112
"version 0.17 and will be removed in 0.19. If you want "
113
113
"to standardize the data instead, use"
114
114
"`standardize=True`" , DeprecationWarning )
115
- return _sparse_center_data (X , y , fit_intercept , normalize )
115
+ return _deprecated_sparse_center_data (X , y , fit_intercept , normalize )
116
116
117
117
if fit_intercept :
118
118
# we might require not to change the csr matrix sometimes
@@ -145,8 +145,8 @@ def sparse_center_data(X, y, fit_intercept, normalize=False,
145
145
146
146
# TODO: this reproduces the behavior prior 0.17
147
147
# Must be remove in 0.19
148
- def _center_data (X , y , fit_intercept , normalize = False , copy = True ,
149
- sample_weight = None ):
148
+ def _deprecated_center_data (X , y , fit_intercept , normalize = False , copy = True ,
149
+ sample_weight = None ):
150
150
151
151
X = as_float_array (X , copy )
152
152
if fit_intercept :
@@ -188,8 +188,8 @@ def center_data(X, y, fit_intercept, normalize=False, standardize=False,
188
188
"version 0.17 and will be removed in 0.19. If you want "
189
189
"to standardize the data instead, use"
190
190
"`standardize=True`" , DeprecationWarning )
191
- return _center_data (X , y , fit_intercept , normalize , copy ,
192
- sample_weight )
191
+ return _deprecated_center_data (X , y , fit_intercept , normalize , copy ,
192
+ sample_weight )
193
193
194
194
X = as_float_array (X , copy )
195
195
if fit_intercept :
@@ -462,24 +462,12 @@ class LinearRegression(LinearModel, RegressorMixin):
462
462
463
463
def __init__ (self , fit_intercept = True , normalize = False , standardize = False ,
464
464
copy_X = True , n_jobs = 1 ):
465
- if normalize :
466
- warnings .warn ("The `normalize` parameter is not in use anymore "
467
- "from version 0.17 and will be removed in 0.19. If "
468
- "you want the data to be standardized instead, use "
469
- "`standardize=True`" , DeprecationWarning )
470
465
self .fit_intercept = fit_intercept
466
+ self .normalize = normalize
471
467
self .standardize = standardize
472
468
self .copy_X = copy_X
473
469
self .n_jobs = n_jobs
474
470
475
- @property
476
- @deprecated ("The `normalize` attribute is not in use anymore "
477
- "from version 0.17 and will be removed in 0.19. If "
478
- "you want the data to be standardized instead, use "
479
- "`standardize=True`" )
480
- def normalize (self ):
481
- return None
482
-
483
471
def fit (self , X , y , sample_weight = None ):
484
472
"""
485
473
Fit linear model.
@@ -509,7 +497,7 @@ def fit(self, X, y, sample_weight=None):
509
497
sample_weight = column_or_1d (sample_weight , warn = True )
510
498
511
499
X , y , X_mean , y_mean , X_std = self ._center_data (
512
- X , y , fit_intercept = self .fit_intercept ,
500
+ X , y , fit_intercept = self .fit_intercept , normalize = self . normalize ,
513
501
standardize = self .standardize , copy = self .copy_X ,
514
502
sample_weight = sample_weight )
515
503
@@ -540,22 +528,25 @@ def fit(self, X, y, sample_weight=None):
540
528
return self
541
529
542
530
543
- def _pre_fit (X , y , Xy , precompute , standardize , fit_intercept , copy ):
531
+ def _pre_fit (X , y , Xy , precompute , normalize , standardize , fit_intercept ,
532
+ copy ):
544
533
"""Aux function used at beginning of fit in linear models"""
545
534
n_samples , n_features = X .shape
546
535
547
536
if sparse .isspmatrix (X ):
548
537
precompute = False
549
538
X , y , X_mean , y_mean , X_std = sparse_center_data (
550
- X , y , fit_intercept = fit_intercept , standardize = standardize )
539
+ X , y , fit_intercept = fit_intercept , normalize = normalize ,
540
+ standardize = standardize )
551
541
else :
552
542
# copy was done in fit if necessary
553
543
X , y , X_mean , y_mean , X_std = center_data (
554
- X , y , fit_intercept = fit_intercept , standardize = standardize ,
555
- copy = copy )
544
+ X , y , fit_intercept = fit_intercept , normalize = normalize ,
545
+ standardize = standardize , copy = copy )
556
546
if hasattr (precompute , '__array__' ) and (
557
547
fit_intercept and not np .allclose (X_mean , np .zeros (n_features )) or
558
- standardize and not np .allclose (X_std , np .ones (n_features ))):
548
+ normalize or standardize or not
549
+ np .allclose (X_std , np .ones (n_features ))):
559
550
warnings .warn ("Gram matrix was provided but X was centered"
560
551
" to fit intercept, "
561
552
"or X was standardized : recomputing Gram matrix." ,
0 commit comments