Skip to content

Commit 3bba6c6

Browse files
author
Guillaume Lemaitre
committed
Remove fetch doctest in pipeline
1 parent 2a8dbc6 commit 3bba6c6

File tree

1 file changed

+9
-7
lines changed

1 file changed

+9
-7
lines changed

imblearn/pipeline.py

Lines changed: 9 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -56,17 +56,19 @@ class Pipeline(pipeline.Pipeline):
5656
--------
5757
5858
>>> from collections import Counter
59-
>>> from sklearn.datasets import fetch_mldata
59+
>>> from sklearn.datasets import make_classification
6060
>>> from sklearn.cross_validation import train_test_split as tts
6161
>>> from sklearn.decomposition import PCA
6262
>>> from sklearn.neighbors import KNeighborsClassifier as KNN
6363
>>> from sklearn.metrics import classification_report
6464
>>> from imblearn.over_sampling import SMOTE
6565
>>> from imblearn.pipeline import Pipeline
66-
>>> pima = fetch_mldata('diabetes_scale')
67-
>>> X, y = pima['data'], pima['target']
66+
>>> X, y = make_classification(n_classes=2, class_sep=2, weights=[0.1, 0.9],
67+
... n_informative=3, n_redundant=1, flip_y=0,
68+
... n_features=20, n_clusters_per_class=1,
69+
... n_samples=1000, random_state=10)
6870
>>> print('Original dataset shape {}'.format(Counter(y)))
69-
Original dataset shape Counter({1: 500, -1: 268})
71+
Original dataset shape Counter({1: 900, 0: 100})
7072
>>> pca = PCA()
7173
>>> smt = SMOTE(random_state=42)
7274
>>> knn = KNN()
@@ -81,10 +83,10 @@ class Pipeline(pipeline.Pipeline):
8183
>>> print(classification_report(y_test, y_hat))
8284
precision recall f1-score support
8385
<BLANKLINE>
84-
-1 0.49 0.67 0.56 69
85-
1 0.77 0.61 0.68 123
86+
0 0.71 1.00 0.83 24
87+
1 1.00 0.96 0.98 226
8688
<BLANKLINE>
87-
avg / total 0.67 0.63 0.64 192
89+
avg / total 0.97 0.96 0.96 250
8890
<BLANKLINE>
8991
9092
"""

0 commit comments

Comments
 (0)