@@ -28,10 +28,10 @@ class KBinsDiscretizer(TransformerMixin, BaseEstimator):
28
28
29
29
Parameters
30
30
----------
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
32
32
The number of bins to produce. Raises ValueError if ``n_bins < 2``.
33
33
34
- encode : {'onehot', 'onehot-dense', 'ordinal'}, ( default='onehot')
34
+ encode : {'onehot', 'onehot-dense', 'ordinal'}, default='onehot'
35
35
Method used to encode the transformed result.
36
36
37
37
onehot
@@ -45,7 +45,7 @@ class KBinsDiscretizer(TransformerMixin, BaseEstimator):
45
45
ordinal
46
46
Return the bin identifier encoded as an integer value.
47
47
48
- strategy : {'uniform', 'quantile', 'kmeans'}, ( default='quantile')
48
+ strategy : {'uniform', 'quantile', 'kmeans'}, default='quantile'
49
49
Strategy used to define the widths of the bins.
50
50
51
51
uniform
@@ -63,11 +63,11 @@ class KBinsDiscretizer(TransformerMixin, BaseEstimator):
63
63
64
64
Attributes
65
65
----------
66
- n_bins_ : int array, shape (n_features,)
66
+ n_bins_ : ndarray of shape (n_features,), dtype=np.int_
67
67
Number of bins per feature. Bins whose width are too small
68
68
(i.e., <= 1e-8) are removed with a warning.
69
69
70
- bin_edges_ : array of arrays, shape (n_features, )
70
+ bin_edges_ : ndarray of ndarray of shape (n_features,)
71
71
The edges of each bin. Contain arrays of varying shapes ``(n_bins_, )``
72
72
Ignored features will have empty arrays.
73
73
@@ -137,7 +137,7 @@ def fit(self, X, y=None):
137
137
138
138
Parameters
139
139
----------
140
- X : numeric array-like, shape (n_samples, n_features)
140
+ X : array-like of shape (n_samples, n_features), dtype={int, float}
141
141
Data to be discretized.
142
142
143
143
y : None
@@ -274,13 +274,14 @@ def transform(self, X):
274
274
275
275
Parameters
276
276
----------
277
- X : numeric array-like, shape (n_samples, n_features)
277
+ X : array-like of shape (n_samples, n_features), dtype={int, float}
278
278
Data to be discretized.
279
279
280
280
Returns
281
281
-------
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.
284
285
"""
285
286
check_is_fitted (self )
286
287
@@ -328,12 +329,12 @@ def inverse_transform(self, Xt):
328
329
329
330
Parameters
330
331
----------
331
- Xt : numeric array-like, shape (n_sample , n_features)
332
+ Xt : array-like of shape (n_samples , n_features), dtype={int, float}
332
333
Transformed data in the binned space.
333
334
334
335
Returns
335
336
-------
336
- Xinv : numeric array-like
337
+ Xinv : ndarray, dtype={np.float32, np.float64}
337
338
Data in the original feature space.
338
339
"""
339
340
check_is_fitted (self )
0 commit comments