Skip to content

Commit 342c36c

Browse files
author
Guillaume Lemaitre
committed
Change the md to rst
1 parent ea6afe0 commit 342c36c

File tree

3 files changed

+150
-130
lines changed

3 files changed

+150
-130
lines changed

README.md

Lines changed: 0 additions & 128 deletions
This file was deleted.

README.rst

Lines changed: 145 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,145 @@
1+
.. -*- mode: rst -*-
2+
3+
imbalanced-learn
4+
================
5+
6+
imbalanced-learn is a python package offering a number of re-sampling techniques commonly used in datasets showing strong between-class imbalance.
7+
It is compatible with [scikit-learn](http://scikit-learn.org/stable/) and has been submitted to be part of [scikit-learn-contrib](https://github.com/scikit-learn-contrib) projects.
8+
9+
|Landscape|_ |Travis|_ |Coveralls|_ |CircleCI|_ |Gitter|_
10+
11+
.. |Landscape| image:: https://landscape.io/github/glemaitre/UnbalancedDataset/master/landscape.svg?style=flat
12+
.. _Landscape: https://landscape.io/github/glemaitre/UnbalancedDataset/master
13+
14+
.. |Travis| image:: https://travis-ci.org/glemaitre/UnbalancedDataset.svg?branch=master
15+
.. _Travis: https://travis-ci.org/glemaitre/UnbalancedDataset
16+
17+
.. |Coveralls| image:: https://coveralls.io/repos/github/glemaitre/UnbalancedDataset/badge.svg?branch=master
18+
.. _Coveralls: https://coveralls.io/github/glemaitre/UnbalancedDataset?branch=master
19+
20+
.. |CircleCI| image:: https://circleci.com/gh/glemaitre/UnbalancedDataset.svg?style=shield&circle-token=:circle-token
21+
.. _CircleCI: https://circleci.com/gh/glemaitre/UnbalancedDataset/tree/master
22+
23+
.. |Gitter| image:: https://badges.gitter.im/glemaitre/UnbalancedDataset.svg
24+
.. _Gitter: https://gitter.im/glemaitre/UnbalancedDataset?utm_source=badge&utm_medium=badge&utm_campaign=pr-badge&utm_content=badge
25+
26+
Documentation
27+
=============
28+
29+
Installation documentation, API documentation, and examples can be found on the documentation_.
30+
31+
.. _documentation: http://glemaitre.github.io/UnbalancedDataset
32+
33+
Installation
34+
============
35+
36+
### Dependencies
37+
38+
imbalanced-learn is tested to work under Python 2.7 and Python 3.5.
39+
40+
* scipy(>=0.17.0)
41+
* numpy(>=1.10.4)
42+
* scikit-learn(>=0.17.1)
43+
44+
### Installation
45+
46+
imbalanced-learn is not currently available on the PyPi's reporitories,
47+
however you can install it via `pip`:
48+
49+
pip install git+https://github.com/fmfn/UnbalancedDataset
50+
51+
If you prefer, you can clone it and run the setup.py file. Use the following commands to get a
52+
copy from Github and install all dependencies:
53+
54+
git clone https://github.com/fmfn/UnbalancedDataset.git
55+
cd UnbalancedDataset
56+
python setup.py install
57+
58+
### Testing
59+
60+
After installation, you can use `nose` to run the test suite:
61+
62+
```
63+
make coverage
64+
```
65+
66+
About
67+
=====
68+
69+
Most classification algorithms will only perform optimally when the number of samples of each class is roughly the same. Highly skewed datasets, where the minority is heavily outnumbered by one or more classes, have proven to be a challenge while at the same time becoming more and more common.
70+
71+
One way of addresing this issue is by re-sampling the dataset as to offset this imbalance with the hope of arriving at a more robust and fair decision boundary than you would otherwise.
72+
73+
Re-sampling techniques are divided in two categories:
74+
1. Under-sampling the majority class(es).
75+
2. Over-sampling the minority class.
76+
3. Combining over- and under-sampling.
77+
4. Create ensemble balanced sets.
78+
79+
Below is a list of the methods currently implemented in this module.
80+
81+
* Under-sampling
82+
1. Random majority under-sampling with replacement
83+
2. Extraction of majority-minority Tomek links [1]_
84+
3. Under-sampling with Cluster Centroids
85+
4. NearMiss-(1 & 2 & 3) [2]_
86+
5. Condensend Nearest Neighbour [3]_
87+
6. One-Sided Selection [4]_
88+
7. Neighboorhood Cleaning Rule [5]_
89+
8. Edited Nearest Neighbours [6]_
90+
9. Instance Hardness Threshold [7]_
91+
10. Repeated Edited Nearest Neighbours [14]_
92+
93+
* Over-sampling
94+
1. Random minority over-sampling with replacement
95+
2. SMOTE - Synthetic Minority Over-sampling Technique [8]_
96+
3. bSMOTE(1 & 2) - Borderline SMOTE of types 1 and 2 [9]_
97+
4. SVM SMOTE - Support Vectors SMOTE [10]_
98+
5. ADASYN - Adaptive synthetic sampling approach for imbalanced learning [15]_
99+
100+
* Over-sampling followed by under-sampling
101+
1. SMOTE + Tomek links [12]_
102+
2. SMOTE + ENN [11]_
103+
104+
* Ensemble sampling
105+
1. EasyEnsemble [13]_
106+
2. BalanceCascade [13]_
107+
108+
The different algorithms are presented in the following notebook_.
109+
110+
.. _notebook: https://github.com/fmfn/UnbalancedDataset/blob/master/examples/plot_unbalanced_dataset.ipynb
111+
112+
This is a work in progress. Any comments, suggestions or corrections are welcome.
113+
114+
References:
115+
-----------
116+
117+
.. [1] : I. Tomek, “Two modifications of CNN,” In Systems, Man, and Cybernetics, IEEE Transactions on, vol. 6, pp 769-772, 2010.
118+
119+
.. [2] : I. Mani, I. Zhang. “kNN approach to unbalanced data distributions: a case study involving information extraction,” In Proceedings of workshop on learning from imbalanced datasets, 2003.
120+
121+
.. [3] : P. Hart, “The condensed nearest neighbor rule,” In Information Theory, IEEE Transactions on, vol. 14(3), pp. 515-516, 1968.
122+
123+
.. [4] : M. Kubat, S. Matwin, “Addressing the curse of imbalanced training sets: one-sided selection,” In ICML, vol. 97, pp. 179-186, 1997.
124+
125+
.. [5] : J. Laurikkala, “Improving identification of difficult small classes by balancing class distribution,” Springer Berlin Heidelberg, 2001.
126+
127+
.. [6] : D. Wilson, “Asymptotic Properties of Nearest Neighbor Rules Using Edited Data,” In IEEE Transactions on Systems, Man, and Cybernetrics, vol. 2 (3), pp. 408-421, 1972.
128+
129+
.. [7] : D. Smith, Michael R., Tony Martinez, and Christophe Giraud-Carrier. “An instance level analysis of data complexity.” Machine learning 95.2 (2014): 225-256.
130+
131+
.. [8] : N. V. Chawla, K. W. Bowyer, L. O.Hall, W. P. Kegelmeyer, “SMOTE: synthetic minority over-sampling technique,” Journal of artificial intelligence research, 321-357, 2002.
132+
133+
.. [9] : H. Han, W. Wen-Yuan, M. Bing-Huan, “Borderline-SMOTE: a new over-sampling method in imbalanced data sets learning,” Advances in intelligent computing, 878-887, 2005.
134+
135+
.. [10] : H. M. Nguyen, E. W. Cooper, K. Kamei, “Borderline over-sampling for imbalanced data classification,” International Journal of Knowledge Engineering and Soft Data Paradigms, 3(1), pp.4-21, 2001.
136+
137+
.. [11] : G. Batista, R. C. Prati, M. C. Monard. “A study of the behavior of several methods for balancing machine learning training data,” ACM Sigkdd Explorations Newsletter 6 (1), 20-29, 2004.
138+
139+
.. [12] : G. Batista, B. Bazzan, M. Monard, [“Balancing Training Data for Automated Annotation of Keywords: a Case Study,” In WOB, 10-18, 2003.
140+
141+
.. [13] : X. Y. Liu, J. Wu and Z. H. Zhou, “Exploratory Undersampling for Class-Imbalance Learning,” in IEEE Transactions on Systems, Man, and Cybernetics, Part B (Cybernetics), vol. 39, no. 2, pp. 539-550, April 2009.
142+
143+
.. [14] : I. Tomek, “An Experiment with the Edited Nearest-Neighbor Rule,” IEEE Transactions on Systems, Man, and Cybernetics, vol. 6(6), pp. 448-452, June 1976.
144+
145+
.. [15] : He, Haibo, Yang Bai, Edwardo A. Garcia, and Shutao Li. “ADASYN: Adaptive synthetic sampling approach for imbalanced learning,” In IEEE International Joint Conference on Neural Networks (IEEE World Congress on Computational Intelligence), pp. 1322-1328, 2008.

setup.py

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,8 @@ def is_installing():
3636
_VERSION_GLOBALS = load_version()
3737
DISTNAME = 'imbalanced-learn'
3838
DESCRIPTION = 'Toolbox for imbalanced dataset in machine learning.'
39-
LONG_DESCRIPTION = descr
39+
with open('README.rst') as f:
40+
LONG_DESCRIPTION = f.read()
4041
MAINTAINER = 'G. Lemaitre, F. Nogueira, D. Oliveira, C. Aridas'
4142
4243
URL = 'https://github.com/fmfn/UnbalancedDataset'
@@ -84,4 +85,6 @@ def is_installing():
8485
'Programming Language :: Python :: 3.4',
8586
],
8687
packages=find_packages(),
87-
install_requires=install_requires,)
88+
install_requires=['scipy>=0.17.0',
89+
'numpy>=1.10.4',
90+
'scikit-learn>=0.17.1'])

0 commit comments

Comments
 (0)