Skip to content

Commit

Permalink
Add doctest for ClusterCentering
Browse files Browse the repository at this point in the history
  • Loading branch information
Guillaume Lemaitre committed Jul 10, 2016
1 parent 4797063 commit 51503c8
Show file tree
Hide file tree
Showing 2 changed files with 17 additions and 3 deletions.
3 changes: 0 additions & 3 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -19,9 +19,6 @@ clean:
test:
$(NOSETESTS) -s -v imblearn

# doctest:
# $(PYTHON) -c "import imblearn, sys, io; sys.exit(imblearn.doctest_verbose())"

coverage:
$(NOSETESTS) imblearn -s -v --with-coverage --cover-package=imblearn

Expand Down
17 changes: 17 additions & 0 deletions imblearn/under_sampling/cluster_centroids.py
Original file line number Diff line number Diff line change
Expand Up @@ -62,6 +62,23 @@ class ClusterCentroids(SamplerMixin):
-----
This class support multi-class.
Examples
--------
>>> import tempfile
>>> from collections import Counter
>>> from sklearn.datasets import fetch_mldata
>>> from imblearn.under_sampling import ClusterCentroids
>>> test_data_home = tempfile.mkdtemp()
>>> pima = fetch_mldata('diabetes_scale', data_home=test_data_home)
>>> X, y = pima['data'], pima['target']
>>> print('Original dataset shape {}'.format(Counter(y)))
Original dataset shape Counter({1: 500, -1: 268})
>>> cc = ClusterCentroids()
>>> X_res, y_res = cc.fit_sample(X, y)
>>> print('Resampled dataset shape {}'.format(Counter(y_res)))
Resampled dataset shape Counter({1: 268, -1: 268})
"""

def __init__(self, ratio='auto', random_state=None, n_jobs=-1, **kwargs):
Expand Down

0 comments on commit 51503c8

Please sign in to comment.