@@ -32,17 +32,16 @@ def fit(self, X, y):
3232
3333 Parameters
3434 ----------
35- X : {array-like, sparse matrix}, shape (n_samples, n_features)
35+ X : {array-like, sparse matrix} of shape (n_samples, n_features)
3636 Data array.
3737
38- y : array-like, shape (n_samples,)
38+ y : array-like of shape (n_samples,)
3939 Target array.
4040
4141 Returns
4242 -------
4343 self : object
4444 Return the instance itself.
45-
4645 """
4746 X , y , _ = self ._check_X_y (X , y )
4847 self .sampling_strategy_ = check_sampling_strategy (
@@ -55,21 +54,20 @@ def fit_resample(self, X, y):
5554
5655 Parameters
5756 ----------
58- X : {array-like, sparse matrix}, shape (n_samples, n_features)
57+ X : {array-like, sparse matrix} of shape (n_samples, n_features)
5958 Matrix containing the data which have to be sampled.
6059
61- y : array-like, shape (n_samples,)
60+ y : array-like of shape (n_samples,)
6261 Corresponding label for each sample in X.
6362
6463 Returns
6564 -------
66- X_resampled : {array-like, sparse matrix}, shape \
67- (n_samples_new, n_features)
65+ X_resampled : {array-like, sparse matrix} of shape \
66+ (n_samples_new, n_features)
6867 The array containing the resampled data.
6968
70- y_resampled : array-like, shape (n_samples_new,)
69+ y_resampled : array-like of shape (n_samples_new,)
7170 The corresponding label of `X_resampled`.
72-
7371 """
7472 check_classification_targets (y )
7573 X , y , binarize_y = self ._check_X_y (X , y )
@@ -97,20 +95,20 @@ def _fit_resample(self, X, y):
9795
9896 Parameters
9997 ----------
100- X : {array-like, sparse matrix}, shape (n_samples, n_features)
98+ X : {array-like, sparse matrix} of shape (n_samples, n_features)
10199 Matrix containing the data which have to be sampled.
102100
103- y : array-like, shape (n_samples,)
101+ y : array-like of shape (n_samples,)
104102 Corresponding label for each sample in X.
105103
106104 Returns
107105 -------
108- X_resampled : {ndarray, sparse matrix}, shape \
109- (n_samples_new, n_features)
106+ X_resampled : {ndarray, sparse matrix} of shape \
107+ (n_samples_new, n_features)
110108 The array containing the resampled data.
111109
112- y_resampled : ndarray, shape (n_samples_new,)
113- The corresponding label of `X_resampled`
110+ y_resampled : ndarray of shape (n_samples_new,)
111+ The corresponding label of `X_resampled`.
114112
115113 """
116114 pass
@@ -146,26 +144,30 @@ class FunctionSampler(BaseSampler):
146144
147145 Parameters
148146 ----------
149- func : callable or None,
147+ func : callable, default= None
150148 The callable to use for the transformation. This will be passed the
151149 same arguments as transform, with args and kwargs forwarded. If func is
152150 None, then func will be the identity function.
153151
154- accept_sparse : bool, optional ( default=True)
152+ accept_sparse : bool, default=True
155153 Whether sparse input are supported. By default, sparse inputs are
156154 supported.
157155
158- kw_args : dict, optional ( default=None)
156+ kw_args : dict, default=None
159157 The keyword argument expected by ``func``.
160158
161159 validate : bool, default=True
162160 Whether or not to bypass the validation of ``X`` and ``y``. Turning-off
163161 validation allows to use the ``FunctionSampler`` with any type of
164162 data.
165163
164+ See Also
165+ --------
166+
167+ sklearn.preprocessing.FunctionTransfomer : Stateless transformer.
168+
166169 Notes
167170 -----
168-
169171 See
170172 :ref:`sphx_glr_auto_examples_plot_outlier_rejections.py`
171173
@@ -204,7 +206,6 @@ class FunctionSampler(BaseSampler):
204206 >>> print('Resampled dataset shape {}'.format(
205207 ... sorted(Counter(y_res).items())))
206208 Resampled dataset shape [(0, 100), (1, 100)]
207-
208209 """
209210
210211 _sampling_type = "bypass"
@@ -222,21 +223,20 @@ def fit_resample(self, X, y):
222223
223224 Parameters
224225 ----------
225- X : {array-like, sparse matrix}, shape (n_samples, n_features)
226+ X : {array-like, sparse matrix} of shape (n_samples, n_features)
226227 Matrix containing the data which have to be sampled.
227228
228- y : array-like, shape (n_samples,)
229+ y : array-like of shape (n_samples,)
229230 Corresponding label for each sample in X.
230231
231232 Returns
232233 -------
233- X_resampled : {array-like, sparse matrix}, shape \
234- (n_samples_new, n_features)
234+ X_resampled : {array-like, sparse matrix} of shape \
235+ (n_samples_new, n_features)
235236 The array containing the resampled data.
236237
237- y_resampled : array-like, shape (n_samples_new,)
238+ y_resampled : array-like of shape (n_samples_new,)
238239 The corresponding label of `X_resampled`.
239-
240240 """
241241 if self .validate :
242242 check_classification_targets (y )
0 commit comments