Skip to main content

Imbalanced Learning Regression

PyPI version License: GPL v3 GitHub last commit

Description

A Python implementation of sampling techniques for Regression. Conducts different sampling techniques for Regression. Useful for prediction problems where regression is applicable, but the values in the interest of predicting are rare or uncommon. This can also serve as a useful alternative to log transforming a skewed response variable, especially if generating synthetic data is also of interest.

Citation

If you use the code from this repository, please cite the following article:

Wu, W., Kunz, N., & Branco, P. (2022, September). ImbalancedLearningRegression-A Python Package to Tackle the Imbalanced Regression Problem. In Joint European Conference on Machine Learning and Knowledge Discovery in Databases (pp. 645-648). Cham: Springer Nature Switzerland.

For bibtex users:

@inproceedings{wu2022imbalancedlearningregression, title={ImbalancedLearningRegression-A Python Package to Tackle the Imbalanced Regression Problem}, author={Wu, Wenglei and Kunz, Nicholas and Branco, Paula}, booktitle={Joint European Conference on Machine Learning and Knowledge Discovery in Databases}, pages={645--648}, year={2022}, organization={Springer} }

Article Link: https://link.springer.com/chapter/10.1007/978-3-031-26422-1_48

Features

  1. An open-source Python supported version of sampling techniques for Regression, a variation of Nick Kunz's package SMOGN.

  2. Supports Pandas DataFrame inputs containing mixed data types.

  3. Flexible inputs available to control the areas of interest within a continuous response variable and friendly parameters for re-sampling data.

  4. Purely Pythonic, developed for consistency, maintainability, and future improvement, no foreign function calls to C or Fortran, as contained in original R implementation.

Requirements

  1. Python 3
  2. NumPy
  3. Pandas
  4. Scikit-learn

Installation

## install pypi release
pip install ImbalancedLearningRegression

## install developer version
pip install git+https://github.com/paobranco/ImbalancedLearningRegression.git

Usage

## load libraries
import pandas
import ImbalancedLearningRegression as iblr

## load data
housing = pandas.read_csv(
    ## http://jse.amstat.org/v19n3/decock.pdf
    "https://raw.githubusercontent.com/paobranco/ImbalancedLearningRegression/master/data/housing.csv"
)

## conduct Random Over-sampling
housing_ro = iblr.ro(
    data = housing, 
    y = "SalePrice"
)

## conduct Introduction of Gaussian Noise
housing_gn = iblr.gn(
    data = housing, 
    y = "SalePrice"
)

Examples

  1. Random Over-sampling
  2. Introduction of Gaussian Noise
  3. Condensed Nearest Neighbor
  4. Edited Nearest Neighbor

For the examples of other techniques, please refer to here.

Documentation

The documentation of the package can be found here.

License

© Paula Branco, 2022. Licensed under the General Public License v3.0 (GPLv3).

Contributions

ImbalancedLearningRegression is open for improvements and maintenance. Your help is valued to make the package better for everyone.

Reference

Branco, P., Torgo, L., Ribeiro, R. (2017). SMOGN: A Pre-Processing Approach for Imbalanced Regression. Proceedings of Machine Learning Research, 74:36-50. http://proceedings.mlr.press/v74/branco17a/branco17a.pdf

Branco, P., Torgo, L., & Ribeiro, R. P. (2019). Pre-processing approaches for imbalanced distributions in regression. Neurocomputing, 343, 76-99. https://www.sciencedirect.com/science/article/abs/pii/S0925231219301638

Chawla, N. V., Bowyer, K. W., Hall, L. O., & Kegelmeyer, W. P. (2002). SMOTE: synthetic minority over-sampling technique. Journal of artificial intelligence research, 16, 321-357. https://www.jair.org/index.php/jair/article/view/10302

