self-paced-ensemble

self-paced-ensemble

自适应集成学习框架解决高度不平衡数据分类

Self-paced Ensemble (SPE)是一个处理大规模高度不平衡数据分类的集成学习框架。SPE采用严格平衡的欠采样策略,无需计算样本间距离,适用于各类数据集。该框架计算高效,性能优异,可与多种学习模型兼容。作为通用框架,SPE能提升现有方法在不平衡数据上的表现,特别适合处理噪声大、极度不平衡的大规模数据集。

Self-paced Ensemble不平衡数据分类集成学习机器学习Python库Github开源项目

<p align="center"> <a href="https://github.com/ZhiningLiu1998/self-paced-ensemble"> <img src="https://img.shields.io/badge/ZhiningLiu1998-SPE-orange"> </a> <a href="https://github.com/ZhiningLiu1998/self-paced-ensemble/stargazers"> <img src="https://img.shields.io/github/stars/ZhiningLiu1998/self-paced-ensemble"> </a> <a href="https://github.com/ZhiningLiu1998/self-paced-ensemble/network/members"> <img src="https://img.shields.io/github/forks/ZhiningLiu1998/self-paced-ensemble"> </a> <a href="https://github.com/ZhiningLiu1998/self-paced-ensemble/issues"> <img src="https://img.shields.io/github/issues/ZhiningLiu1998/self-paced-ensemble"> </a> <a href="https://github.com/ZhiningLiu1998/self-paced-ensemble/blob/master/LICENSE"> <img src="https://img.shields.io/github/license/ZhiningLiu1998/self-paced-ensemble"> </a> <a href="https://pypi.org/project/self-paced-ensemble/"> <img src="https://yellow-cdn.veclightyear.com/0a4dffa0/e1d7276f-6483-4c51-99df-eb5a05513502.svg"> </a> <a href="https://www.python.org/"> <img src="https://yellow-cdn.veclightyear.com/0a4dffa0/9a11391f-97d2-49b8-9620-e8c5d569869b.svg"> </a> <a href="https://github.com/ZhiningLiu1998/self-paced-ensemble/graphs/traffic"> <img src="https://visitor-badge.glitch.me/badge?page_id=ZhiningLiu1998.self-paced-ensemble"> </a> <a href="https://github.com/ZhiningLiu1998/self-paced-ensemble#contributors-"><img src="https://yellow-cdn.veclightyear.com/0a4dffa0/69ddf9c9-abd0-4efc-a5e6-8174cee62b58.svg"></a> <a href="https://pepy.tech/project/self-paced-ensemble"> <img src="https://pepy.tech/badge/self-paced-ensemble"> </a> <a href="https://pepy.tech/project/self-paced-ensemble"> <img src="https://pepy.tech/badge/self-paced-ensemble/month"> </a> </p> <h3 align="center">用于高度不平衡海量数据分类的自步调整集成学习方法(ICDE 2020)</h3> <h3 align="center"> 链接: <a href="https://conferences.computer.org/icde/2020/pdfs/ICDE2020-5acyuqhpJ6L9P042wmjY1p/290300a841/290300a841.pdf">论文</a> | <a href="https://zhiningliu.com/files/ICDE_2020_SPE_slides.pdf">幻灯片</a> | <a href="https://www.bilibili.com/video/BV1Fg411L7gk">视频</a> | <a href="https://arxiv.org/abs/1909.03500v3">arXiv</a> | <a href="https://pypi.org/project/self-paced-ensemble">PyPI</a> | <a href="https://imbalanced-ensemble.readthedocs.io/en/latest/api/ensemble/_autosummary/imbens.ensemble.SelfPacedEnsembleClassifier.html">API参考</a> | <a href="https://github.com/ZhiningLiu1998/self-paced-ensemble#related-projects">相关项目</a> | <a href="https://zhuanlan.zhihu.com/p/86891438">知乎</a> </h3>

自步调整集成学习(Self-paced Ensemble,SPE)是一种用于海量高度不平衡分类的集成学习框架。它是一种易于使用的类别不平衡问题解决方案,具有出色的计算效率、良好的性能,以及与不同学习模型的广泛兼容性。此SPE实现支持多类分类。

