Skip to content

Commit b97b7d9

Browse files
authored
DOC: Remove docstring from _sample method (#454)
1 parent ea4fcc4 commit b97b7d9

17 files changed

+11
-388
lines changed

doc/whats_new/v0.0.4.rst

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -78,6 +78,15 @@ Maintenance
7878
- Remove deprecated parameters in 0.2 - :issue:`331` by :user:`Guillaume
7979
Lemaitre <glemaitre>`.
8080

81+
- Make some modules private.
82+
:issue:`452` by :user:`Guillaume Lemaitre <glemaitre>`.
83+
84+
Documentation
85+
.............
86+
87+
- Remove some docstring which are not necessary.
88+
:issue:`454` by :user:`Guillaume Lemaitre <glemaitre>`.
89+
8190
Deprecation
8291
...........
8392

imblearn/base.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -95,7 +95,8 @@ def fit_sample(self, X, y):
9595

9696
@abstractmethod
9797
def _sample(self, X, y):
98-
"""Resample the dataset.
98+
"""Base method defined in each sampler to defined the sampling
99+
strategy.
99100
100101
Parameters
101102
----------

imblearn/combine/_smote_enn.py

Lines changed: 0 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -149,26 +149,6 @@ def fit(self, X, y):
149149
return self
150150

151151
def _sample(self, X, y):
152-
"""Resample the dataset.
153-
154-
Parameters
155-
----------
156-
X : {array-like, sparse matrix}, shape (n_samples, n_features)
157-
Matrix containing the data which have to be sampled.
158-
159-
y : array-like, shape (n_samples,)
160-
Corresponding label for each sample in X.
161-
162-
Returns
163-
-------
164-
X_resampled : {ndarray, sparse matrix}, shape \
165-
(n_samples_new, n_features)
166-
The array containing the resampled data.
167-
168-
y_resampled : ndarray, shape (n_samples_new)
169-
The corresponding label of `X_resampled`
170-
171-
"""
172152
self._validate_estimator()
173153

174154
X_res, y_res = self.smote_.fit_sample(X, y)

imblearn/combine/_smote_tomek.py

Lines changed: 0 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -157,26 +157,6 @@ def fit(self, X, y):
157157
return self
158158

159159
def _sample(self, X, y):
160-
"""Resample the dataset.
161-
162-
Parameters
163-
----------
164-
X : {array-like, sparse matrix}, shape (n_samples, n_features)
165-
Matrix containing the data which have to be sampled.
166-
167-
y : array-like, shape (n_samples,)
168-
Corresponding label for each sample in X.
169-
170-
Returns
171-
-------
172-
X_resampled : {ndarray, sparse matrix}, shape \
173-
(n_samples_new, n_features)
174-
The array containing the resampled data.
175-
176-
y_resampled : ndarray, shape (n_samples_new,)
177-
The corresponding label of `X_resampled`
178-
179-
"""
180160
self._validate_estimator()
181161

182162
X_res, y_res = self.smote_.fit_sample(X, y)

imblearn/ensemble/_balance_cascade.py

Lines changed: 0 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -152,30 +152,6 @@ def _validate_estimator(self):
152152
self.logger.debug(self.estimator_)
153153

154154
def _sample(self, X, y):
155-
"""Resample the dataset.
156-
157-
Parameters
158-
----------
159-
X : {array-like, sparse matrix}, shape (n_samples, n_features)
160-
Matrix containing the data which have to be sampled.
161-
162-
y : array-like, shape (n_samples,)
163-
Corresponding label for each sample in X.
164-
165-
Returns
166-
-------
167-
X_resampled : {ndarray, sparse matrix}, shape \
168-
(n_subset, n_samples_new, n_features)
169-
The array containing the resampled data.
170-
171-
y_resampled : ndarray, shape (n_subset, n_samples_new)
172-
The corresponding label of `X_resampled`
173-
174-
idx_under : ndarray, shape (n_subset, n_samples, )
175-
If `return_indices` is `True`, a boolean array will be returned
176-
containing the which samples have been selected.
177-
178-
"""
179155
self._validate_estimator()
180156

181157
random_state = check_random_state(self.random_state)

imblearn/ensemble/_easy_ensemble.py

Lines changed: 0 additions & 25 deletions
Original file line numberDiff line numberDiff line change
@@ -102,31 +102,6 @@ def __init__(self,
102102
self.n_subsets = n_subsets
103103

104104
def _sample(self, X, y):
105-
"""Resample the dataset.
106-
107-
Parameters
108-
----------
109-
X : {array-like, sparse matrix}, shape (n_samples, n_features)
110-
Matrix containing the data which have to be sampled.
111-
112-
y : array-like, shape (n_samples,)
113-
Corresponding label for each sample in X.
114-
115-
Returns
116-
-------
117-
X_resampled : {ndarray, sparse matrix}, shape \
118-
(n_subset, n_samples_new, n_features)
119-
The array containing the resampled data.
120-
121-
y_resampled : ndarray, shape (n_subset, n_samples_new)
122-
The corresponding label of `X_resampled`
123-
124-
idx_under : ndarray, shape (n_subset, n_samples, )
125-
If `return_indices` is `True`, a boolean array will be returned
126-
containing the which samples have been selected.
127-
128-
"""
129-
130105
random_state = check_random_state(self.random_state)
131106

132107
X_resampled = []

imblearn/over_sampling/_adasyn.py

Lines changed: 0 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -107,27 +107,6 @@ def _validate_estimator(self):
107107
self.nn_.set_params(**{'n_jobs': self.n_jobs})
108108

109109
def _sample(self, X, y):
110-
"""Resample the dataset.
111-
112-
Parameters
113-
----------
114-
X : {array-like, sparse matrix}, shape (n_samples, n_features)
115-
Matrix containing the data which have to be sampled.
116-
117-
y : array-like, shape (n_samples,)
118-
Corresponding label for each sample in X.
119-
120-
Returns
121-
-------
122-
X_resampled : {ndarray, sparse matrix}, shape \
123-
(n_samples_new, n_features)
124-
The array containing the resampled data.
125-
126-
y_resampled : ndarray, shape (n_samples_new,)
127-
The corresponding label of `X_resampled`
128-
129-
130-
"""
131110
self._validate_estimator()
132111
random_state = check_random_state(self.random_state)
133112

imblearn/over_sampling/_random_over_sampler.py

Lines changed: 0 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -89,26 +89,6 @@ def _check_X_y(X, y):
8989
return X, y, binarize_y
9090

9191
def _sample(self, X, y):
92-
"""Resample the dataset.
93-
94-
Parameters
95-
----------
96-
X : {array-like, sparse matrix}, shape (n_samples, n_features)
97-
Matrix containing the data which have to be sampled.
98-
99-
y : array-like, shape (n_samples,)
100-
Corresponding label for each sample in X.
101-
102-
Returns
103-
-------
104-
X_resampled : {ndarray, sparse matrix}, shape \
105-
(n_samples_new, n_features)
106-
The array containing the resampled data.
107-
108-
y_resampled : ndarray, shape (n_samples_new,)
109-
The corresponding label of `X_resampled`
110-
111-
"""
11292
random_state = check_random_state(self.random_state)
11393
target_stats = Counter(y)
11494

imblearn/under_sampling/_prototype_generation/_cluster_centroids.py

Lines changed: 0 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -136,26 +136,6 @@ def _generate_sample(self, X, y, centroids, target_class):
136136
return X_new, y_new
137137

138138
def _sample(self, X, y):
139-
"""Resample the dataset.
140-
141-
Parameters
142-
----------
143-
X : {array-like, sparse matrix}, shape (n_samples, n_features)
144-
Matrix containing the data which have to be sampled.
145-
146-
y : array-like, shape (n_samples,)
147-
Corresponding label for each sample in X.
148-
149-
Returns
150-
-------
151-
X_resampled : {ndarray, sparse matrix}, shape \
152-
(n_samples_new, n_features)
153-
The array containing the resampled data.
154-
155-
y_resampled : ndarray, shape (n_samples_new,)
156-
The corresponding label of `X_resampled`
157-
158-
"""
159139
self._validate_estimator()
160140

161141
if self.voting == 'auto':

imblearn/under_sampling/_prototype_selection/_condensed_nearest_neighbour.py

Lines changed: 0 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -129,30 +129,6 @@ def _validate_estimator(self):
129129
' Got {} instead.'.format(type(self.n_neighbors)))
130130

131131
def _sample(self, X, y):
132-
"""Resample the dataset.
133-
134-
Parameters
135-
----------
136-
X : {array-like, sparse matrix}, shape (n_samples, n_features)
137-
Matrix containing the data which have to be sampled.
138-
139-
y : array-like, shape (n_samples,)
140-
Corresponding label for each sample in X.
141-
142-
Returns
143-
-------
144-
X_resampled : {ndarray, sparse matrix}, shape \
145-
(n_samples_new, n_features)
146-
The array containing the resampled data.
147-
148-
y_resampled : ndarray, shape (n_samples_new,)
149-
The corresponding label of `X_resampled`
150-
151-
idx_under : ndarray, shape (n_samples, )
152-
If `return_indices` is `True`, a boolean array will be returned
153-
containing the which samples have been selected.
154-
155-
"""
156132
self._validate_estimator()
157133

158134
random_state = check_random_state(self.random_state)

0 commit comments

Comments
 (0)