diff --git a/doc/api.rst b/doc/api.rst index daf1919ce..77e96457b 100644 --- a/doc/api.rst +++ b/doc/api.rst @@ -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 @@ -47,7 +48,7 @@ Classes .. autosummary:: :toctree: generated/ - + over_sampling.ADASYN over_sampling.RandomOverSampler over_sampling.SMOTE @@ -68,7 +69,7 @@ Classes .. autosummary:: :toctree: generated/ - + combine.SMOTEENN combine.SMOTETomek @@ -88,7 +89,7 @@ Classes .. autosummary:: :toctree: generated/ - + ensemble.BalanceCascade ensemble.EasyEnsemble @@ -108,14 +109,14 @@ Classes ------- .. autosummary:: :toctree: generated/ - + pipeline.Pipeline Functions --------- .. autosummary:: :toctree: generated/ - + pipeline.make_pipeline @@ -134,5 +135,5 @@ Functions --------- .. autosummary:: :toctree: generated/ - + datasets.make_imbalance diff --git a/examples/combine/plot_smote_enn.py b/examples/combine/plot_smote_enn.py index ec1f18404..13664e8f5 100644 --- a/examples/combine/plot_smote_enn.py +++ b/examples/combine/plot_smote_enn.py @@ -7,8 +7,6 @@ """ -print(__doc__) - import matplotlib.pyplot as plt import seaborn as sns from sklearn.datasets import make_classification @@ -16,6 +14,8 @@ from imblearn.combine import SMOTEENN +print(__doc__) + sns.set() # Define some color for the plotting @@ -23,7 +23,6 @@ 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, diff --git a/examples/combine/plot_smote_tomek.py b/examples/combine/plot_smote_tomek.py index 28fd3fa39..caa722a1c 100644 --- a/examples/combine/plot_smote_tomek.py +++ b/examples/combine/plot_smote_tomek.py @@ -7,8 +7,6 @@ """ -print(__doc__) - import matplotlib.pyplot as plt import seaborn as sns from sklearn.datasets import make_classification @@ -16,6 +14,8 @@ from imblearn.combine import SMOTETomek +print(__doc__) + sns.set() # Define some color for the plotting @@ -23,7 +23,6 @@ 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, diff --git a/examples/datasets/plot_make_imbalance.py b/examples/datasets/plot_make_imbalance.py index e646edffb..60bc5eebc 100644 --- a/examples/datasets/plot_make_imbalance.py +++ b/examples/datasets/plot_make_imbalance.py @@ -7,14 +7,14 @@ """ -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 @@ -22,7 +22,6 @@ palette = sns.color_palette() - # Generate the dataset X, y = make_moons(n_samples=200, shuffle=True, noise=0.5, random_state=10) @@ -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] @@ -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) diff --git a/examples/ensemble/plot_balance_cascade.py b/examples/ensemble/plot_balance_cascade.py index 500f52da8..034fa68ab 100644 --- a/examples/ensemble/plot_balance_cascade.py +++ b/examples/ensemble/plot_balance_cascade.py @@ -7,8 +7,6 @@ """ -print(__doc__) - import matplotlib.pyplot as plt import numpy as np import seaborn as sns @@ -17,6 +15,8 @@ from imblearn.ensemble import BalanceCascade +print(__doc__) + sns.set() # Define some color for the plotting @@ -24,7 +24,6 @@ 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, diff --git a/examples/ensemble/plot_easy_ensemble.py b/examples/ensemble/plot_easy_ensemble.py index 0aba287d8..0545ad880 100644 --- a/examples/ensemble/plot_easy_ensemble.py +++ b/examples/ensemble/plot_easy_ensemble.py @@ -7,8 +7,6 @@ """ -print(__doc__) - import matplotlib.pyplot as plt import numpy as np import seaborn as sns @@ -17,6 +15,8 @@ from imblearn.ensemble import EasyEnsemble +print(__doc__) + sns.set() # Define some color for the plotting @@ -24,7 +24,6 @@ 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, diff --git a/examples/over-sampling/plot_adasyn.py b/examples/over-sampling/plot_adasyn.py index fc3fe8751..65a191c7a 100644 --- a/examples/over-sampling/plot_adasyn.py +++ b/examples/over-sampling/plot_adasyn.py @@ -8,8 +8,6 @@ """ -print(__doc__) - import matplotlib.pyplot as plt import seaborn as sns from sklearn.datasets import make_classification @@ -17,6 +15,8 @@ from imblearn.over_sampling import ADASYN +print(__doc__) + sns.set() # Define some color for the plotting @@ -24,7 +24,6 @@ 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, diff --git a/examples/over-sampling/plot_over_sampling_benchmark_3nn.py b/examples/over-sampling/plot_over_sampling_benchmark_3nn.py index 97fbd315a..b64dad49c 100644 --- a/examples/over-sampling/plot_over_sampling_benchmark_3nn.py +++ b/examples/over-sampling/plot_over_sampling_benchmark_3nn.py @@ -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 @@ -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 diff --git a/examples/over-sampling/plot_random_over_sampling.py b/examples/over-sampling/plot_random_over_sampling.py index cd705461f..a69172760 100644 --- a/examples/over-sampling/plot_random_over_sampling.py +++ b/examples/over-sampling/plot_random_over_sampling.py @@ -7,8 +7,6 @@ """ -print(__doc__) - import matplotlib.pyplot as plt import seaborn as sns from sklearn.datasets import make_classification @@ -16,6 +14,8 @@ from imblearn.over_sampling import RandomOverSampler +print(__doc__) + sns.set() # Define some color for the plotting @@ -23,7 +23,6 @@ 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, diff --git a/examples/over-sampling/plot_smote.py b/examples/over-sampling/plot_smote.py index 755cae0e1..881065d6e 100644 --- a/examples/over-sampling/plot_smote.py +++ b/examples/over-sampling/plot_smote.py @@ -7,8 +7,6 @@ """ -print(__doc__) - import matplotlib.pyplot as plt import seaborn as sns from sklearn.datasets import make_classification @@ -16,6 +14,8 @@ from imblearn.over_sampling import SMOTE +print(__doc__) + sns.set() # Define some color for the plotting @@ -23,7 +23,6 @@ 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, diff --git a/examples/over-sampling/plot_smote_bordeline_1.py b/examples/over-sampling/plot_smote_bordeline_1.py index c4e82f705..bbcc9d2fe 100644 --- a/examples/over-sampling/plot_smote_bordeline_1.py +++ b/examples/over-sampling/plot_smote_bordeline_1.py @@ -7,8 +7,6 @@ """ -print(__doc__) - import matplotlib.pyplot as plt import seaborn as sns from sklearn.datasets import make_classification @@ -16,6 +14,8 @@ from imblearn.over_sampling import SMOTE +print(__doc__) + sns.set() # Define some color for the plotting @@ -23,7 +23,6 @@ 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, diff --git a/examples/over-sampling/plot_smote_bordeline_2.py b/examples/over-sampling/plot_smote_bordeline_2.py index 5c64cf056..c48223b9c 100644 --- a/examples/over-sampling/plot_smote_bordeline_2.py +++ b/examples/over-sampling/plot_smote_bordeline_2.py @@ -7,8 +7,6 @@ """ -print(__doc__) - import matplotlib.pyplot as plt import seaborn as sns from sklearn.datasets import make_classification @@ -16,6 +14,8 @@ from imblearn.over_sampling import SMOTE +print(__doc__) + sns.set() # Define some color for the plotting @@ -23,7 +23,6 @@ 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, diff --git a/examples/over-sampling/plot_smote_svm.py b/examples/over-sampling/plot_smote_svm.py index 430494247..aeb4a011f 100644 --- a/examples/over-sampling/plot_smote_svm.py +++ b/examples/over-sampling/plot_smote_svm.py @@ -7,8 +7,6 @@ """ -print(__doc__) - import matplotlib.pyplot as plt import seaborn as sns from sklearn.datasets import make_classification @@ -16,6 +14,8 @@ from imblearn.over_sampling import SMOTE +print(__doc__) + sns.set() # Define some color for the plotting @@ -23,7 +23,6 @@ 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, diff --git a/examples/pipeline/plot_pipeline_classification.py b/examples/pipeline/plot_pipeline_classification.py index d120bfe8b..ea19e4143 100644 --- a/examples/pipeline/plot_pipeline_classification.py +++ b/examples/pipeline/plot_pipeline_classification.py @@ -8,8 +8,6 @@ """ -print(__doc__) - from sklearn.cross_validation import train_test_split as tts from sklearn.datasets import make_classification from sklearn.decomposition import PCA @@ -20,6 +18,8 @@ from imblearn.under_sampling import (EditedNearestNeighbours, RepeatedEditedNearestNeighbours) +print(__doc__) + # Generate the dataset X, y = make_classification(n_classes=2, class_sep=1.25, weights=[0.3, 0.7], n_informative=3, n_redundant=1, flip_y=0, diff --git a/examples/under-sampling/plot_allknn.py b/examples/under-sampling/plot_allknn.py index 660185e88..6995183e8 100644 --- a/examples/under-sampling/plot_allknn.py +++ b/examples/under-sampling/plot_allknn.py @@ -7,8 +7,6 @@ """ -print(__doc__) - import matplotlib.pyplot as plt import seaborn as sns from sklearn.datasets import make_classification @@ -17,6 +15,8 @@ from imblearn.under_sampling import (AllKNN, EditedNearestNeighbours, RepeatedEditedNearestNeighbours) +print(__doc__) + sns.set() # Define some color for the plotting @@ -24,7 +24,6 @@ palette = sns.color_palette() - # Generate the dataset X, y = make_classification(n_classes=2, class_sep=1.25, weights=[0.3, 0.7], n_informative=3, n_redundant=1, flip_y=0, @@ -50,7 +49,7 @@ enn = EditedNearestNeighbours() X_resampled, y_resampled = enn.fit_sample(X, y) X_res_vis = pca.transform(X_resampled) -print('Reduced {:.2f}\%'.format(100 * (1 - float(len(X_resampled))/ len(X)))) +print('Reduced {:.2f}\%'.format(100 * (1 - float(len(X_resampled)) / len(X)))) ax2.scatter(X_res_vis[y_resampled == 0, 0], X_res_vis[y_resampled == 0, 1], label="Class #0", alpha=.5, edgecolor=almost_black, @@ -65,7 +64,7 @@ renn = RepeatedEditedNearestNeighbours() X_resampled, y_resampled = renn.fit_sample(X, y) X_res_vis = pca.transform(X_resampled) -print('Reduced {:.2f}\%'.format(100 * (1 - float(len(X_resampled))/ len(X)))) +print('Reduced {:.2f}\%'.format(100 * (1 - float(len(X_resampled)) / len(X)))) ax3.scatter(X_res_vis[y_resampled == 0, 0], X_res_vis[y_resampled == 0, 1], label="Class #0", alpha=.5, edgecolor=almost_black, @@ -80,7 +79,7 @@ allknn = AllKNN() X_resampled, y_resampled = allknn.fit_sample(X, y) X_res_vis = pca.transform(X_resampled) -print('Reduced {:.2f}\%'.format(100 * (1 - float(len(X_resampled))/ len(X)))) +print('Reduced {:.2f}\%'.format(100 * (1 - float(len(X_resampled)) / len(X)))) ax4.scatter(X_res_vis[y_resampled == 0, 0], X_res_vis[y_resampled == 0, 1], label="Class #0", alpha=.5, edgecolor=almost_black, diff --git a/examples/under-sampling/plot_cluster_centroids.py b/examples/under-sampling/plot_cluster_centroids.py index 3e0e5f9d2..4944bf516 100644 --- a/examples/under-sampling/plot_cluster_centroids.py +++ b/examples/under-sampling/plot_cluster_centroids.py @@ -7,8 +7,6 @@ """ -print(__doc__) - import matplotlib.pyplot as plt import seaborn as sns from sklearn.datasets import make_classification @@ -16,6 +14,8 @@ from imblearn.under_sampling import ClusterCentroids +print(__doc__) + sns.set() # Define some color for the plotting @@ -23,7 +23,6 @@ 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, diff --git a/examples/under-sampling/plot_condensed_nearest_neighbour.py b/examples/under-sampling/plot_condensed_nearest_neighbour.py index cfdebd915..737ecf23e 100644 --- a/examples/under-sampling/plot_condensed_nearest_neighbour.py +++ b/examples/under-sampling/plot_condensed_nearest_neighbour.py @@ -7,8 +7,6 @@ """ -print(__doc__) - import matplotlib.pyplot as plt import seaborn as sns from sklearn.datasets import make_classification @@ -16,6 +14,8 @@ from imblearn.under_sampling import CondensedNearestNeighbour +print(__doc__) + sns.set() # Define some color for the plotting @@ -23,7 +23,6 @@ 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, diff --git a/examples/under-sampling/plot_edited_nearest_neighbours.py b/examples/under-sampling/plot_edited_nearest_neighbours.py index c00fc0abf..cf2cdc9fe 100644 --- a/examples/under-sampling/plot_edited_nearest_neighbours.py +++ b/examples/under-sampling/plot_edited_nearest_neighbours.py @@ -7,8 +7,6 @@ """ -print(__doc__) - import matplotlib.pyplot as plt import seaborn as sns from sklearn.datasets import make_classification @@ -16,6 +14,8 @@ from imblearn.under_sampling import EditedNearestNeighbours +print(__doc__) + sns.set() # Define some color for the plotting @@ -23,7 +23,6 @@ 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, diff --git a/examples/under-sampling/plot_instance_hardness_threshold.py b/examples/under-sampling/plot_instance_hardness_threshold.py index 72b848acc..46bc29a31 100644 --- a/examples/under-sampling/plot_instance_hardness_threshold.py +++ b/examples/under-sampling/plot_instance_hardness_threshold.py @@ -7,8 +7,6 @@ """ -print(__doc__) - import matplotlib.pyplot as plt import seaborn as sns from sklearn.datasets import make_classification @@ -16,6 +14,8 @@ from imblearn.under_sampling import InstanceHardnessThreshold +print(__doc__) + sns.set() # Define some color for the plotting @@ -23,7 +23,6 @@ palette = sns.color_palette() - # Generate the dataset X, y = make_classification(n_classes=2, class_sep=1., weights=[0.05, 0.95], n_informative=3, n_redundant=1, flip_y=0, diff --git a/examples/under-sampling/plot_nearmiss_1.py b/examples/under-sampling/plot_nearmiss_1.py index 0617e7c16..567e41f0d 100644 --- a/examples/under-sampling/plot_nearmiss_1.py +++ b/examples/under-sampling/plot_nearmiss_1.py @@ -7,8 +7,6 @@ """ -print(__doc__) - import matplotlib.pyplot as plt import seaborn as sns from sklearn.datasets import make_classification @@ -16,6 +14,8 @@ from imblearn.under_sampling import NearMiss +print(__doc__) + sns.set() # Define some color for the plotting @@ -23,7 +23,6 @@ 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, diff --git a/examples/under-sampling/plot_nearmiss_2.py b/examples/under-sampling/plot_nearmiss_2.py index 465580b48..ad0c97db7 100644 --- a/examples/under-sampling/plot_nearmiss_2.py +++ b/examples/under-sampling/plot_nearmiss_2.py @@ -7,8 +7,6 @@ """ -print(__doc__) - import matplotlib.pyplot as plt import seaborn as sns from sklearn.datasets import make_classification @@ -16,6 +14,8 @@ from imblearn.under_sampling import NearMiss +print(__doc__) + sns.set() # Define some color for the plotting @@ -23,7 +23,6 @@ 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, diff --git a/examples/under-sampling/plot_nearmiss_3.py b/examples/under-sampling/plot_nearmiss_3.py index 3b7233716..d2cd341c7 100644 --- a/examples/under-sampling/plot_nearmiss_3.py +++ b/examples/under-sampling/plot_nearmiss_3.py @@ -7,8 +7,6 @@ """ -print(__doc__) - import matplotlib.pyplot as plt import seaborn as sns from sklearn.datasets import make_classification @@ -16,6 +14,8 @@ from imblearn.under_sampling import NearMiss +print(__doc__) + sns.set() # Define some color for the plotting @@ -23,7 +23,6 @@ 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, diff --git a/examples/under-sampling/plot_neighbourhood_cleaning_rule.py b/examples/under-sampling/plot_neighbourhood_cleaning_rule.py index ad4b9d98a..a521585d9 100644 --- a/examples/under-sampling/plot_neighbourhood_cleaning_rule.py +++ b/examples/under-sampling/plot_neighbourhood_cleaning_rule.py @@ -7,8 +7,6 @@ """ -print(__doc__) - import matplotlib.pyplot as plt import seaborn as sns from sklearn.datasets import make_classification @@ -16,6 +14,8 @@ from imblearn.under_sampling import NeighbourhoodCleaningRule +print(__doc__) + sns.set() # Define some color for the plotting @@ -23,7 +23,6 @@ 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, diff --git a/examples/under-sampling/plot_one_sided_selection.py b/examples/under-sampling/plot_one_sided_selection.py index f9155675e..5bba059c1 100644 --- a/examples/under-sampling/plot_one_sided_selection.py +++ b/examples/under-sampling/plot_one_sided_selection.py @@ -7,8 +7,6 @@ """ -print(__doc__) - import matplotlib.pyplot as plt import seaborn as sns from sklearn.datasets import make_classification @@ -16,6 +14,8 @@ from imblearn.under_sampling import OneSidedSelection +print(__doc__) + sns.set() # Define some color for the plotting @@ -23,7 +23,6 @@ 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, diff --git a/examples/under-sampling/plot_random_under_sampler.py b/examples/under-sampling/plot_random_under_sampler.py index e48e88045..8a1ce612e 100644 --- a/examples/under-sampling/plot_random_under_sampler.py +++ b/examples/under-sampling/plot_random_under_sampler.py @@ -7,8 +7,6 @@ """ -print(__doc__) - import matplotlib.pyplot as plt import seaborn as sns from sklearn.datasets import make_classification @@ -16,6 +14,8 @@ from imblearn.under_sampling import RandomUnderSampler +print(__doc__) + sns.set() # Define some color for the plotting @@ -23,7 +23,6 @@ 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, diff --git a/examples/under-sampling/plot_repeated_edited_nearest_neighbours.py b/examples/under-sampling/plot_repeated_edited_nearest_neighbours.py index 0704be367..82e6f4f0d 100644 --- a/examples/under-sampling/plot_repeated_edited_nearest_neighbours.py +++ b/examples/under-sampling/plot_repeated_edited_nearest_neighbours.py @@ -7,8 +7,6 @@ """ -print(__doc__) - import matplotlib.pyplot as plt import seaborn as sns from sklearn.datasets import make_classification @@ -17,6 +15,8 @@ from imblearn.under_sampling import (EditedNearestNeighbours, RepeatedEditedNearestNeighbours) +print(__doc__) + sns.set() # Define some color for the plotting @@ -24,7 +24,6 @@ palette = sns.color_palette() - # Generate the dataset X, y = make_classification(n_classes=2, class_sep=1.25, weights=[0.3, 0.7], n_informative=3, n_redundant=1, flip_y=0, diff --git a/examples/under-sampling/plot_tomek_links.py b/examples/under-sampling/plot_tomek_links.py index 0747fff1f..e8a5f34dc 100644 --- a/examples/under-sampling/plot_tomek_links.py +++ b/examples/under-sampling/plot_tomek_links.py @@ -7,8 +7,6 @@ """ -print(__doc__) - import matplotlib.pyplot as plt import seaborn as sns from sklearn.datasets import make_classification @@ -16,6 +14,8 @@ from imblearn.under_sampling import TomekLinks +print(__doc__) + sns.set() # Define some color for the plotting @@ -23,7 +23,6 @@ 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,