<table><tr><td bgcolor=MistyRose align="center"><strong> <font color='red'>注意:</font> <font color=Navy> SPE现已成为<a href="https://github.com/ZhiningLiu1998/imbalanced-ensemble">imbalanced-ensemble</a>的一部分 [<a href="https://imbalanced-ensemble.readthedocs.io/en/latest/">文档</a>, <a href="https://pypi.org/project/imbalanced-ensemble/">PyPI</a>]。尝试使用它以获得更多方法和高级功能! </font> </strong></td></tr></table>

引用我们

如果您发现本仓库对您的工作或研究有帮助,我们将非常感谢您引用以下论文

@inproceedings{liu2020self-paced-ensemble, title={自步调节集成用于高度不平衡的大规模数据分类}, author={刘志宁, 曹伟, 高志峰, 边江, 陈和昌, 常毅, 刘铁岩}, booktitle={2020年第36届IEEE国际数据工程会议(ICDE)论文集}, pages={841--852}, year={2020}, organization={IEEE} }

安装

推荐使用pip进行安装。 请确保安装最新版本以避免潜在问题:

$ pip install self-paced-ensemble # 正常安装 $ pip install --upgrade self-paced-ensemble # 如需更新

或者您可以通过克隆此仓库来安装SPE:

$ git clone https://github.com/ZhiningLiu1998/self-paced-ensemble.git $ cd self-paced-ensemble $ python setup.py install

需要以下依赖项:

目录

背景

SPE在每次迭代中执行严格的平衡欠采样,因此计算效率非常高。此外,SPE不依赖于计算样本之间的距离来执行重采样。它可以轻松应用于缺乏明确定义的距离度量的数据集(例如具有分类特征/缺失值),无需任何修改。此外,作为一个通用的集成框架,我们的方法可以轻松适应大多数现有的学习方法(例如C4.5、SVM、GBDT和神经网络),以提高它们在不平衡数据上的性能。与现有的不平衡学习方法相比,SPE在大规模、噪声大且高度不平衡的数据集(例如不平衡比例大于100:1)上表现特别出色。这种数据在现实世界的工业应用中广泛存在。下图概述了SPE框架。

图片

文档

我们的SPE实现可以与sklearn.ensemble分类器以非常相似的方式使用。SelfPacedEnsembleClassifier的详细文档可以在这里找到。

示例

您可以查看使用SPE的示例以获取更全面的使用示例。

API演示

from self_paced_ensemble import SelfPacedEnsembleClassifier from sklearn.tree import DecisionTreeClassifier from sklearn.datasets import make_classification from sklearn.model_selection import train_test_split # 准备类别不平衡的训练和测试数据 X, y = make_classification(n_classes=2, random_state=42, weights=[0.1, 0.9]) X_train, X_test, y_train, y_test = train_test_split( X, y, test_size=0.5, random_state=42) # 训练SPE分类器 clf = SelfPacedEnsembleClassifier( base_estimator=DecisionTreeClassifier(), n_estimators=10, ).fit(X_train, y_train) # 使用SPE分类器进行预测 clf.predict(X_test)

高级用法示例

请参见usage_example.ipynb

保存和加载模型

我们建议使用joblib或pickle来保存和加载SPE模型,例如:

from joblib import dump, load # 保存模型 dump(clf, filename='clf.joblib') # 加载模型 clf = load('clf.joblib')

您也可以使用SPE提供的替代API:

from self_paced_ensemble.utils import save_model, load_model # 保存模型 clf.save('clf.joblib') # 选项1 save_model(clf, 'clf.joblib') # 选项2 # 加载模型 clf = load_model('clf.joblib')

将SPE与其他方法进行比较

请参阅 comparison_example.ipynb

结果

数据集链接: 信用卡欺诈KDDCUP记录链接支付模拟

图片

SPE与传统重采样/集成方法在性能和计算效率方面的比较。

图片

图片

图片

其他

本仓库包含:

  • 自步调节集成(Self-paced Ensemble)的实现
  • 5种基于集成的不平衡学习基线方法的实现
    • SMOTEBoost [1]
    • SMOTEBagging [2]
    • RUSBoost [3]
    • UnderBagging [4]
    • BalanceCascade [5]
  • 基于重采样的不平衡学习基线方法的实现 [6]
  • 额外的实验结果

