Skip to content

Commit f0a4106

Browse files
author
Guillaume Lemaitre
committed
PEP8 and examples resolution
1 parent 25ee4fa commit f0a4106

27 files changed

+77
-97
lines changed

doc/api.rst

Lines changed: 8 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -19,11 +19,12 @@ Classes
1919

2020
.. autosummary::
2121
:toctree: generated/
22-
22+
2323
under_sampling.ClusterCentroids
2424
under_sampling.CondensedNearestNeighbour
2525
under_sampling.EditedNearestNeighbours
2626
under_sampling.RepeatedEditedNearestNeighbours
27+
under_sampling.AllKNN
2728
under_sampling.InstanceHardnessThreshold
2829
under_sampling.NearMiss
2930
under_sampling.NeighbourhoodCleaningRule
@@ -47,7 +48,7 @@ Classes
4748

4849
.. autosummary::
4950
:toctree: generated/
50-
51+
5152
over_sampling.ADASYN
5253
over_sampling.RandomOverSampler
5354
over_sampling.SMOTE
@@ -68,7 +69,7 @@ Classes
6869

6970
.. autosummary::
7071
:toctree: generated/
71-
72+
7273
combine.SMOTEENN
7374
combine.SMOTETomek
7475

@@ -88,7 +89,7 @@ Classes
8889

8990
.. autosummary::
9091
:toctree: generated/
91-
92+
9293
ensemble.BalanceCascade
9394
ensemble.EasyEnsemble
9495

@@ -108,14 +109,14 @@ Classes
108109
-------
109110
.. autosummary::
110111
:toctree: generated/
111-
112+
112113
pipeline.Pipeline
113114

114115
Functions
115116
---------
116117
.. autosummary::
117118
:toctree: generated/
118-
119+
119120
pipeline.make_pipeline
120121

121122

@@ -134,5 +135,5 @@ Functions
134135
---------
135136
.. autosummary::
136137
:toctree: generated/
137-
138+
138139
datasets.make_imbalance

examples/combine/plot_smote_enn.py

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -7,23 +7,22 @@
77
88
"""
99

10-
print(__doc__)
11-
1210
import matplotlib.pyplot as plt
1311
import seaborn as sns
1412
from sklearn.datasets import make_classification
1513
from sklearn.decomposition import PCA
1614

1715
from imblearn.combine import SMOTEENN
1816

17+
print(__doc__)
18+
1919
sns.set()
2020

2121
# Define some color for the plotting
2222
almost_black = '#262626'
2323
palette = sns.color_palette()
2424

2525

26-
2726
# Generate the dataset
2827
X, y = make_classification(n_classes=2, class_sep=2, weights=[0.1, 0.9],
2928
n_informative=3, n_redundant=1, flip_y=0,

examples/combine/plot_smote_tomek.py

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -7,23 +7,22 @@
77
88
"""
99

10-
print(__doc__)
11-
1210
import matplotlib.pyplot as plt
1311
import seaborn as sns
1412
from sklearn.datasets import make_classification
1513
from sklearn.decomposition import PCA
1614

1715
from imblearn.combine import SMOTETomek
1816

17+
print(__doc__)
18+
1919
sns.set()
2020

2121
# Define some color for the plotting
2222
almost_black = '#262626'
2323
palette = sns.color_palette()
2424

2525

