8000 DOC fix docstring in preprocessing module following doc guideline (#1… · alexshacked/scikit-learn@39ad424 · GitHub
[go: up one dir, main page]

Skip to content

Commit 39ad424

Browse files
authored
DOC fix docstring in preprocessing module following doc guideline (scikit-learn#18239)
1 parent 8ff1a93 commit 39ad424

File tree

1 file changed

+19
-18
lines changed

1 file changed

+19
-18
lines changed

sklearn/preprocessing/_data.py

Lines changed: 19 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -61,9 +61,10 @@
6161

6262

6363
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.
6565
66-
This happens in most scalers when we have constant features.'''
66+
This happens in most scalers when we have constant features.
67+
"""
6768

6869
# if we are fitting on 1D arrays, scale might be a scalar
6970
if np.isscalar(scale):
@@ -80,7 +81,7 @@ def _handle_zeros_in_scale(scale, copy=True):
8081

8182
@_deprecate_positional_args
8283
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.
8485
8586
Center to the mean and component wise scale to unit variance.
8687
@@ -1526,7 +1527 8000 ,7 @@ class PolynomialFeatures(TransformerMixin, BaseEstimator):
15261527
15271528
Parameters
15281529
----------
1529-
degree : integer, default=2
1530+
degree : int, default=2
15301531
The degree of the polynomial features.
15311532
15321533
interaction_only : bool, default=False
@@ -2011,7 +2012,7 @@ def _more_tags(self):
20112012

20122013
@_deprecate_positional_args
20132014
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.
20152016
20162017
Read more in the :ref:`User Guide <preprocessing_binarization>`.
20172018
@@ -2060,7 +2061,7 @@ def binarize(X, *, threshold=0.0, copy=True):
20602061

20612062

20622063
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.
20642065
20652066
Values greater than the threshold map to 1, while values less than
20662067
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):
21192120
self.copy = copy
21202121

21212122
def fit(self, X, y=None):
2122-
"""Do nothing and return the estimator unchanged
2123+
"""Do nothing and return the estimator unchanged.
21232124
21242125
This method is just there to implement the usual API and hence
21252126
work in pipelines.
@@ -2141,7 +2142,7 @@ def fit(self, X, y=None):
21412142
return self
21422143

21432144
def transform(self, X, copy=None):
2144-
"""Binarize each element of X
2145+
"""Binarize each element of X.
21452146
21462147
Parameters
21472148
----------
@@ -2166,7 +2167,7 @@ def _more_tags(self):
21662167

21672168

21682169
class KernelCenterer(TransformerMixin, BaseEstimator):
2169-
"""Center a kernel matrix
2170+
"""Center a kernel matrix.
21702171
21712172
Let K(x, z) be a kernel defined by phi(x)^T phi(z), where phi is a
21722173
function mapping x to a Hilbert space. KernelCenterer centers (i.e.,
@@ -2179,10 +2180,10 @@ class KernelCenterer(TransformerMixin, BaseEstimator):
21792180
Attributes
21802181
----------
21812182
K_fit_rows_ : array of shape (n_samples,)
2182-
Average of each column of kernel matrix
2183+
Average of each column of kernel matrix.
21832184
21842185
K_fit_all_ : float
2185-
Average of kernel matrix
2186+
Average of kernel matrix.
21862187
21872188
Examples
21882189
--------
@@ -2374,7 +2375,7 @@ class QuantileTransformer(TransformerMixin, BaseEstimator):
23742375
computational efficiency. Note that the subsampling procedure may
23752376
differ for value-identical sparse and dense matrices.
23762377
2377-
random_state : int or RandomState instance, default=None
2378+
random_state : int, RandomState instance or None, default=None
23782379
Determines random number generation for subsampling and smoothing
23792380
noise.
23802381
Please see ``subsample`` for more details.
@@ -2575,7 +2576,7 @@ def fit(self, X, y=None):
25752576
return self
25762577

25772578
def _transform_col(self, X_col, quantiles, inverse):
2578-
"""Private function to transform a single feature"""
2579+
"""Private function to transform a single feature."""
25792580

25802581
output_distribution = self.output_distribution
25812582

@@ -2645,7 +2646,7 @@ def _transform_col(self, X_col, quantiles, inverse):
26452646

26462647
def _check_inputs(self, X, in_fit, accept_sparse_negative=False,
26472648
copy=False):
2648-
"""Check inputs before fit and transform"""
2649+
"""Check inputs before fit and transform."""
26492650
# In theory reset should be equal to `in_fit`, but there are tests
26502651
# checking the input number of feature and they expect a specific
26512652
# 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,
26762677
return X
26772678

26782679
def _check_is_fitted(self, X):
2679-
"""Check the inputs before transforming"""
2680+
"""Check the inputs before transforming."""
26802681
check_is_fitted(self)
26812682
# check that the dimension of X are adequate with the fitted data
26822683
if X.shape[1] != self.quantiles_.shape[1]:
@@ -2700,7 +2701,7 @@ def _transform(self, X, inverse=False):
27002701
Returns
27012702
-------
27022703
X : ndarray of shape (n_samples, n_features)
2703-
Projected data
2704+
Projected data.
27042705
"""
27052706

27062707
if sparse.issparse(X):
@@ -2822,7 +2823,7 @@ def quantile_transform(X, *, axis=0, n_quantiles=1000,
28222823
computational efficiency. Note that the subsampling procedure may
28232824
differ for value-identical sparse and dense matrices.
28242825
2825-
random_state : int or RandomState instance, default=None
2826+
random_state : int, RandomState instance or None, default=None
28262827
Determines random number generation for subsampling and smoothing
28272828
noise.
28282829
Please see ``subsample`` for more details.
@@ -3103,7 +3104,7 @@ def inverse_transform(self, X):
31033104
Returns
31043105
-------
31053106
X : ndarray of shape (n_samples, n_features)
3106-
The original data
3107+
The original data.
31073108
"""
31083109
check_is_fitted(self)
31093110
X = self._check_input(X, in_fit=False, check_shape=True)

0 commit comments

Comments
 (0)
0