注意: 其他集成和重采样方法的实现基于 imbalanced-ensembleimbalanced-learn

参考文献

#参考文献
[1]N. V. Chawla, A. Lazarevic, L. O. Hall, and K. W. Bowyer, Smoteboost: Improving prediction of the minority class in boosting. in European conference on principles of data mining and knowledge discovery. Springer, 2003, pp. 107–119
[2]S. Wang and X. Yao, Diversity analysis on imbalanced data sets by using ensemble models. in 2009 IEEE Symposium on Computational Intelligence and Data Mining. IEEE, 2009, pp. 324–331.
[3]C. Seiffert, T. M. Khoshgoftaar, J. Van Hulse, and A. Napolitano, "Rusboost: A hybrid approach to alleviating class imbalance," IEEE Transactions on Systems, Man, and Cybernetics-Part A: Systems and Humans, vol. 40, no. 1, pp. 185–197, 2010.
[4]R. Barandela, R. M. Valdovinos, and J. S. Sanchez, "New applications´ of ensembles of classifiers," Pattern Analysis & Applications, vol. 6, no. 3, pp. 245–256, 2003.
[5]X.-Y. Liu, J. Wu, and Z.-H. Zhou, "Exploratory undersampling for class-imbalance learning," IEEE Transactions on Systems, Man, and Cybernetics, Part B (Cybernetics), vol. 39, no. 2, pp. 539–550, 2009.
[6]Guillaume Lemaître, Fernando Nogueira, and Christos K. Aridas. Imbalanced-learn: A python toolbox to tackle the curse of imbalanced datasets in machine learning. Journal of Machine Learning Research, 18(17):1–5, 2017.

相关项目

查看 Zhining 的其他开源项目!

<table style="font-size:15px;"> <tr> <td align="center"><a href="https://github.com/ZhiningLiu1998/imbalanced-ensemble"><img src="https://yellow-cdn.veclightyear.com/0a4dffa0/d7d437a4-e495-4267-bf22-87b67d588abe.png" height="80px" alt=""/><br /><sub><b>Imbalanced-Ensemble [Python库]</b></sub></a><br /> <a href="https://github.com/ZhiningLiu1998/imbalanced-ensemble/stargazers"> <img alt="GitHub stars" src="https://img.shields.io/github/stars/ZhiningLiu1998/imbalanced-ensemble?style=social"> </a> </td> <td align="center"><a href="https://github.com/ZhiningLiu1998/awesome-imbalanced-learning"><img src="https://yellow-cdn.veclightyear.com/0a4dffa0/9039e3d7-51ea-4e29-a6f1-fbcac77f4ef9.png" height="80px" alt=""/><br /><sub><b>不平衡学习 [Awesome]</b></sub></a><br /> <a href="https://github.com/ZhiningLiu1998/awesome-imbalanced-learning/stargazers"> <img alt="GitHub stars" src="https://img.shields.io/github/stars/ZhiningLiu1998/awesome-imbalanced-learning?style=social"> </a> </td> <td align="center"><a href="https://github.com/ZhiningLiu1998/awesome-awesome-machine-learning"><img src="https://yellow-cdn.veclightyear.com/0a4dffa0/de87e1c5-7597-449c-8824-06af156376f3.png" height="80px" alt=""/><br /><sub><b>机器学习 [Awesome]</b></sub></a><br /> <a href="https://github.com/ZhiningLiu1998/awesome-awesome-machine-learning/stargazers"> <img alt="GitHub stars" src="https://img.shields.io/github/stars/ZhiningLiu1998/awesome-awesome-machine-learning?style=social"> </a> </td> <td align="center"><a href="https://github.com/ZhiningLiu1998/mesa"><img src="https://yellow-cdn.veclightyear.com/0a4dffa0/b7a1ec32-cd88-4142-831f-0273b8a3ac53.png" height="80px" alt=""/><br /><sub><b>Meta-Sampler [NeurIPS]</b></sub></a><br /> <a href="https://github.com/ZhiningLiu1998/mesa/stargazers"> <img alt="GitHub stars" src="https://img.shields.io/github/stars/ZhiningLiu1998/mesa?style=social"> </a> </td> </tr> </table>

