15 KiB
Note
本文档由 WeHub 基于上游 README 翻译整理,属于社区翻译,非官方中文文档。
English · 原始项目 · 上游 README
原作者、版权与许可证归属以原始项目及本仓库 LICENSE 文件为准。
Cleanlab 的开源库可帮助你通过自动检测 ML 数据集中的问题来清理(clean)数据与标注(label)。为促进在混乱的真实世界数据上进行机器学习,这一以数据为中心的 AI(data-centric AI)包利用你现有的模型来估计数据集中的问题,修复这些问题后即可训练出更优的模型。
通过以下代码,cleanlab **自动检测**到的猫/狗(Cat/Dog)数据集中各类问题的示例:
lab = cleanlab.Datalab(data=dataset, label="column_name_for_labels")
# Fit any ML model, get its feature_embeddings & pred_probs for your data
lab.find_issues(features=feature_embeddings, pred_probs=pred_probs)
lab.report()
- 使用 cleanlab 自动检查各类数据集:文本, 音频, 图像, 或 表格 数据集。
- 使用 cleanlab 自动:检测数据问题(异常值、重复项、标注错误等), 训练鲁棒模型, 推断多标注者数据的共识与标注者质量, 建议下一步应(重新)标注的数据(主动学习).
运行 cleanlab 开源版
此 cleanlab 包运行于 Python 3.10+,支持 Linux、macOS 以及 Windows。
- 从这里! 开始入门。可通过
uv、pip或conda安装。 - 从源码安装最新开发版的开发者请参阅此 master 分支文档.
实践以数据为中心的 AI 可以是这样:
- 在原始数据集上训练初始 ML 模型。
- 利用该模型诊断数据问题(通过 cleanlab 方法)并改进数据集。
- 在改进后的数据集上训练同一模型。
- 尝试各种建模技术以进一步提升性能。
多数人直接从步骤 1 跳到 4,但借助 cleanlab,你无需对建模代码做任何修改也可能获得巨大提升! 通过反复执行步骤 2 → 4 持续提升性能(并尽量使用清洗后的数据进行评估)。
将 cleanlab 用于任意模型及大多数 ML 任务
cleanlab 的全部功能均可配合任意数据集与任意模型使用。是的,任意模型:PyTorch、Tensorflow、Keras、JAX、HuggingFace、OpenAI、XGBoost、scikit-learn 等。
cleanlab 适用于种类繁多的机器学习任务。此以数据为中心的 AI 包为以下特定任务提供专门功能:
- 二分类与多分类
- 多标签分类(例如图像/文档标注)
- Token 分类(例如文本中的实体识别)
- 回归(预测数据集中的数值列)
- 图像分割(带逐像素标注的图像)
- 目标检测(带边界框标注的图像)
- 由多名标注者标注数据的分类
- 多名标注者的主动学习(建议标注或重新标注哪些数据最能提升模型)
- 异常值检测(识别看似分布外的非典型数据)
对于其他 ML 任务,若恰当应用,cleanlab 仍可帮助你改进数据集。 请参阅我们的示例 Notebook 与博客.
如此清新,如此 cleanlab
除了自动捕获潜藏在你数据中的各类问题,这一以数据为中心的 AI 包还可帮助你处理噪声标注,并训练更鲁棒的 ML 模型。 示例如下:
# cleanlab works with **any classifier**. Yup, you can use PyTorch/TensorFlow/OpenAI/XGBoost/etc.
cl = cleanlab.classification.CleanLearning(sklearn.YourFavoriteClassifier())
# cleanlab finds data and label issues in **any dataset**... in ONE line of code!
label_issues = cl.find_label_issues(data, labels)
# cleanlab trains a robust version of your model that works more reliably with noisy data.
cl.fit(data, labels)
# cleanlab estimates the predictions you would have gotten if you had trained with *no* label issues.
cl.predict(test_data)
# A universal data-centric AI tool, cleanlab quantifies class-level issues and overall data quality, for any dataset.
cleanlab.dataset.health_summary(labels, confident_joint=cl.confident_joint)
cleanlab 通过最先进的置信学习(confident learning)算法来清理你数据的标注,相关算法发表于此论文 与博客.。可在 labelerrors.com. 查看部分经 cleanlab 清洗的数据集。
cleanlab 具备:
- 有理论支撑——即使模型不完美,也能对标注噪声进行精确估计,并具有可证明的保证。
- 快速——代码已并行化且可扩展。
- 易于使用——一行代码即可找出错误标注、劣质标注者、异常值,或训练抗噪声模型。
- 通用——适用于**任意数据集****(文本、图像、表格、音频等)+ 任意模型(PyTorch、OpenAI、XGBoost 等)
使用 cleanlab 发现并纠正的各类图像数据集中错误给定标注的示例。 尽管这些示例来自图像数据集,该方法同样适用于文本、音频、表格数据。
引用与相关出版物
cleanlab 基于同行评审的研究。若你使用本软件包,可引用以下相关论文:
Confident Learning (JAIR '21) (点击显示 bibtex)
@article{northcutt2021confidentlearning,
title={Confident Learning: Estimating Uncertainty in Dataset Labels},
author={Curtis G. Northcutt and Lu Jiang and Isaac L. Chuang},
journal={Journal of Artificial Intelligence Research (JAIR)},
volume={70},
pages={1373--1411},
year={2021}
}
Rank Pruning (UAI '17) (点击显示 bibtex)
@inproceedings{northcutt2017rankpruning,
author={Northcutt, Curtis G. and Wu, Tailin and Chuang, Isaac L.},
title={Learning with Confident Examples: Rank Pruning for Robust Classification with Noisy Labels},
booktitle = {Proceedings of the Thirty-Third Conference on Uncertainty in Artificial Intelligence},
series = {UAI'17},
year = {2017},
location = {Sydney, Australia},
numpages = {10},
url = {http://auai.org/uai2017/proceedings/papers/35.pdf},
publisher = {AUAI Press},
}
Label Quality Scoring (ICML '22) (点击显示 bibtex)
@inproceedings{kuan2022labelquality,
title={Model-agnostic label quality scoring to detect real-world label errors},
author={Kuan, Johnson and Mueller, Jonas},
booktitle={ICML DataPerf Workshop},
year={2022}
}
Label Errors in Token Classification / Entity Recognition (NeurIPS '22) (点击显示 bibtex)
@inproceedings{wang2022tokenerrors,
title={Detecting label errors in token classification data},
author={Wang, Wei-Chen and Mueller, Jonas},
booktitle={NeurIPS Workshop on Interactive Learning for Natural Language Processing (InterNLP)},
year={2022}
}
Label Errors in Multi-Label Classification (ICLR '23) (点击显示 bibtex)
@inproceedings{thyagarajan2023multilabel,
title={Identifying Incorrect Annotations in Multi-Label Classification Data},
author={Thyagarajan, Aditya and Snorrason, Elías and Northcutt, Curtis and Mueller, Jonas},
booktitle={ICLR Workshop on Trustworthy ML},
year={2023}
}
Label Errors in Object Detection (ICML '23) (点击显示 bibtex)
@inproceedings{tkachenko2023objectlab,
title={ObjectLab: Automated Diagnosis of Mislabeled Images in Object Detection Data},
author={Tkachenko, Ulyana and Thyagarajan, Aditya and Mueller, Jonas},
booktitle={ICML Workshop on Data-centric Machine Learning Research},
year={2023}
}
Label Errors in Image Segmentation (ICML '23) (点击显示 bibtex)
@inproceedings{lad2023segmentation,
title={Estimating label quality and errors in semantic segmentation data via any model},
author={Lad, Vedang and Mueller, Jonas},
booktitle={ICML Workshop on Data-centric Machine Learning Research},
year={2023}
}
Detecting Errors in Numerical Data (DMLR '24) (点击显示 bibtex)
@inproceedings{zhou2023errors,
title={Detecting Errors in a Numerical Response via any Regression Model},
author={Zhou, Hang and Mueller, Jonas and Kumar, Mayank and Wang, Jane-Ling and Lei, Jing},
booktitle={Journal of Data-centric Machine Learning Research},
year={2024}
}
Out-of-Distribution Detection (ICML '22) (点击显示 bibtex)
@inproceedings{kuan2022ood,
title={Back to the Basics: Revisiting Out-of-Distribution Detection Baselines},
author={Kuan, Johnson and Mueller, Jonas},
booktitle={ICML Workshop on Principles of Distribution Shift},
year={2022}
}
CROWDLAB for Data with Multiple Annotators (NeurIPS '22) (点击显示 bibtex)
@inproceedings{goh2022crowdlab,
title={CROWDLAB: Supervised learning to infer consensus labels and quality scores for data with multiple annotators},
author={Goh, Hui Wen and Tkachenko, Ulyana and Mueller, Jonas},
booktitle={NeurIPS Human in the Loop Learning Workshop},
year={2022}
}
ActiveLab: Active learning with data re-labeling (ICLR '23) (点击显示 bibtex)
@inproceedings{goh2023activelab,
title={ActiveLab: Active Learning with Re-Labeling by Multiple Annotators},
author={Goh, Hui Wen and Mueller, Jonas},
booktitle={ICLR Workshop on Trustworthy ML},
year={2023}
}
Detecting Dataset Drift and Non-IID Sampling (ICML '23) (点击显示 bibtex)
@inproceedings{cummings2023drift,
title={Detecting Dataset Drift and Non-IID Sampling via k-Nearest Neighbors},
author={Cummings, Jesse and Snorrason, Elías and Mueller, Jonas},
booktitle={ICML Workshop on Data-centric Machine Learning Research},
year={2023}
}
要了解/引用上文未介绍的 cleanlab 其他功能,请查阅我们的 Blog.
其他资源
有兴趣参与贡献? 请参阅 贡献指南、开发指南 以及实用贡献建议.
有问题? 请查看我们的常见问题 和 Github Issues.



