1- """Classes to perform under-sampling based on the edited nearest neighbour
1+ """Classes to perform under-sampling based on the edited nearest neighbor
22method."""
33
44# Authors: Guillaume Lemaitre <[email protected] > 2727 n_jobs = _n_jobs_docstring ,
2828)
2929class EditedNearestNeighbours (BaseCleaningSampler ):
30- """Undersample based on the edited nearest neighbour method.
30+ """Undersample based on the edited nearest neighbor method.
3131
3232 This method will clean the data set by removing samples close to the
3333 decision boundary.
@@ -39,17 +39,17 @@ class EditedNearestNeighbours(BaseCleaningSampler):
3939 {sampling_strategy}
4040
4141 n_neighbors : int or object, default=3
42- If ``int``, size of the neighbourhood to consider to compute the
43- nearest neighbours . If object, an estimator that inherits from
42+ If ``int``, size of the neighborhood to consider to compute the
43+ nearest neighbors . If object, an estimator that inherits from
4444 :class:`~sklearn.neighbors.base.KNeighborsMixin` that will be used to
45- find the nearest-neighbours .
45+ find the nearest-neighbors .
4646
4747 kind_sel : {{'all', 'mode'}}, default='all'
4848 Strategy to use in order to exclude samples.
4949
50- - If ``'all'``, all neighbours will have to agree with a sample in order
50+ - If ``'all'``, all neighbors will have to agree with a sample in order
5151 not to be excluded.
52- - If ``'mode'``, the majority of the neighbours will have to agree with
52+ - If ``'mode'``, the majority of the neighbors will have to agree with
5353 a sample in order not to be excluded.
5454
5555 The strategy `"all"` will be less conservative than `'mode'`. Thus,
@@ -70,7 +70,7 @@ class EditedNearestNeighbours(BaseCleaningSampler):
7070
7171 RepeatedEditedNearestNeighbours : Undersample by repeating ENN algorithm.
7272
73- AllKNN : Undersample using ENN and various number of neighbours .
73+ AllKNN : Undersample using ENN and various number of neighbors .
7474
7575 Notes
7676 -----
@@ -172,7 +172,7 @@ def _more_tags(self):
172172 n_jobs = _n_jobs_docstring ,
173173)
174174class RepeatedEditedNearestNeighbours (BaseCleaningSampler ):
175- """Undersample based on the repeated edited nearest neighbour method.
175+ """Undersample based on the repeated edited nearest neighbor method.
176176
177177 This method will repeat the ENN algorithm several times. The repetitions
178178 will stop when i) the maximum number of iterations is reached, or ii) no
@@ -187,20 +187,20 @@ class RepeatedEditedNearestNeighbours(BaseCleaningSampler):
187187 {sampling_strategy}
188188
189189 n_neighbors : int or object, default=3
190- If ``int``, size of the neighbourhood to consider to compute the
191- nearest neighbours . If object, an estimator that inherits from
190+ If ``int``, size of the neighborhood to consider to compute the
191+ nearest neighbors . If object, an estimator that inherits from
192192 :class:`~sklearn.neighbors.base.KNeighborsMixin` that will be used to
193- find the nearest-neighbours .
193+ find the nearest-neighbors .
194194
195195 max_iter : int, default=100
196- Maximum number of repetitions of the edited nearest neighbours algorithm.
196+ Maximum number of repetitions of the edited nearest neighbors algorithm.
197197
198198 kind_sel : {{'all', 'mode'}}, default='all'
199199 Strategy to use in order to exclude samples.
200200
201- - If ``'all'``, all neighbours will have to agree with a sample in order
201+ - If ``'all'``, all neighbors will have to agree with a sample in order
202202 not to be excluded.
203- - If ``'mode'``, the majority of the neighbours will have to agree with
203+ - If ``'mode'``, the majority of the neighbors will have to agree with
204204 a sample in order not to be excluded.
205205
206206 The strategy `"all"` will be less conservative than `'mode'`. Thus,
@@ -226,7 +226,7 @@ class RepeatedEditedNearestNeighbours(BaseCleaningSampler):
226226
227227 EditedNearestNeighbours : Undersample by editing samples.
228228
229- AllKNN : Undersample using ENN and various number of neighbours .
229+ AllKNN : Undersample using ENN and various number of neighbors .
230230
231231 Notes
232232 -----
@@ -364,8 +364,8 @@ class AllKNN(BaseCleaningSampler):
364364 """Undersample based on the AllKNN method.
365365
366366 This method will apply ENN several times, starting by looking at the
367- 1 closest neighbour , and increasing the number of nearest neighbours
368- by 1 at each round, up to the number of neighbours specified in
367+ 1 closest neighbor , and increasing the number of nearest neighbors
368+ by 1 at each round, up to the number of neighbors specified in
369369 `n_neighbors`.
370370
371371 The repetitions will stop when i) one of the majority classes
@@ -379,23 +379,24 @@ class AllKNN(BaseCleaningSampler):
379379 {sampling_strategy}
380380
381381 n_neighbors : int or estimator object, default=3
382- If ``int``, the maximum size of the neighbourhood to evaluate.
383- The method will start by looking at the 1 closest neighbour , and
384- then repeat the edited nearest neighbours increasing
385- the neighbourhood by 1, until examining a neighbourhood of
382+ If ``int``, the maximum size of the the neighborhood to evaluate.
383+ The method will start by looking at the 1 closest neighbor , and
384+ then repeat the edited nearest neighbors increasing
385+ the neighborhood by 1, until examining a neighborhood of
386386 `n_neighbors` in the final iteration.
387+
387388 If object, an estimator that inherits from
388389 :class:`~sklearn.neighbors.base.KNeighborsMixin` that will be used to
389- find the nearest-neighbours in the final round. In this case,
390- AllKNN will repeat edited nearest neighbours starting from a 2-KNN
390+ find the nearest-neighbors in the final round. In this case,
391+ AllKNN will repeat edited nearest neighbors starting from a 2-KNN
391392 up to the specified KNN in the object.
392393
393394 kind_sel : {{'all', 'mode'}}, default='all'
394395 Strategy to use in order to exclude samples.
395396
396- - If ``'all'``, all neighbours will have to agree with a sample in order
397+ - If ``'all'``, all neighbors will have to agree with a sample in order
397398 not to be excluded.
398- - If ``'mode'``, the majority of the neighbours will have to agree with
399+ - If ``'mode'``, the majority of the neighbors will have to agree with
399400 a sample in order not to be excluded.
400401
401402 The strategy `"all"` will be less conservative than `'mode'`. Thus,
@@ -434,7 +435,7 @@ class without early stopping.
434435 References
435436 ----------
436437 .. [1] I. Tomek, "An Experiment with the Edited Nearest-Neighbor
437- Rule," IEEE Transactions on Systems, Man, and Cybernetics, vol. 6(6),
438+ Rule", IEEE Transactions on Systems, Man, and Cybernetics, vol. 6(6),
438439 pp. 448-452, June 1976.
439440
440441 Examples
0 commit comments