贡献者 ✨

感谢这些优秀的人 (表情符号说明):

<!-- ALL-CONTRIBUTORS-LIST:START - 请勿删除或修改此部分 --> <!-- prettier-ignore-start --> <!-- markdownlint-disable --> <table> <tr> <td align="center"><a href="http://zhiningliu.com"><img src="https://avatars.githubusercontent.com/u/26108487?v=4?s=100" width="100px;" alt=""/><br /><sub><b>刘志宁</b></sub></a><br /><a href="https://github.com/ZhiningLiu1998/self-paced-ensemble/commits?author=ZhiningLiu1998" title="代码">💻</a> <a href="https://github.com/ZhiningLiu1998/self-paced-ensemble/commits?author=ZhiningLiu1998" title="文档">📖</a> <a href="#example-ZhiningLiu1998" title="示例">💡</a></td> <td align="center"><a href="https://yumingfu.space/"><img src="https://avatars.githubusercontent.com/u/23732534?v=4?s=100" width="100px;" alt=""/><br /><sub><b>付昱铭</b></sub></a><br /><a href="https://github.com/ZhiningLiu1998/self-paced-ensemble/commits?author=rudolffu" title="代码">💻</a> <a href="https://github.com/ZhiningLiu1998/self-paced-ensemble/issues?q=author%3Arudolffu" title="错误报告">🐛</a></td> <td align="center"><a href="https://thul.io"><img src="https://avatars.githubusercontent.com/u/95307?v=4?s=100" width="100px;" alt=""/><br /><sub><b>Thúlio Costa</b></sub></a><br /><a href="https://github.com/ZhiningLiu1998/self-paced-ensemble/commits?author=thulio" title="代码">💻</a> <a href="https://github.com/ZhiningLiu1998/self-paced-ensemble/issues?q=author%3Athulio" title="错误报告">🐛</a></td> <td align="center"><a href="https://github.com/jerrylususu"><img src="https://avatars.githubusercontent.com/u/17522475?v=4?s=100" width="100px;" alt=""/><br /><sub><b>Neko Null</b></sub></a><br /><a href="#maintenance-jerrylususu" title="维护">🚧</a></td> <td align="center"><a href="https://github.com/lirenjieArthur"><img src="https://avatars.githubusercontent.com/u/31763604?v=4?s=100" width="100px;" alt=""/><br /><sub><b>lirenjieArthur</b></sub></a><br /><a href="https://github.com/ZhiningLiu1998/self-paced-ensemble/issues?q=author%3AlirenjieArthur" title="错误报告">🐛</a></td> <td align="center"><a href="https://github.com/mokeeqian"><img src="https://avatars.githubusercontent.com/u/45727636?v=4?s=100" width="100px;" alt=""/><br /><sub><b>AC手动机</b></sub></a><br /><a href="https://github.com/ZhiningLiu1998/self-paced-ensemble/issues?q=author%3Amokeeqian" title="错误报告">🐛</a></td> <td align="center"><a href="https://www.linkedin.com/in/carlo-moro-4a20a7132"><img src="https://avatars.githubusercontent.com/u/21183273?v=4?s=100" width="100px;" alt=""/><br /><sub><b>Carlo Moro</b></sub></a><br /><a href="#ideas-cnmoro" title="想法、规划与反馈">🤔</a></td> </tr> </table> <!-- markdownlint-restore --> <!-- prettier-ignore-end --> <!-- ALL-CONTRIBUTORS-LIST:END -->

本项目遵循all-contributors规范。欢迎任何形式的贡献!

编辑推荐精选

Trae

Trae

字节跳动发布的AI编程神器IDE

Trae是一种自适应的集成开发环境(IDE),通过自动化和多元协作改变开发流程。利用Trae,团队能够更快速、精确地编写和部署代码,从而提高编程效率和项目交付速度。Trae具备上下文感知和代码自动完成功能,是提升开发效率的理想工具。

AI工具TraeAI IDE协作生产力转型热门
问小白

问小白

全能AI智能助手,随时解答生活与工作的多样问题

