Skip to content

Commit 0492553

Browse files
authored
DOC update several docsting (#624)
1 parent 7c06a1a commit 0492553

File tree

17 files changed

+150
-71
lines changed

17 files changed

+150
-71
lines changed

doc/ensemble.rst

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -59,7 +59,7 @@ random under-sampler::
5959
BalancedBaggingClassifier(...)
6060
>>> y_pred = bbc.predict(X_test)
6161
>>> balanced_accuracy_score(y_test, y_pred) # doctest: +ELLIPSIS
62-
0.80...
62+
0.8...
6363

6464
.. _forest:
6565

examples/model_selection/plot_validation_curve.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -39,7 +39,7 @@
3939
param_range = range(1, 11)
4040
train_scores, test_scores = ms.validation_curve(
4141
pipeline, X, y, param_name="smote__k_neighbors", param_range=param_range,
42-
cv=3, scoring=scorer, n_jobs=1)
42+
cv=3, scoring=scorer)
4343
train_scores_mean = np.mean(train_scores, axis=1)
4444
train_scores_std = np.std(train_scores, axis=1)
4545
test_scores_mean = np.mean(test_scores, axis=1)

imblearn/combine/_smote_enn.py

Lines changed: 7 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -45,9 +45,12 @@ class SMOTEENN(BaseSampler):
4545
:class:`imblearn.under_sampling.EditedNearestNeighbours` object with
4646
sampling strategy='all' will be given.
4747
48-
n_jobs : int, optional (default=1)
49-
The number of threads to open if possible.
50-
Will not apply to smote and enn given by the user.
48+
n_jobs : int or None, optional (default=None)
49+
Number of CPU cores used during the cross-validation loop.
50+
``None`` means 1 unless in a :obj:`joblib.parallel_backend` context.
51+
``-1`` means using all processors. See
52+
`Glossary <https://scikit-learn.org/stable/glossary.html#term-n-jobs>`_
53+
for more details.
5154
5255
Notes
5356
-----
@@ -93,7 +96,7 @@ def __init__(
9396
random_state=None,
9497
smote=None,
9598
enn=None,
96-
n_jobs=1,
99+
n_jobs=None,
97100
):
98101
super().__init__()
99102
self.sampling_strategy = sampling_strategy

imblearn/combine/_smote_tomek.py

Lines changed: 7 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -45,9 +45,12 @@ class SMOTETomek(BaseSampler):
4545
given, a :class:`imblearn.under_sampling.TomekLinks` object with
4646
sampling strategy='all' will be given.
4747
48-
n_jobs : int, optional (default=1)
49-
The number of threads to open if possible.
50-
Will not apply to smote and tomek given by the user.
48+
n_jobs : int or None, optional (default=None)
49+
Number of CPU cores used during the cross-validation loop.
50+
``None`` means 1 unless in a :obj:`joblib.parallel_backend` context.
51+
``-1`` means using all processors. See
52+
`Glossary <https://scikit-learn.org/stable/glossary.html#term-n-jobs>`_
53+
for more details.
5154
5255
Notes
5356
-----
@@ -93,7 +96,7 @@ def __init__(
9396
random_state=None,
9497
smote=None,
9598
tomek=None,
96-
n_jobs=1,
99+
n_jobs=None,
97100
):
98101
super().__init__()
99102
self.sampling_strategy = sampling_strategy

imblearn/ensemble/_bagging.py

Lines changed: 7 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -73,9 +73,12 @@ class BalancedBaggingClassifier(BaggingClassifier):
7373
replacement : bool, optional (default=False)
7474
Whether or not to sample randomly with replacement or not.
7575
76-
n_jobs : int, optional (default=1)
77-
The number of jobs to run in parallel for both `fit` and `predict`.
78-
If -1, then the number of jobs is set to the number of cores.
76+
n_jobs : int or None, optional (default=None)
77+
Number of CPU cores used during the cross-validation loop.
78+
``None`` means 1 unless in a :obj:`joblib.parallel_backend` context.
79+
``-1`` means using all processors. See
80+
`Glossary <https://scikit-learn.org/stable/glossary.html#term-n-jobs>`_
81+
for more details.
7982
8083
{random_state}
8184
@@ -178,7 +181,7 @@ def __init__(
178181
warm_start=False,
179182
sampling_strategy="auto",
180183
replacement=False,
181-
n_jobs=1,
184+
n_jobs=None,
182185
random_state=None,
183186
verbose=0,
184187
):

imblearn/ensemble/_easy_ensemble.py