26-
2726
# Generate the dataset
2827
X, y = make_classification(n_classes=2, class_sep=2, weights=[0.1, 0.9],
2928
n_informative=3, n_redundant=1, flip_y=0,

examples/datasets/plot_make_imbalance.py

Lines changed: 8 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -7,22 +7,21 @@
77
88
"""
99

10-
print(__doc__)
11-
1210
import matplotlib.pyplot as plt
1311
import seaborn as sns
1412
from sklearn.datasets import make_moons
1513

1614
from imblearn.datasets import make_imbalance
1715

16+
print(__doc__)
17+
1818
sns.set()
1919

2020
# Define some color for the plotting
2121
almost_black = '#262626'
2222
palette = sns.color_palette()
2323

2424

25-
2625
# Generate the dataset
2726
X, y = make_moons(n_samples=200, shuffle=True, noise=0.5, random_state=10)
2827

@@ -32,11 +31,11 @@
3231
axs = [a for ax in axs for a in ax]
3332

3433
axs[0].scatter(X[y == 0, 0], X[y == 0, 1], label="Class #0",
35-
alpha=0.5, edgecolor=almost_black, facecolor=palette[0],
36-
linewidth=0.15)
34+
alpha=0.5, edgecolor=almost_black, facecolor=palette[0],
35+
linewidth=0.15)
3736
axs[0].scatter(X[y == 1, 0], X[y == 1, 1], label="Class #1",
38-
alpha=0.5, edgecolor=almost_black, facecolor=palette[2],
39-
linewidth=0.15)
37+
alpha=0.5, edgecolor=almost_black, facecolor=palette[2],
38+
linewidth=0.15)
4039
axs[0].set_title('Original set')
4140

4241
ratios = [0.9, 0.75, 0.5, 0.25, 0.1]
@@ -46,8 +45,8 @@
4645
X_, y_ = make_imbalance(X, y, ratio=ratio, min_c_=1)
4746

4847
ax.scatter(X_[y_ == 0, 0], X_[y_ == 0, 1], label="Class #0",
49-
alpha=0.5, edgecolor=almost_black, facecolor=palette[0],
50-
linewidth=0.15)
48+
alpha=0.5, edgecolor=almost_black, facecolor=palette[0],
49+
linewidth=0.15)
5150
ax.scatter(X_[y_ == 1, 0], X_[y_ == 1, 1], label="Class #1",
5251
alpha=0.5, edgecolor=almost_black, facecolor=palette[2],
5352
linewidth=0.15)

examples/ensemble/plot_balance_cascade.py

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -7,8 +7,6 @@
77
88
"""
99

10-
print(__doc__)
11-
1210
import matplotlib.pyplot as plt
1311
import numpy as np
1412
import seaborn as sns
@@ -17,14 +15,15 @@
1715

1816
from imblearn.ensemble import BalanceCascade
1917

18+
print(__doc__)
19+
2020
sns.set()
2121

2222
# Define some color for the plotting
2323
almost_black = '#262626'
2424
palette = sns.color_palette()
2525

2626

27-
2827
# Generate the dataset
2928
X, y = make_classification(n_classes=2, class_sep=2, weights=[0.1, 0.9],
3029
n_informative=3, n_redundant=1, flip_y=0,

examples/ensemble/plot_easy_ensemble.py

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -7,8 +7,6 @@
77
88
"""
99

10-
print(__doc__)
11-
1210
import matplotlib.pyplot as plt
1311
import numpy as np
1412
import seaborn as sns
@@ -17,14 +15,15 @@
1715

1816
from imblearn.ensemble import EasyEnsemble
1917

18+
print(__doc__)
19+
2020
sns.set()
2121

2222
# Define some color for the plotting
2323
almost_black = '#262626'
2424
palette = sns.color_palette()
2525

2626

27-
2827
# Generate the dataset
2928
X, y = make_classification(n_classes=2, class_sep=2, weights=[0.1, 0.9],
3029
n_informative=3, n_redundant=1, flip_y=0,

examples/over-sampling/plot_adasyn.py

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -8,23 +8,22 @@
88
99
"""
1010

11-
print(__doc__)
12-
1311
import matplotlib.pyplot as plt
1412
import seaborn as sns
1513
from sklearn.datasets import make_classification
1614
from sklearn.decomposition import PCA
1715

1816
from imblearn.over_sampling import ADASYN
1917

18+
print(__doc__)
19+
2020
sns.set()
2121

2222
# Define some color for the plotting
2323
almost_black = '#262626'
2424
palette = sns.color_palette()
2525

2626

27-
2827
# Generate the dataset
2928
X, y = make_classification(n_classes=2, class_sep=2, weights=[0.1, 0.9],
3029
n_informative=3, n_redundant=1, flip_y=0,

examples/over-sampling/plot_over_sampling_benchmark_3nn.py

Lines changed: 10 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,15 @@
11
"""
2-
=============================================================
2+
==========================================================
33
Benchmark over-sampling methods in a face regognition task
4-
=============================================================
5-
In this face recognition example two faces are used from the LFW
6-
(Faces in the Wild) dataset. Several implemented over-sampling
7-
methods are used in conjunction with a 3NN classifier in order
8-
to examine the improvement of the classifier's output quality
4+
==========================================================
5+
6+
In this face recognition example two faces are used from the LFW
7+
(Faces in the Wild) dataset. Several implemented over-sampling
8+
methods are used in conjunction with a 3NN classifier in order
9+
to examine the improvement of the classifier's output quality
910
by using an over-sampler.
11+
1012
"""
11-
print(__doc__)
1213

1314
import matplotlib.pyplot as plt
1415
import numpy as np
@@ -20,6 +21,8 @@
2021
from imblearn.over_sampling import ADASYN, SMOTE, RandomOverSampler
2122
from imblearn.pipeline import make_pipeline
2223

24+
print(__doc__)
25+
2326
LW = 2
2427
RANDOM_STATE = 42
2528

examples/over-sampling/plot_random_over_sampling.py

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -7,23 +7,22 @@
77
88
"""
99

10-
print(__doc__)
11-
1210
import matplotlib.pyplot as plt
1311
import seaborn as sns
1412
from sklearn.datasets import make_classification
1513
from sklearn.decomposition import PCA
1614

1715
from imblearn.over_sampling import RandomOverSampler
1816

17+
print(__doc__)
18+
1919
sns.set()
2020

2121
# Define some color for the plotting
2222
almost_black = '#262626'
2323
palette = sns.color_palette()
2424

2525

26-
2726
# Generate the dataset
2827
X, y = make_classification(n_classes=2, class_sep=2, weights=[0.1, 0.9],
2928
n_informative=3, n_redundant=1, flip_y=0,

examples/over-sampling/plot_smote.py

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -7,23 +7,22 @@
77
88
"""
99

10-
print(__doc__)
11-
1210
import matplotlib.pyplot as plt
1311
import seaborn as sns
1412
from sklearn.datasets import make_classification
1513
from sklearn.decomposition import PCA
1614

1715
from imblearn.over_sampling import SMOTE
1816

17+
print(__doc__)
18+
1919
sns.set()
2020

2121
# Define some color for the plotting
2222
almost_black = '#262626'
2323
palette = sns.color_palette()
2424

2525

26-
2726
# Generate the dataset
2827
X, y = make_classification(n_classes=2, class_sep=2, weights=[0.1, 0.9],
2928
n_informative=3, n_redundant=1, flip_y=0,

0 commit comments

Comments
 (0)