Elhassan, T., & Aljurf, M. (2016). Classification of imbalance data using tomek link (t-link) combined with random under-sampling (rus) as a data reduction method. Global J Technol Optim S, 1. https://www.researchgate.net/profile/Mohamed-Shoukri-2/publication/326590590_Classification_of_Imbalance_Data_using_Tomek_Link_T-Link_Combined_with_Random_Under-sampling_RUS_as_a_Data_Reduction_Method/links/5b96a6a0a6fdccfd543cbc40/Classification-of-Imbalance-Data-using-Tomek-Link-T-Link-Combined-with-Random-Under-sampling-RUS-as-a-Data-Reduction-Method.pdf

Hart, P. (1968). The condensed nearest neighbor rule (corresp.). IEEE transactions on information theory, 14(3), 515-516. https://ieeexplore.ieee.org/document/1054155

He, H., Bai, Y., Garcia, E. A., & Li, S. (2008, June). ADASYN: Adaptive synthetic sampling approach for imbalanced learning. In 2008 IEEE international joint conference on neural networks (IEEE world congress on computational intelligence) (pp. 1322-1328). IEEE. https://www.ele.uri.edu/faculty/he/PDFfiles/adasyn.pdf

Kunz, N., (2019). SMOGN. https://github.com/nickkunz/smogn

Menardi, G., & Torelli, N. (2014). Training and assessing classification rules with imbalanced data. Data mining and knowledge discovery, 28(1), 92-122. https://link.springer.com/article/10.1007/s10618-012-0295-5

Tomek, I. (1976). Two modifications of CNN. IEEE Trans. Systems, Man and Cybernetics, 6, 769-772. https://ieeexplore.ieee.org/document/4309452

Torgo, L., Ribeiro, R. P., Pfahringer, B., & Branco, P. (2013, September). Smote for regression. In Portuguese conference on artificial intelligence (pp. 378-389). Springer, Berlin, Heidelberg. https://link.springer.com/chapter/10.1007/978-3-642-40669-0_33

Wilson, D. L. (1972). Asymptotic properties of nearest neighbor rules using edited data. IEEE Transactions on Systems, Man, and Cybernetics, (3), 408-421. https://ieeexplore.ieee.org/abstract/document/4309137

Metadata

Release files for ImbalancedLearningRegression 0.0.2

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for ImbalancedLearningRegression 0.0.2
File Size Uploaded Provenance
imbalancedlearningregression-0.0.2.tar.gz 52.3 kB Without provenance Details

Built distribution (wheel)

Table of built distributions (wheels) for ImbalancedLearningRegression 0.0.2
File Interpreter ABI Platform
ImbalancedLearningRegression-0.0.2-py3-none-any.whl Python 3 none any Details

Total release size: 129.5 kB

Release files / imbalancedlearningregression-0.0.2.tar.gz

Download URL imbalancedlearningregression-0.0.2.tar.gz
Size 52.3 kB
Tags Source
SHA-256 checksum
How to use checksums
a3a19d8153aeb7adc360726ad874174f043312cce88dd9fec0fcf87d6cc60abd
BLAKE2b-256 checksum
How to use checksums
192ee2759996b048be5ac12b06eac279094639424aa22c7775d0c87f77c9b23b
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/5.1.0 CPython/3.11.0

Release files / ImbalancedLearningRegression-0.0.2-py3-none-any.whl

Download URL ImbalancedLearningRegression-0.0.2-py3-none-any.whl
Size 77.2 kB
Tags Python 3
SHA-256 checksum
How to use checksums
cd368f9f550b1cbb9a6e6cac621da848ba842f5f6525b2970413cf2f72173b77
BLAKE2b-256 checksum
How to use checksums
16f69796f11c110ea44d967fdf8be1ced9fe62ee55b8a8dca3d1a6198901e390
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/5.1.0 CPython/3.11.0

Security for ImbalancedLearningRegression 0.0.2

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

No provenance found

None of the files in this release were uploaded with provenance metadata.

A note on package security

PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.

Release history Release notifications | RSS feed

This release

0.0.2 This release

2 release files No provenance

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page