Skip to content

Commit daba53a

Browse files
authored
Merge pull request #163 from chkoar/roi
[MRG + 1] Reorganize imports
2 parents 032fa7c + 1731b88 commit daba53a

File tree

68 files changed

+238
-326
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

68 files changed

+238
-326
lines changed

doc/conf.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,8 +12,8 @@
1212
# All configuration values have a default; values that are commented out
1313
# serve to show the default.
1414

15-
import sys
1615
import os
16+
import sys
1717

1818
import sphinx_rtd_theme
1919

examples/combine/plot_smote_enn.py

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -11,16 +11,18 @@
1111

1212
import matplotlib.pyplot as plt
1313
import seaborn as sns
14+
from sklearn.datasets import make_classification
15+
from sklearn.decomposition import PCA
16+
17+
from imblearn.combine import SMOTEENN
18+
1419
sns.set()
1520

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

20-
from sklearn.datasets import make_classification
21-
from sklearn.decomposition import PCA
2225

23-
from imblearn.combine import SMOTEENN
2426

2527
# Generate the dataset
2628
X, y = make_classification(n_classes=2, class_sep=2, weights=[0.1, 0.9],

examples/combine/plot_smote_tomek.py

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -11,16 +11,18 @@
1111

1212
import matplotlib.pyplot as plt
1313
import seaborn as sns
14+
from sklearn.datasets import make_classification
15+
from sklearn.decomposition import PCA
16+
17+
from imblearn.combine import SMOTETomek
18+
1419
sns.set()
1520

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

20-
from sklearn.datasets import make_classification
21-
from sklearn.decomposition import PCA
2225

23-
from imblearn.combine import SMOTETomek
2426

2527
# Generate the dataset
2628
X, y = make_classification(n_classes=2, class_sep=2, weights=[0.1, 0.9],

examples/datasets/plot_make_imbalance.py

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -11,14 +11,16 @@
1111

1212
import matplotlib.pyplot as plt
1313
import seaborn as sns
14+
from sklearn.datasets import make_moons
15+
16+
from imblearn.datasets import make_imbalance
17+
1418
sns.set()
1519

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

20-
from sklearn.datasets import make_moons
21-
from imblearn.datasets import make_imbalance
2224

2325

2426
# Generate the dataset

examples/ensemble/plot_balance_cascade.py

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -9,19 +9,21 @@
99

1010
print(__doc__)
1111

12-
import numpy as np
1312
import matplotlib.pyplot as plt
13+
import numpy as np
1414
import seaborn as sns
15+
from sklearn.datasets import make_classification
16+
from sklearn.decomposition import PCA
17+
18+
from imblearn.ensemble import BalanceCascade
19+
1520
sns.set()
1621

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

21-
from sklearn.datasets import make_classification
22-
from sklearn.decomposition import PCA
2326

24-
from imblearn.ensemble import BalanceCascade
2527

2628
# Generate the dataset
2729
X, y = make_classification(n_classes=2, class_sep=2, weights=[0.1, 0.9],

examples/ensemble/plot_easy_ensemble.py

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -9,19 +9,21 @@
99

1010
print(__doc__)
1111

12-
import numpy as np
1312
import matplotlib.pyplot as plt
13+
import numpy as np
1414
import seaborn as sns
15+
from sklearn.datasets import make_classification
16+
from sklearn.decomposition import PCA
17+
18+
from imblearn.ensemble import EasyEnsemble
19+
1520
sns.set()
1621

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

21-
from sklearn.datasets import make_classification
22-
from sklearn.decomposition import PCA
2326

24-
from imblearn.ensemble import EasyEnsemble
2527

2628
# Generate the dataset
2729
X, y = make_classification(n_classes=2, class_sep=2, weights=[0.1, 0.9],

examples/over-sampling/plot_adasyn.py

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -12,16 +12,18 @@
1212

1313
import matplotlib.pyplot as plt
1414
import seaborn as sns
15+
from sklearn.datasets import make_classification
16+
from sklearn.decomposition import PCA
17+
18+
from imblearn.over_sampling import ADASYN
19+
1520
sns.set()
1621

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

21-
from sklearn.datasets import make_classification
22-
from sklearn.decomposition import PCA
2326

24-
from imblearn.over_sampling import ADASYN
2527

2628
# Generate the dataset
2729
X, y = make_classification(n_classes=2, class_sep=2, weights=[0.1, 0.9],

examples/over-sampling/plot_random_over_sampling.py

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -11,16 +11,18 @@
1111

1212
import matplotlib.pyplot as plt
1313
import seaborn as sns
14+
from sklearn.datasets import make_classification
15+
from sklearn.decomposition import PCA
16+
17+
from imblearn.over_sampling import RandomOverSampler
18+
1419
sns.set()
1520

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

20-
from sklearn.datasets import make_classification
21-
from sklearn.decomposition import PCA
2225

23-
from imblearn.over_sampling import RandomOverSampler
2426

2527
# Generate the dataset
2628
X, y = make_classification(n_classes=2, class_sep=2, weights=[0.1, 0.9],

examples/over-sampling/plot_smote.py

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -11,16 +11,18 @@
1111

1212
import matplotlib.pyplot as plt
1313
import seaborn as sns
14+
from sklearn.datasets import make_classification
15+
from sklearn.decomposition import PCA
16+
17+
from imblearn.over_sampling import SMOTE
18+
1419
sns.set()
1520

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

20-
from sklearn.datasets import make_classification
21-
from sklearn.decomposition import PCA
2225

23-
from imblearn.over_sampling import SMOTE
2426

2527
# Generate the dataset
2628
X, y = make_classification(n_classes=2, class_sep=2, weights=[0.1, 0.9],

examples/over-sampling/plot_smote_bordeline_1.py

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -11,16 +11,18 @@
1111

1212
import matplotlib.pyplot as plt
1313
import seaborn as sns
14+
from sklearn.datasets import make_classification
15+
from sklearn.decomposition import PCA
16+
17+
from imblearn.over_sampling import SMOTE
18+
1419
sns.set()
1520

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

20-
from sklearn.datasets import make_classification
21-
from sklearn.decomposition import PCA
2225

23-
from imblearn.over_sampling import SMOTE
2426

2527
# Generate the dataset
2628
X, y = make_classification(n_classes=2, class_sep=2, weights=[0.1, 0.9],

examples/over-sampling/plot_smote_bordeline_2.py

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -11,16 +11,18 @@
1111

1212
import matplotlib.pyplot as plt
1313
import seaborn as sns
14+
from sklearn.datasets import make_classification
15+
from sklearn.decomposition import PCA
16+
17+
from imblearn.over_sampling import SMOTE
18+
1419
sns.set()
1520

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

20-
from sklearn.datasets import make_classification
21-
from sklearn.decomposition import PCA
2225

23-
from imblearn.over_sampling import SMOTE
2426

2527
# Generate the dataset
2628
X, y = make_classification(n_classes=2, class_sep=2, weights=[0.1, 0.9],

examples/over-sampling/plot_smote_svm.py

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -11,16 +11,18 @@
1111

1212
import matplotlib.pyplot as plt
1313
import seaborn as sns
14+
from sklearn.datasets import make_classification
15+
from sklearn.decomposition import PCA
16+
17+
from imblearn.over_sampling import SMOTE
18+
1419
sns.set()
1520

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

20-
from sklearn.datasets import make_classification
21-
from sklearn.decomposition import PCA
2225

23-
from imblearn.over_sampling import SMOTE
2426

2527
# Generate the dataset
2628
X, y = make_classification(n_classes=2, class_sep=2, weights=[0.1, 0.9],

examples/pipeline/plot_pipeline_classification.py

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -13,13 +13,12 @@
1313
from sklearn.cross_validation import train_test_split as tts
1414
from sklearn.datasets import make_classification
1515
from sklearn.decomposition import PCA
16-
from sklearn.neighbors import KNeighborsClassifier as KNN
1716
from sklearn.metrics import classification_report
18-
17+
from sklearn.neighbors import KNeighborsClassifier as KNN
1918

2019
from imblearn.pipeline import make_pipeline
21-
from imblearn.under_sampling import EditedNearestNeighbours
22-
from imblearn.under_sampling import RepeatedEditedNearestNeighbours
20+
from imblearn.under_sampling import (EditedNearestNeighbours,
21+
RepeatedEditedNearestNeighbours)
2322

2423
# Generate the dataset
2524
X, y = make_classification(n_classes=2, class_sep=1.25, weights=[0.3, 0.7],

examples/under-sampling/plot_allknn.py

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -11,18 +11,19 @@
1111

1212
import matplotlib.pyplot as plt
1313
import seaborn as sns
14+
from sklearn.datasets import make_classification
15+
from sklearn.decomposition import PCA
16+
17+
from imblearn.under_sampling import (AllKNN, EditedNearestNeighbours,
18+
RepeatedEditedNearestNeighbours)
19+
1420
sns.set()
1521

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

20-
from sklearn.datasets import make_classification
21-
from sklearn.decomposition import PCA
2226

23-
from imblearn.under_sampling import EditedNearestNeighbours
24-
from imblearn.under_sampling import RepeatedEditedNearestNeighbours
25-
from imblearn.under_sampling import AllKNN
2627

2728
# Generate the dataset
2829
X, y = make_classification(n_classes=2, class_sep=1.25, weights=[0.3, 0.7],

examples/under-sampling/plot_cluster_centroids.py

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -11,16 +11,18 @@
1111

1212
import matplotlib.pyplot as plt
1313
import seaborn as sns
14+
from sklearn.datasets import make_classification
15+
from sklearn.decomposition import PCA
16+
17+
from imblearn.under_sampling import ClusterCentroids
18+
1419
sns.set()
1520

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

20-
from sklearn.datasets import make_classification
21-
from sklearn.decomposition import PCA
2225

23-
from imblearn.under_sampling import ClusterCentroids
2426

2527
# Generate the dataset
2628
X, y = make_classification(n_classes=2, class_sep=2, weights=[0.1, 0.9],

examples/under-sampling/plot_condensed_nearest_neighbour.py

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -11,16 +11,18 @@
1111

1212
import matplotlib.pyplot as plt
1313
import seaborn as sns
14+
from sklearn.datasets import make_classification
15+
from sklearn.decomposition import PCA
16+
17+
from imblearn.under_sampling import CondensedNearestNeighbour
18+
1419
sns.set()
1520

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

20-
from sklearn.datasets import make_classification
21-
from sklearn.decomposition import PCA
2225

23-
from imblearn.under_sampling import CondensedNearestNeighbour
2426

2527
# Generate the dataset
2628
X, y = make_classification(n_classes=2, class_sep=2, weights=[0.1, 0.9],

examples/under-sampling/plot_edited_nearest_neighbours.py

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -11,16 +11,18 @@
1111

1212
import matplotlib.pyplot as plt
1313
import seaborn as sns
14+
from sklearn.datasets import make_classification
15+
from sklearn.decomposition import PCA
16+
17+
from imblearn.under_sampling import EditedNearestNeighbours
18+
1419
sns.set()
1520

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

20-
from sklearn.datasets import make_classification
21-
from sklearn.decomposition import PCA
2225

23-
from imblearn.under_sampling import EditedNearestNeighbours
2426

2527
# Generate the dataset
2628
X, y = make_classification(n_classes=2, class_sep=2, weights=[0.1, 0.9],

examples/under-sampling/plot_instance_hardness_threshold.py

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -11,16 +11,18 @@
1111

1212
import matplotlib.pyplot as plt
1313
import seaborn as sns
14+
from sklearn.datasets import make_classification
15+
from sklearn.decomposition import PCA
16+
17+
from imblearn.under_sampling import InstanceHardnessThreshold
18+
1419
sns.set()
1520

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

20-
from sklearn.datasets import make_classification
21-
from sklearn.decomposition import PCA
2225

23-
from imblearn.under_sampling import InstanceHardnessThreshold
2426

2527
# Generate the dataset
2628
X, y = make_classification(n_classes=2, class_sep=1., weights=[0.05, 0.95],

0 commit comments

Comments
 (0)