61
61
62
62
63
63
def _handle_zeros_in_scale (scale , copy = True ):
64
- ''' Makes sure that whenever scale is zero, we handle it correctly.
64
+ """ Makes sure that whenever scale is zero, we handle it correctly.
65
65
66
- This happens in most scalers when we have constant features.'''
66
+ This happens in most scalers when we have constant features.
67
+ """
67
68
68
69
# if we are fitting on 1D arrays, scale might be a scalar
69
70
if np .isscalar (scale ):
@@ -80,7 +81,7 @@ def _handle_zeros_in_scale(scale, copy=True):
80
81
81
82
@_deprecate_positional_args
82
83
def scale (X , * , axis = 0 , with_mean = True , with_std = True , copy = True ):
83
- """Standardize a dataset along any axis
84
+ """Standardize a dataset along any axis.
84
85
85
86
Center to the mean and component wise scale to unit variance.
86
87
@@ -1526,7 +1527
8000
,7 @@ class PolynomialFeatures(TransformerMixin, BaseEstimator):
1526
1527
1527
1528
Parameters
1528
1529
----------
1529
- degree : integer , default=2
1530
+ degree : int , default=2
1530
1531
The degree of the polynomial features.
1531
1532
1532
1533
interaction_only : bool, default=False
@@ -2011,7 +2012,7 @@ def _more_tags(self):
2011
2012
2012
2013
@_deprecate_positional_args
2013
2014
def binarize (X , * , threshold = 0.0 , copy = True ):
2014
- """Boolean thresholding of array-like or scipy.sparse matrix
2015
+ """Boolean thresholding of array-like or scipy.sparse matrix.
2015
2016
2016
2017
Read more in the :ref:`User Guide <preprocessing_binarization>`.
2017
2018
@@ -2060,7 +2061,7 @@ def binarize(X, *, threshold=0.0, copy=True):
2060
2061
2061
2062
2062
2063
class Binarizer (TransformerMixin , BaseEstimator ):
2063
- """Binarize data (set feature values to 0 or 1) according to a threshold
2064
+ """Binarize data (set feature values to 0 or 1) according to a threshold.
2064
2065
2065
2066
Values greater than the threshold map to 1, while values less than
2066
2067
or equal to the threshold map to 0. With the default threshold of 0,
@@ -2119,7 +2120,7 @@ def __init__(self, *, threshold=0.0, copy=True):
2119
2120
self .copy = copy
2120
2121
2121
2122
def fit (self , X , y = None ):
2122
- """Do nothing and return the estimator unchanged
2123
+ """Do nothing and return the estimator unchanged.
2123
2124
2124
2125
This method is just there to implement the usual API and hence
2125
2126
work in pipelines.
@@ -2141,7 +2142,7 @@ def fit(self, X, y=None):
2141
2142
return self
2142
2143
2143
2144
def transform (self , X , copy = None ):
2144
- """Binarize each element of X
2145
+ """Binarize each element of X.
2145
2146
2146
2147
Parameters
2147
2148
----------
@@ -2166,7 +2167,7 @@ def _more_tags(self):
2166
2167
2167
2168
2168
2169
class KernelCenterer (TransformerMixin , BaseEstimator ):
2169
- """Center a kernel matrix
2170
+ """Center a kernel matrix.
2170
2171
2171
2172
Let K(x, z) be a kernel defined by phi(x)^T phi(z), where phi is a
2172
2173
function mapping x to a Hilbert space. KernelCenterer centers (i.e.,
@@ -2179,10 +2180,10 @@ class KernelCenterer(TransformerMixin, BaseEstimator):
2179
2180
Attributes
2180
2181
----------
2181
2182
K_fit_rows_ : array of shape (n_samples,)
2182
- Average of each column of kernel matrix
2183
+ Average of each column of kernel matrix.
2183
2184
2184
2185
K_fit_all_ : float
2185
- Average of kernel matrix
2186
+ Average of kernel matrix.
2186
2187
2187
2188
Examples
2188
2189
--------
@@ -2374,7 +2375,7 @@ class QuantileTransformer(TransformerMixin, BaseEstimator):
2374
2375
computational efficiency. Note that the subsampling procedure may
2375
2376
differ for value-identical sparse and dense matrices.
2376
2377
2377
- random_state : int or RandomState instance, default=None
2378
+ random_state : int, RandomState instance or None , default=None
2378
2379
Determines random number generation for subsampling and smoothing
2379
2380
noise.
2380
2381
Please see ``subsample`` for more details.
@@ -2575,7 +2576,7 @@ def fit(self, X, y=None):
2575
2576
return self
2576
2577
2577
2578
def _transform_col (self , X_col , quantiles , inverse ):
2578
- """Private function to transform a single feature"""
2579
+ """Private function to transform a single feature. """
2579
2580
2580
2581
output_distribution = self .output_distribution
2581
2582
@@ -2645,7 +2646,7 @@ def _transform_col(self, X_col, quantiles, inverse):
2645
2646
2646
2647
def _check_inputs (self , X , in_fit , accept_sparse_negative = False ,
2647
2648
copy = False ):
2648
- """Check inputs before fit and transform"""
2649
+ """Check inputs before fit and transform. """
2649
2650
# In theory reset should be equal to `in_fit`, but there are tests
2650
2651
# checking the input number of feature and they expect a specific
2651
2652
# string, which is not the same one raised by check_n_features. So we
@@ -2676,7 +2677,7 @@ def _check_inputs(self, X, in_fit, accept_sparse_negative=False,
2676
2677
return X
2677
2678
2678
2679
def _check_is_fitted (self , X ):
2679
- """Check the inputs before transforming"""
2680
+ """Check the inputs before transforming. """
2680
2681
check_is_fitted (self )
2681
2682
# check that the dimension of X are adequate with the fitted data
2682
2683
if X .shape [1 ] != self .quantiles_ .shape [1 ]:
@@ -2700,7 +2701,7 @@ def _transform(self, X, inverse=False):
2700
2701
Returns
2701
2702
-------
2702
2703
X : ndarray of shape (n_samples, n_features)
2703
- Projected data
2704
+ Projected data.
2704
2705
"""
2705
2706
2706
2707
if sparse .issparse (X ):
@@ -2822,7 +2823,7 @@ def quantile_transform(X, *, axis=0, n_quantiles=1000,
2822
2823
computational efficiency. Note that the subsampling procedure may
2823
2824
differ for value-identical sparse and dense matrices.
2824
2825
2825
- random_state : int or RandomState instance, default=None
2826
+ random_state : int, RandomState instance or None , default=None
2826
2827
Determines random number generation for subsampling and smoothing
2827
2828
noise.
2828
2829
Please see ``subsample`` for more details.
@@ -3103,7 +3104,7 @@ def inverse_transform(self, X):
3103
3104
Returns
3104
3105
-------
3105
3106
X : ndarray of shape (n_samples, n_features)
3106
- The original data
3107
+ The original data.
3107
3108
"""
3108
3109
check_is_fitted (self )
3109
3110
X = self ._check_input (X , in_fit = False , check_shape = True )
0 commit comments