Welcome to imbalanced-ensemble documentation!
Date: Jun 16, 2024 Version: 0.2.2 Github: imbalanced-ensemble
⏳Quick Start with our 5-minute Guide & Detailed Examples
Status | |
PyPI | |
Traffic | |
Documentation | |
Paper & Citation | |
Language |
IMBENS (imported as imbens
) is a Python library for quick implementation, modification, evaluation, and visualization of ensemble learning from class-imbalanced data.
Currently, IMBENS includes over 15 ensemble imbalanced learning algorithms (SMOTEBoost, SMOTEBagging, RUSBoost, EasyEnsemble, SelfPacedEnsemble, etc) and 19 over-/under-sampling methods (SMOTE, ADASYN, TomekLinks, etc) from imbalance-learn.
🌈 IMBENS Highlights
🧑💻 Ease-of-use: Unified, easy-to-use APIs with documentation and examples.
🚀 Performance: Optimized performance with parallelization using joblib.
📊 Benchmarking: Running & comparing multiple models with our visualizer.
📺 Monitoring: Powerful, customizable, interactive training logging.
🪐 Versatility: Full compatibility with scikit-learn and imbalanced-learn.
📈 Functionality: Extending existing techniques from binary to multi-class setting.
✂️ Use IMBENS for class-imbalanced classification with <5 lines of code:
# Train an SPE classifier
from imbens.ensemble import SelfPacedEnsembleClassifier
clf = SelfPacedEnsembleClassifier(random_state=42)
clf.fit(X_train, y_train)
# Predict with an SPE classifier
y_pred = clf.predict(X_test)
🤗 Citing IMBENS
🍻 We appreciate your citation if you find our work helpful! The BibTeX entry:
@article{liu2023imbens,
title={IMBENS: Ensemble Class-imbalanced Learning in Python},
author={Liu, Zhining and Kang, Jian and Tong, Hanghang and Chang, Yi},
journal={arXiv preprint arXiv:2111.12776},
year={2023}
}
API Demo:
>>> from imbens.ensemble import SelfPacedEnsembleClassifier
>>> from imbens.datasets import generate_imbalance_data
>>> from imbens.utils import evaluate_print
>>> from imbens.visualizer import ImbalancedEnsembleVisualizer
>>>
>>> X_train, X_test, y_train, y_test = generate_imbalance_data(
... n_samples=200, weights=[.9,.1], test_size=.5)
>>>
>>> clf = SelfPacedEnsembleClassifier() # initialize ensemble
>>> clf.fit(X_train, y_train)
>>>
>>> y_test_pred = clf.predict(X_test) # predict labels
>>> y_test_proba = clf.predict_proba(X_test) # predict probabilities
>>>
>>> evaluate_print(y_test, y_test_pred, "SPE") # performance evaluation
SPE balanced Acc: 0.972 | macro Fscore: 0.886 | macro Gmean: 0.972
>>>
>>> visualizer = ImbalancedEnsembleVisualizer() # initialize visualizer
>>> visualizer.fit({'SPE': clf})
>>>
>>> visualizer.performance_lineplot() # performance visualization
>>> visualizer.confusion_matrix_heatmap() # prediction visualization