Skip to content

Commit

Permalink
PEP8 and examples resolution
Browse files Browse the repository at this point in the history
  • Loading branch information
Guillaume Lemaitre committed Dec 18, 2016
1 parent 25ee4fa commit f0a4106
Show file tree
Hide file tree
Showing 27 changed files with 77 additions and 97 deletions.
15 changes: 8 additions & 7 deletions doc/api.rst
Original file line number Diff line number Diff line change
Expand Up @@ -19,11 +19,12 @@ Classes

.. autosummary::
:toctree: generated/

under_sampling.ClusterCentroids
under_sampling.CondensedNearestNeighbour
under_sampling.EditedNearestNeighbours
under_sampling.RepeatedEditedNearestNeighbours
under_sampling.AllKNN
under_sampling.InstanceHardnessThreshold
under_sampling.NearMiss
under_sampling.NeighbourhoodCleaningRule
Expand All @@ -47,7 +48,7 @@ Classes

.. autosummary::
:toctree: generated/

over_sampling.ADASYN
over_sampling.RandomOverSampler
over_sampling.SMOTE
Expand All @@ -68,7 +69,7 @@ Classes

.. autosummary::
:toctree: generated/

combine.SMOTEENN
combine.SMOTETomek

Expand All @@ -88,7 +89,7 @@ Classes

.. autosummary::
:toctree: generated/

ensemble.BalanceCascade
ensemble.EasyEnsemble

Expand All @@ -108,14 +109,14 @@ Classes
-------
.. autosummary::
:toctree: generated/

pipeline.Pipeline

Functions
---------
.. autosummary::
:toctree: generated/

pipeline.make_pipeline


Expand All @@ -134,5 +135,5 @@ Functions
---------
.. autosummary::
:toctree: generated/

datasets.make_imbalance
5 changes: 2 additions & 3 deletions examples/combine/plot_smote_enn.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,23 +7,22 @@
"""

print(__doc__)

import matplotlib.pyplot as plt
import seaborn as sns
from sklearn.datasets import make_classification
from sklearn.decomposition import PCA

from imblearn.combine import SMOTEENN

print(__doc__)

sns.set()

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



# Generate the dataset
X, y = make_classification(n_classes=2, class_sep=2, weights=[0.1, 0.9],
n_informative=3, n_redundant=1, flip_y=0,
Expand Down
5 changes: 2 additions & 3 deletions examples/combine/plot_smote_tomek.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,23 +7,22 @@
"""

print(__doc__)

import matplotlib.pyplot as plt
import seaborn as sns
from sklearn.datasets import make_classification
from sklearn.decomposition import PCA

from imblearn.combine import SMOTETomek

print(__doc__)

sns.set()

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