问小白,由元石科技研发的AI智能助手,快速准确地解答各种生活和工作问题,包括但不限于搜索、规划和社交互动,帮助用户在日常生活中提高效率,轻松管理个人事务。

热门AI助手AI对话AI工具聊天机器人
Transly

Transly

实时语音翻译/同声传译工具

Transly是一个多场景的AI大语言模型驱动的同声传译、专业翻译助手,它拥有超精准的音频识别翻译能力,几乎零延迟的使用体验和支持多国语言可以让你带它走遍全球,无论你是留学生、商务人士、韩剧美剧爱好者,还是出国游玩、多国会议、跨国追星等等,都可以满足你所有需要同传的场景需求,线上线下通用,扫除语言障碍,让全世界的语言交流不再有国界。

讯飞智文

讯飞智文

一键生成PPT和Word,让学习生活更轻松

讯飞智文是一个利用 AI 技术的项目,能够帮助用户生成 PPT 以及各类文档。无论是商业领域的市场分析报告、年度目标制定,还是学生群体的职业生涯规划、实习避坑指南,亦或是活动策划、旅游攻略等内容,它都能提供支持,帮助用户精准表达,轻松呈现各种信息。

AI办公办公工具AI工具讯飞智文AI在线生成PPTAI撰写助手多语种文档生成AI自动配图热门
讯飞星火

讯飞星火

深度推理能力全新升级,全面对标OpenAI o1

科大讯飞的星火大模型,支持语言理解、知识问答和文本创作等多功能,适用于多种文件和业务场景,提升办公和日常生活的效率。讯飞星火是一个提供丰富智能服务的平台,涵盖科技资讯、图像创作、写作辅助、编程解答、科研文献解读等功能,能为不同需求的用户提供便捷高效的帮助,助力用户轻松获取信息、解决问题,满足多样化使用场景。

热门AI开发模型训练AI工具讯飞星火大模型智能问答内容创作多语种支持智慧生活
Spark-TTS

Spark-TTS

一种基于大语言模型的高效单流解耦语音令牌文本到语音合成模型

Spark-TTS 是一个基于 PyTorch 的开源文本到语音合成项目,由多个知名机构联合参与。该项目提供了高效的 LLM(大语言模型)驱动的语音合成方案,支持语音克隆和语音创建功能,可通过命令行界面(CLI)和 Web UI 两种方式使用。用户可以根据需求调整语音的性别、音高、速度等参数,生成高质量的语音。该项目适用于多种场景,如有声读物制作、智能语音助手开发等。

咔片PPT

咔片PPT

AI助力,做PPT更简单!

咔片是一款轻量化在线演示设计工具,借助 AI 技术,实现从内容生成到智能设计的一站式 PPT 制作服务。支持多种文档格式导入生成 PPT,提供海量模板、智能美化、素材替换等功能,适用于销售、教师、学生等各类人群,能高效制作出高品质 PPT,满足不同场景演示需求。

讯飞绘文

讯飞绘文

选题、配图、成文,一站式创作,让内容运营更高效

讯飞绘文,一个AI集成平台,支持写作、选题、配图、排版和发布。高效生成适用于各类媒体的定制内容,加速品牌传播,提升内容营销效果。

热门AI辅助写作AI工具讯飞绘文内容运营AI创作个性化文章多平台分发AI助手
材料星

材料星

专业的AI公文写作平台,公文写作神器

AI 材料星,专业的 AI 公文写作辅助平台,为体制内工作人员提供高效的公文写作解决方案。拥有海量公文文库、9 大核心 AI 功能,支持 30 + 文稿类型生成,助力快速完成领导讲话、工作总结、述职报告等材料,提升办公效率,是体制打工人的得力写作神器。

openai-agents-python

openai-agents-python

OpenAI Agents SDK,助力开发者便捷使用 OpenAI 相关功能。

openai-agents-python 是 OpenAI 推出的一款强大 Python SDK,它为开发者提供了与 OpenAI 模型交互的高效工具,支持工具调用、结果处理、追踪等功能,涵盖多种应用场景,如研究助手、财务研究等,能显著提升开发效率,让开发者更轻松地利用 OpenAI 的技术优势。

下拉加载更多