Skip to content

Commit

Permalink
DOC udpate the datasets used in CondensedNearestNeighbour docstring (#…
Browse files Browse the repository at this point in the history
  • Loading branch information
eroell authored Sep 7, 2023
1 parent 0553fbe commit dcb476d
Showing 1 changed file with 8 additions and 5 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -110,17 +110,20 @@ class CondensedNearestNeighbour(BaseCleaningSampler):
Examples
--------
>>> from collections import Counter # doctest: +SKIP
>>> from sklearn.datasets import fetch_mldata # doctest: +SKIP
>>> from sklearn.datasets import fetch_openml # doctest: +SKIP
>>> from sklearn.preprocessing import scale # doctest: +SKIP
>>> from imblearn.under_sampling import \
CondensedNearestNeighbour # doctest: +SKIP
>>> pima = fetch_mldata('diabetes_scale') # doctest: +SKIP
>>> X, y = pima['data'], pima['target'] # doctest: +SKIP
>>> X, y = fetch_openml('diabetes', version=1, return_X_y=True) # doctest: +SKIP
>>> X = scale(X) # doctest: +SKIP
>>> print('Original dataset shape %s' % Counter(y)) # doctest: +SKIP
Original dataset shape Counter({{1: 500, -1: 268}}) # doctest: +SKIP
Original dataset shape Counter({{'tested_negative': 500, \
'tested_positive': 268}}) # doctest: +SKIP
>>> cnn = CondensedNearestNeighbour(random_state=42) # doctest: +SKIP
>>> X_res, y_res = cnn.fit_resample(X, y) #doctest: +SKIP
>>> print('Resampled dataset shape %s' % Counter(y_res)) # doctest: +SKIP
Resampled dataset shape Counter({{-1: 268, 1: 227}}) # doctest: +SKIP
Resampled dataset shape Counter({{'tested_positive': 268, \
'tested_negative': 181}}) # doctest: +SKIP
"""

_parameter_constraints: dict = {
Expand Down

0 comments on commit dcb476d

Please sign in to comment.