繁体   English   中英

使用深度学习处理文本分类中的嘈杂训练标签

[英]Dealing with noisy training labels in text classification using deep learning

我有一个由句子和相应的多标签组成的数据集(例如,一个句子可以属于多个标签)。 在语言模型 (Word2Vec) 上使用卷积神经网络和循环神经网络的组合,我能够达到很好的准确性。 然而,它 /too/ 擅长对输出进行建模,因为很多标签都可以说是错误的,因此输出也是错误的。 这意味着评估(即使有正则化和辍学)给人的印象是错误的,因为我没有基本事实。 清理标签的费用会高得令人望而却步。 所以我不得不以某种方式探索“去噪”标签。 我看过诸如“从大量噪声标记数据中学习用于图像分类”之类的内容,但是他们假设在输出上学习某种噪声协方差矩阵,我不确定在 Keras 中如何做。

有没有人处理过多标签文本分类设置中的噪声标签问题(理想情况下使用 Keras 或类似的),并且对如何学习带有噪声标签的鲁棒模型有很好的想法?

我是其作者的cleanlab Python 包pip install cleanlab旨在解决此任务: https : //github.com/cgnorthcutt/cleanlab/ 这是一个专业的软件包,用于在数据集中查找标签错误并使用嘈杂的标签进行学习。 它适用于任何开箱即用的 scikit-learn 模型,并可与 PyTorch、FastText、Tensorflow 等一起使用。

查找数据集中的标签错误。

from cleanlab.latent_estimation import estimate_cv_predicted_probabilities

# Find the indices of label errors in 2 lines of code.

probabilities = estimate_cv_predicted_probabilities(
    X_train_data, 
    train_noisy_labels, 
    clf=LogisticRegression(),
)
label_error_indices = get_noise_indices(
    s = train_noisy_labels, 
    psx = probabilities, 
)

用于学习嘈杂的标签。

# Code taken from https://github.com/cgnorthcutt/cleanlab
from cleanlab.classification import LearningWithNoisyLabels
from sklearn.linear_model import LogisticRegression

# Learning with noisy labels in 3 lines of code.

# Wrap around any classifier. Works with sklearn/pyTorch/Tensorflow/FastText/etc.
lnl = LearningWithNoisyLabels(clf=LogisticRegression())
lnl.fit(X = X_train_data, s = train_noisy_labels)
# Estimate the predictions you would have gotten by training with *no* label errors.
predicted_test_labels = lnl.predict(X_test)

鉴于您正在使用 NLP 分类和图像分类,以下是FastText (NLP) 和PyTorch (MNIST AlexNet CNN) 的工作示例。

此处提供其他文档: https : //l7.curtisnorthcutt.com/cleanlab-python-package

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM