2424from ..utils import check_array
2525from ..utils .extmath import row_norms
2626from ..utils .extmath import _incremental_mean_and_var
27- from ..utils .fixes import nanpercentile
27+ from ..utils .fixes import boxcox , nanpercentile
2828from ..utils .sparsefuncs_fast import (inplace_csr_row_normalize_l1 ,
2929 inplace_csr_row_normalize_l2 )
3030from ..utils .sparsefuncs import (inplace_column_scale ,
@@ -2480,10 +2480,7 @@ def fit(self, X, y=None):
24802480 # the computation of lambda is influenced by NaNs and we need to
24812481 # get rid of them to compute them.
24822482 _ , lmbda = stats .boxcox (col [~ np .isnan (col )], lmbda = None )
2483- # FIXME: stats.boxcox should be changed by special.boxcox which
2484- # handles NaN and does not raise warnings. Check SciPy 0.14.X
2485- with np .errstate (invalid = 'ignore' ): # hide NaN comparison warnings
2486- col_trans = stats .boxcox (col , lmbda )
2483+ col_trans = boxcox (col , lmbda )
24872484 self .lambdas_ .append (lmbda )
24882485 transformed .append (col_trans )
24892486
@@ -2507,11 +2504,8 @@ def transform(self, X):
25072504 check_is_fitted (self , 'lambdas_' )
25082505 X = self ._check_input (X , check_positive = True , check_shape = True )
25092506
2510- # FIXME: stats.boxcox should be changed by special.boxcox which handles
2511- # NaN and does not raise warnings. Check SciPy 0.14.X
2512- with np .errstate (invalid = 'ignore' ): # hide NaN comparison warnings
2513- for i , lmbda in enumerate (self .lambdas_ ):
2514- X [:, i ] = stats .boxcox (X [:, i ], lmbda )
2507+ for i , lmbda in enumerate (self .lambdas_ ):
2508+ X [:, i ] = boxcox (X [:, i ], lmbda )
25152509
25162510 if self .standardize :
25172511 X = self ._scaler .transform (X )
0 commit comments