1 imbutil
Additions to the imbalanced-learn package.
from imbutil.combine import MinMaxRandomSampler; from imblearn import pipeline;
# oversampling minority classes to 100 and undersampling majority classes to 800
sampler = MinMaxRandomSampler(min_freq=100, max_freq=800)
sampling_clf = pipeline.make_pipeline(sampler, inner_clf)
1.1 Installation
pip install imbutil
Additionally, the MinMaxRandomSampler, in addition to RandomUnderSampler and RandomOverSampler from imbalanced-learn, can technically be used with non-numeric data. However, the current implementation of imbalanced-learn forces a check for numeric data for all samplers. If you want to bypass this limitation, I have a fork of the project which does not force data to be numeric. You can install it with:
pip install git+https://github.com/shaypal5/imbalanced-learn.git@f6adc562fafdc2198931873799e725e5abdd65a1
1.2 Basic Use
imbutil additions addhere to the structure of the imblearn package:
1.2.1 combine
Containes samplers that both under-sample and over-sample:
MinMaxRandomSampler - Random samples data to bring all class frequencies into a range.
1.3 Contributing
Package author and current maintainer is Shay Palachy (shay.palachy@gmail.com); You are more than welcome to approach him for help. Contributions are very welcomed.
1.3.1 Installing for development
Clone:
git clone git@github.com:shaypal5/imbutil.git
Install in development mode, and with test dependencies:
cd imbutil
pip install -e ".[test]"
1.3.2 Running the tests
To run the tests use:
cd imbutil
pytest
1.3.3 Adding documentation
The project is documented using the numpy docstring conventions, which were chosen as they are perhaps the most widely-spread conventions that are both supported by common tools such as Sphinx and result in human-readable docstrings. When documenting code you add to this project, follow these conventions.
Additionally, if you update this README.rst file, use python setup.py checkdocs to validate it compiles.
1.4 Credits
Created by Shay Palachy (shay.palachy@gmail.com).
Metadata
Release files for imbutil 0.0.8
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | |
|---|---|---|---|
| imbutil-0.0.8.tar.gz | 20.9 kB | Details |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Reset |
|---|---|---|---|---|
| imbutil-0.0.8-py3-none-any.whl | Python 3 | none | any | Details |
Total release size: 26.9 kB
Release files / imbutil-0.0.8.tar.gz
| Download URL | imbutil-0.0.8.tar.gz |
|---|---|
| Size | 20.9 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
6de5209f5029cce145d0bb729c995e2ba5543230387fc1114890b444e71f0a08
|
|
BLAKE2b-256 checksum How to use checksums |
1e6e3089538d8a69e20f40bb7f7a09a8569173901ad403af39e793450e3a8847
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/1.12.1 pkginfo/1.5.0.1 requests/2.21.0 setuptools/40.5.0 requests-toolbelt/0.8.0 tqdm/4.28.1 CPython/3.6.5
|
Release files / imbutil-0.0.8-py3-none-any.whl
| Download URL | imbutil-0.0.8-py3-none-any.whl |
|---|---|
| Size | 6.0 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
5a26de7570e8c38857bfe3726f5826df32df5b858d5b9f71bd061fd2778553f1
|
|
BLAKE2b-256 checksum How to use checksums |
6fbbee119860e6b22fa6299cbe22815921d536111f15434e7d3d7824a18f1333
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/1.12.1 pkginfo/1.5.0.1 requests/2.21.0 setuptools/40.5.0 requests-toolbelt/0.8.0 tqdm/4.28.1 CPython/3.6.5
|