# Generate the dataset
X, y = make_classification(n_classes=2, class_sep=2, weights=[0.1, 0.9],
n_informative=3, n_redundant=1, flip_y=0,
Expand Down
17 changes: 8 additions & 9 deletions examples/datasets/plot_make_imbalance.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,22 +7,21 @@
"""

print(__doc__)

import matplotlib.pyplot as plt
import seaborn as sns
from sklearn.datasets import make_moons

from imblearn.datasets import make_imbalance

print(__doc__)

sns.set()

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



# Generate the dataset
X, y = make_moons(n_samples=200, shuffle=True, noise=0.5, random_state=10)

Expand All @@ -32,11 +31,11 @@
axs = [a for ax in axs for a in ax]

axs[0].scatter(X[y == 0, 0], X[y == 0, 1], label="Class #0",
alpha=0.5, edgecolor=almost_black, facecolor=palette[0],
linewidth=0.15)
alpha=0.5, edgecolor=almost_black, facecolor=palette[0],
linewidth=0.15)
axs[0].scatter(X[y == 1, 0], X[y == 1, 1], label="Class #1",
alpha=0.5, edgecolor=almost_black, facecolor=palette[2],
linewidth=0.15)
alpha=0.5, edgecolor=almost_black, facecolor=palette[2],
linewidth=0.15)
axs[0].set_title('Original set')

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

ax.scatter(X_[y_ == 0, 0], X_[y_ == 0, 1], label="Class #0",
alpha=0.5, edgecolor=almost_black, facecolor=palette[0],
linewidth=0.15)
alpha=0.5, edgecolor=almost_black, facecolor=palette[0],
linewidth=0.15)
ax.scatter(X_[y_ == 1, 0], X_[y_ == 1, 1], label="Class #1",
alpha=0.5, edgecolor=almost_black, facecolor=palette[2],
linewidth=0.15)
Expand Down
5 changes: 2 additions & 3 deletions examples/ensemble/plot_balance_cascade.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,8 +7,6 @@
"""

print(__doc__)

import matplotlib.pyplot as plt
import numpy as np
import seaborn as sns
Expand All @@ -17,14 +15,15 @@

from imblearn.ensemble import BalanceCascade

print(__doc__)

sns.set()

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



# Generate the dataset
X, y = make_classification(n_classes=2, class_sep=2, weights=[0.1, 0.9],
n_informative=3, n_redundant=1, flip_y=0,
Expand Down
5 changes: 2 additions & 3 deletions examples/ensemble/plot_easy_ensemble.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,8 +7,6 @@
"""

print(__doc__)

import matplotlib.pyplot as plt
import numpy as np
import seaborn as sns
Expand All @@ -17,14 +15,15 @@

from imblearn.ensemble import EasyEnsemble

print(__doc__)

sns.set()

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



# Generate the dataset
X, y = make_classification(n_classes=2, class_sep=2, weights=[0.1, 0.9],
n_informative=3, n_redundant=1, flip_y=0,
Expand Down
5 changes: 2 additions & 3 deletions examples/over-sampling/plot_adasyn.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,23 +8,22 @@
"""

print(__doc__)

import matplotlib.pyplot as plt
import seaborn as sns
from sklearn.datasets import make_classification
from sklearn.decomposition import PCA

from imblearn.over_sampling import ADASYN

print(__doc__)

sns.set()

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



# Generate the dataset
X, y = make_classification(n_classes=2, class_sep=2, weights=[0.1, 0.9],
n_informative=3, n_redundant=1, flip_y=0,
Expand Down
17 changes: 10 additions & 7 deletions examples/over-sampling/plot_over_sampling_benchmark_3nn.py
Original file line number Diff line number Diff line change
@@ -1,14 +1,15 @@
"""
=============================================================
==========================================================
Benchmark over-sampling methods in a face regognition task
=============================================================
In this face recognition example two faces are used from the LFW
(Faces in the Wild) dataset. Several implemented over-sampling
methods are used in conjunction with a 3NN classifier in order
to examine the improvement of the classifier's output quality
==========================================================
In this face recognition example two faces are used from the LFW
(Faces in the Wild) dataset. Several implemented over-sampling
methods are used in conjunction with a 3NN classifier in order
to examine the improvement of the classifier's output quality
by using an over-sampler.
"""
print(__doc__)

import matplotlib.pyplot as plt
import numpy as np
Expand All @@ -20,6 +21,8 @@
from imblearn.over_sampling import ADASYN, SMOTE, RandomOverSampler
from imblearn.pipeline import make_pipeline

print(__doc__)

LW = 2
RANDOM_STATE = 42

Expand Down
5 changes: 2 additions & 3 deletions examples/over-sampling/plot_random_over_sampling.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,23 +7,22 @@
"""

print(__doc__)

import matplotlib.pyplot as plt
import seaborn as sns
from sklearn.datasets import make_classification
from sklearn.decomposition import PCA

from imblearn.over_sampling import RandomOverSampler

print(__doc__)

sns.set()

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



# Generate the dataset
X, y = make_classification(n_classes=2, class_sep=2, weights=[0.1, 0.9],
n_informative=3, n_redundant=1, flip_y=0,
Expand Down
5 changes: 2 additions & 3 deletions examples/over-sampling/plot_smote.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,23 +7,22 @@
"""

print(__doc__)

import matplotlib.pyplot as plt
import seaborn as sns
from sklearn.datasets import make_classification
from sklearn.decomposition import PCA

from imblearn.over_sampling import SMOTE

print(__doc__)

sns.set()

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



# Generate the dataset
X, y = make_classification(n_classes=2, class_sep=2, weights=[0.1, 0.9],
n_informative=3, n_redundant=1, flip_y=0,
Expand Down
5 changes: 2 additions & 3 deletions examples/over-sampling/plot_smote_bordeline_1.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,23 +7,22 @@
"""

print(__doc__)

import matplotlib.pyplot as plt
import seaborn as sns
from sklearn.datasets import make_classification
from sklearn.decomposition import PCA

from imblearn.over_sampling import SMOTE

print(__doc__)

sns.set()

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



# Generate the dataset
X, y = make_classification(n_classes=2, class_sep=2, weights=[0.1, 0.9],
n_informative=3, n_redundant=1, flip_y=0,
Expand Down
5 changes: 2 additions & 3 deletions examples/over-sampling/plot_smote_bordeline_2.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,23 +7,22 @@
"""

print(__doc__)

import matplotlib.pyplot as plt
import seaborn as sns
from sklearn.datasets import make_classification
from sklearn.decomposition import PCA

from imblearn.over_sampling import SMOTE

print(__doc__)

sns.set()

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



# Generate the dataset
X, y = make_classification(n_classes=2, class_sep=2, weights=[0.1, 0.9],
n_informative=3, n_redundant=1, flip_y=0,
Expand Down
Loading

0 comments on commit f0a4106

Please sign in to comment.