Lines changed: 7 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -53,9 +53,12 @@ class EasyEnsembleClassifier(BaggingClassifier):
5353
replacement : bool, optional (default=False)
5454
Whether or not to sample randomly with replacement or not.
5555
56-
n_jobs : int, optional (default=1)
57-
The number of jobs to run in parallel for both `fit` and `predict`.
58-
If -1, then the number of jobs is set to the number of cores.
56+
n_jobs : int or None, optional (default=None)
57+
Number of CPU cores used during the cross-validation loop.
58+
``None`` means 1 unless in a :obj:`joblib.parallel_backend` context.
59+
``-1`` means using all processors. See
60+
`Glossary <https://scikit-learn.org/stable/glossary.html#term-n-jobs>`_
61+
for more details.
5962
6063
{random_state}
6164
@@ -126,7 +129,7 @@ def __init__(
126129
warm_start=False,
127130
sampling_strategy="auto",
128131
replacement=False,
129-
n_jobs=1,
132+
n_jobs=None,
130133
random_state=None,
131134
verbose=0,
132135
):

imblearn/ensemble/_forest.py

Lines changed: 7 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -161,9 +161,12 @@ class BalancedRandomForestClassifier(RandomForestClassifier):
161161
replacement : bool, optional (default=False)
162162
Whether or not to sample randomly with replacement or not.
163163
164-
n_jobs : int, optional (default=1)
165-
The number of jobs to run in parallel for both `fit` and `predict`.
166-
If -1, then the number of jobs is set to the number of cores.
164+
n_jobs : int or None, optional (default=None)
165+
Number of CPU cores used during the cross-validation loop.
166+
``None`` means 1 unless in a :obj:`joblib.parallel_backend` context.
167+
``-1`` means using all processors. See
168+
`Glossary <https://scikit-learn.org/stable/glossary.html#term-n-jobs>`_
169+
for more details.
167170
168171
{random_state}
169172
@@ -299,7 +302,7 @@ def __init__(
299302
oob_score=False,
300303
sampling_strategy="auto",
301304
replacement=False,
302-
n_jobs=1,
305+
n_jobs=None,
303306
random_state=None,
304307
verbose=0,
305308
warm_start=False,

imblearn/over_sampling/_adasyn.py

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -38,8 +38,12 @@ class ADASYN(BaseOverSampler):
3838
:class:`sklearn.neighbors.base.KNeighborsMixin` that will be used to
3939
find the k_neighbors.
4040
41-
n_jobs : int, optional (default=1)
42-
Number of threads to run the algorithm when it is possible.
41+
n_jobs : int or None, optional (default=None)
42+
Number of CPU cores used during the cross-validation loop.
43+
``None`` means 1 unless in a :obj:`joblib.parallel_backend` context.
44+
``-1`` means using all processors. See
45+
`Glossary <https://scikit-learn.org/stable/glossary.html#term-n-jobs>`_
46+
for more details.
4347
4448
Notes
4549
-----
@@ -83,7 +87,7 @@ def __init__(
8387
sampling_strategy="auto",
8488
random_state=None,
8589
n_neighbors=5,
86-
n_jobs=1,
90+
n_jobs=None,
8791
):
8892
super().__init__(sampling_strategy=sampling_strategy)
8993
self.random_state = random_state

imblearn/over_sampling/_smote.py

Lines changed: 36 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -40,7 +40,7 @@ def __init__(
4040
sampling_strategy="auto",
4141
random_state=None,
4242
k_neighbors=5,
43-
n_jobs=1,
43+
n_jobs=None,
4444
):
4545
super().__init__(sampling_strategy=sampling_strategy)
4646
self.random_state = random_state
@@ -252,8 +252,12 @@ class BorderlineSMOTE(BaseSMOTE):
252252
:class:`sklearn.neighbors.base.KNeighborsMixin` that will be used to
253253
find the k_neighbors.
254254
255-
n_jobs : int, optional (default=1)
256-
The number of threads to open if possible.
255+
n_jobs : int or None, optional (default=None)
256+
Number of CPU cores used during the cross-validation loop.
257+
``None`` means 1 unless in a :obj:`joblib.parallel_backend` context.
258+
``-1`` means using all processors. See
259+
`Glossary <https://scikit-learn.org/stable/glossary.html#term-n-jobs>`_
260+
for more details.
257261
258262
m_neighbors : int or object, optional (default=10)
259263
If int, number of nearest neighbours to use to determine if a minority
@@ -316,7 +320,7 @@ def __init__(
316320
sampling_strategy="auto",
317321
random_state=None,
318322
k_neighbors=5,
319-
n_jobs=1,
323+
n_jobs=None,
320324
m_neighbors=10,
321325
kind="borderline-1",
322326
):
@@ -446,8 +450,12 @@ class SVMSMOTE(BaseSMOTE):
446450
:class:`sklearn.neighbors.base.KNeighborsMixin` that will be used to
447451
find the k_neighbors.
448452
449-
n_jobs : int, optional (default=1)
450-
The number of threads to open if possible.
453+
n_jobs : int or None, optional (default=None)
454+
Number of CPU cores used during the cross-validation loop.
455+
``None`` means 1 unless in a :obj:`joblib.parallel_backend` context.
456+
``-1`` means using all processors. See
457+
`Glossary <https://scikit-learn.org/stable/glossary.html#term-n-jobs>`_
458+
for more details.
451459
452460
m_neighbors : int or object, optional (default=10)
453461
If int, number of nearest neighbours to use to determine if a minority
@@ -512,7 +520,7 @@ def __init__(
512520
sampling_strategy="auto",
513521
random_state=None,
514522
k_neighbors=5,
515-
n_jobs=1,
523+
n_jobs=None,
516524
m_neighbors=10,
517525
svm_estimator=None,
518526
out_step=0.5,
@@ -661,8 +669,12 @@ class SMOTE(BaseSMOTE):
661669
:class:`sklearn.neighbors.base.KNeighborsMixin` that will be used to
662670
find the k_neighbors.
663671
664-
n_jobs : int, optional (default=1)
665-
The number of threads to open if possible.
672+
n_jobs : int or None, optional (default=None)
673+
Number of CPU cores used during the cross-validation loop.
674+
``None`` means 1 unless in a :obj:`joblib.parallel_backend` context.
675+
``-1`` means using all processors. See
676+
`Glossary <https://scikit-learn.org/stable/glossary.html#term-n-jobs>`_
677+
for more details.
666678
667679
Notes
668680
-----
@@ -711,7 +723,7 @@ def __init__(
711723
sampling_strategy="auto",
712724
random_state=None,
713725
k_neighbors=5,
714-
n_jobs=1,
726+
n_jobs=None,
715727
):
716728
super().__init__(
717729
sampling_strategy=sampling_strategy,
@@ -822,8 +834,12 @@ class SMOTENC(SMOTE):
822834
:class:`sklearn.neighbors.base.KNeighborsMixin` that will be used to
823835
find the k_neighbors.
824836
825-
n_jobs : int, optional (default=1)
826-
The number of threads to open if possible.
837+
n_jobs : int or None, optional (default=None)
838+
Number of CPU cores used during the cross-validation loop.
839+
``None`` means 1 unless in a :obj:`joblib.parallel_backend` context.
840+
``-1`` means using all processors. See
841+
`Glossary <https://scikit-learn.org/stable/glossary.html#term-n-jobs>`_
842+
for more details.
827843
828844
Notes
829845
-----
@@ -881,7 +897,7 @@ def __init__(
881897
sampling_strategy="auto",
882898
random_state=None,
883899
k_neighbors=5,
884-
n_jobs=1,
900+
n_jobs=None,
885901
):
886902
super().__init__(
887903
sampling_strategy=sampling_strategy,
@@ -1068,8 +1084,12 @@ class KMeansSMOTE(BaseSMOTE):
10681084
:class:`sklearn.neighbors.base.KNeighborsMixin` that will be used to
10691085
find the k_neighbors.
10701086
1071-
n_jobs : int, optional (default=1)
1072-
The number of threads to open if possible.
1087+
n_jobs : int or None, optional (default=None)
1088+
Number of CPU cores used during the cross-validation loop.
1089+
``None`` means 1 unless in a :obj:`joblib.parallel_backend` context.
1090+
``-1`` means using all processors. See
1091+
`Glossary <https://scikit-learn.org/stable/glossary.html#term-n-jobs>`_
1092+
for more details.
10731093
10741094
kmeans_estimator : int or object, optional (default=MiniBatchKMeans())
10751095
A KMeans instance or the number of clusters to be used. By default,
@@ -1134,7 +1154,7 @@ def __init__(
11341154
sampling_strategy="auto",
11351155
random_state=None,
11361156
k_neighbors=2,
1137-
n_jobs=1,
1157+
n_jobs=None,
11381158
kmeans_estimator=None,
11391159
cluster_balance_threshold="auto",
11401160
density_exponent="auto",

imblearn/under_sampling/_prototype_generation/_cluster_centroids.py

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -59,8 +59,12 @@ class ClusterCentroids(BaseUnderSampler):
5959
6060
.. versionadded:: 0.3.0
6161
62-
n_jobs : int, optional (default=1)
63-
The number of threads to open if possible.
62+
n_jobs : int or None, optional (default=None)
63+
Number of CPU cores used during the cross-validation loop.
64+
``None`` means 1 unless in a :obj:`joblib.parallel_backend` context.
65+
``-1`` means using all processors. See
66+
`Glossary <https://scikit-learn.org/stable/glossary.html#term-n-jobs>`_
67+
for more details.
6468
6569
Notes
6670
-----
@@ -92,7 +96,7 @@ def __init__(
9296
random_state=None,
9397
estimator=None,
9498
voting="auto",
95-
n_jobs=1,
99+
n_jobs=None,
96100
):
97101
super().__init__(sampling_strategy=sampling_strategy)
98102
self.random_state = random_state

0 commit comments

Comments
 (0)