8000 DOC Fix default values, shape and dtype for preprocessing._discretiza… · NicolasHug/scikit-learn@0784207 · GitHub
[go: up one dir, main page]

Skip to content

Commit 0784207

Browse files
DOC Fix default values, shape and dtype for preprocessing._discretization.py (scikit-learn#18290)
Co-authored-by: Juan Carlos Alfaro Jiménez <JuanCarlos.Alfaro@uclm.es>
1 parent e103b53 commit 0784207

File tree

1 file changed

+12
-11
lines changed

1 file changed

+12
-11
lines changed

sklearn/preprocessing/_discretization.py

Lines changed: 12 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -28,10 +28,10 @@ class KBinsDiscretizer(TransformerMixin, BaseEstimator):
2828
2929
Parameters
3030
----------
31-
n_bins : int or array-like, shape (n_features,) (default=5)
31+
n_bins : int or array-like of shape (n_features,), default=5
3232
The number of bins to produce. Raises ValueError if ``n_bins < 2``.
3333
34-
encode : {'onehot', 'onehot-dense', 'ordinal'}, (default='onehot')
34+
encode : {'onehot', 'onehot-dense', 'ordinal'}, default='onehot'
3535
Method used to encode the transformed result.
3636
3737
onehot
@@ -45,7 +45,7 @@ class KBinsDiscretizer(TransformerMixin, BaseEstimator):
4545
ordinal
4646
Return the bin identifier encoded as an integer value.
4747
48-
strategy : {'uniform', 'quantile', 'kmeans'}, (default='quantile')
48+
strategy : {'uniform', 'quantile', 'kmeans'}, default='quantile'
4949
Strategy used to define the widths of the bins.
5050
5151
uniform
@@ -63,11 +63,11 @@ class KBinsDiscretizer(TransformerMixin, BaseEstimator):
6363
6464
Attributes
6565
----------
66-
n_bins_ : int array, shape (n_features,)
66+
n_bins_ : ndarray of shape (n_features,), dtype=np.int_
6767
Number of bins per feature. Bins whose width are too small
6868
(i.e., <= 1e-8) are removed with a warning.
6969
70-
bin_edges_ : array of arrays, shape (n_features, )
70+
bin_edges_ : ndarray of ndarray of shape (n_features,)
7171
The edges of each bin. Contain arrays of varying shapes ``(n_bins_, )``
7272
Ignored features will have empty arrays.
7373
@@ -137,7 +137,7 @@ def fit(self, X, y=None):
137137
138138
Parameters
139139
----------
140-
X : numeric array-like, shape (n_samples, n_features)
140+
X : array-like of shape (n_samples, n_features), dtype={int, float}
141141
Data to be discretized.
142142
143143
y : None
@@ -274,13 +274,14 @@ def transform(self, X):
274274
275275
Parameters
276276
----------
277-
X : numeric array-like, shape (n_samples, n_features)
277+
X : array-like of shape (n_samples, n_features), dtype={int, float}
278278
Data to be discretized.
279279
280280
Returns
281281
-------
282-
Xt : numeric array-like or sparse matrix
283-
Data in the binned space.
282+
Xt : {ndarray, sparse matrix}, dtype={np.float32, np.float64}
283+
Data in the binned space. Will be a sparse matrix if
284+
`self.encode='onehot'` and ndarray otherwise.
284285
"""
285286
check_is_fitted(self)
286287

@@ -328,12 +329,12 @@ def inverse_transform(self, Xt):
328329
329330
Parameters
330331
----------
331-
Xt : numeric array-like, shape (n_sample, n_features)
332+
Xt : array-like of shape (n_samples, n_features), dtype={int, float}
332333
Transformed data in the binned space.
333334
334335
Returns
335336
-------
336-
Xinv : numeric array-like
337+
Xinv : ndarray, dtype={np.float32, np.float64}
337338
Data in the original feature space.
338339
"""
339340
check_is_fitted(self)

0 commit comments

Comments
 (0)
0