Reducing Human Annotation with ML Active Learning

Reducing Human Annotation with ML Active Learning

通过机器学习主动学习减少人工标注

In a world where human time is expensive, learn how to use it only when really necessary. 在一个人类时间极其昂贵的世界里,学习如何只在真正必要时才投入人力。

Active learning aims to select the unlabeled samples that are most informative and ask for labels only for those samples. By interactively querying a user (or some other information source) to label new data points, we can train models using fewer labels. This tutorial walks you through the active learning workflow and shows you how to implement three commonly used query strategies: uncertainty sampling, diversity-based sampling, and query by committee. We provide intuitive explanations of these methods along with Python implementations. Finally, we will discuss the pros and cons of each method and how they can be used together to create powerful human-in-the-loop systems when annotation is expensive or scarcely available. 主动学习旨在挑选出信息量最大的未标注样本,并仅针对这些样本请求标注。通过交互式地查询用户(或其他信息源)来标注新的数据点,我们可以用更少的标签来训练模型。本教程将带你了解主动学习的工作流程,并展示如何实现三种常用的查询策略:不确定性采样、基于多样性的采样以及委员会查询法。我们提供了这些方法的直观解释及 Python 实现。最后,我们将讨论每种方法的优缺点,以及当标注成本高昂或资源稀缺时,如何将它们结合起来构建强大的“人在回路”(human-in-the-loop)系统。


1. What Is Active Learning

1. 什么是主动学习

Active learning is an approach to machine learning in which a learning algorithm is able to interactively query a user (or some other information source) to obtain the desired outputs at new data points. In active learning, rather than feeding a learning algorithm a massive pool of labeled examples, you allow the model to look at the unlabeled data points first. It will pick the data points it wants to learn from and send only those to the human for labeling. You repeat this process in cycles. Using active learning, you can often achieve comparable performance to normal supervised learning with many fewer annotated training examples. 主动学习是一种机器学习方法,在这种方法中,学习算法能够交互式地查询用户(或其他信息源),以获取新数据点的预期输出。在主动学习中,你不是向学习算法提供海量的已标注样本池,而是先让模型查看未标注的数据点。模型会挑选出它想要学习的数据点,并仅将这些点发送给人类进行标注。你以循环方式重复此过程。使用主动学习,通常可以用少得多的标注训练样本,达到与普通监督学习相当的性能。

Particularly when humans are in the loop, this technique shines. Rather than having the annotator label thousands of simple/redundant samples, the model instead surfaces which examples it’s least certain about or which examples appear odd/outlier, and then has the annotator label those. To understand the significance of Active Learning, think about an image classification task with 500,000 images. At 20 seconds per image, it will take over 2,700 hours to label this dataset. With active learning, you only request human attention to a few of these images that actually need help to improve your model substantially. This drastically cuts costs and the effort needed to label. 特别是在“人在回路”的场景下,这项技术表现尤为出色。模型不再让标注员去标注成千上万个简单或冗余的样本,而是主动呈现出它最不确定或看起来异常/离群的样本,并让标注员仅对这些样本进行标注。要理解主动学习的重要性,可以想象一个包含 50万张图像的图像分类任务。如果每张图像耗时 20 秒,标注整个数据集将需要超过 2,700 小时。通过主动学习,你只需让人类关注其中少数真正需要帮助以显著提升模型性能的图像。这极大地降低了成本和标注所需的工作量。

1.1. Learning From Uncertain or Edge-Case Samples

1.1. 从不确定或边缘案例样本中学习

One major benefit of active learning is that your model can focus on learning from the most difficult examples. Typically these examples fall around the decision boundary where your model is most uncertain and have the largest potential to improve the model. Effectively this allows your dataset to be enriched with targeted samples. The dataset size will not increase with synthetic transformations, but it will gain valuable information with the addition of new samples. 主动学习的一个主要好处是,你的模型可以专注于从最困难的样本中学习。通常,这些样本位于模型最不确定的决策边界附近,且具有提升模型性能的最大潜力。实际上,这使得你的数据集能够通过有针对性的样本得到丰富。数据集的大小不会因为合成转换而增加,但会通过添加新样本获得有价值的信息。

2. Active Learning Techniques

2. 主动学习技术

The intuition behind active learning is using a query strategy to determine which unlabeled samples should be labeled first. Rather than randomly picking samples from our pool, we query the model about what samples it would like to look at. Typically these are samples that will help the model make better predictions. Active learning tends to be useful when labels are slow to acquire, require expert knowledge, or are costly. 主动学习背后的直觉是使用一种查询策略来确定哪些未标注样本应优先被标注。我们不是从样本池中随机挑选,而是询问模型它想查看哪些样本。通常,这些样本能帮助模型做出更好的预测。当标签获取缓慢、需要专家知识或成本高昂时,主动学习往往非常有用。

2.1. Uncertainty Sampling

2.1. 不确定性采样

Uncertainty sampling is often the first approach practitioners attempt because it requires very little effort and often leads to good initial gains. Uncertainty sampling is conceptually simple. You start off by labeling only enough samples to create your initial training set. Train your initial model on these samples. This initial model doesn’t have to be great! All we need it to do is make rough estimates of the probabilities for our unlabeled samples. Once we’ve trained the model, we identify the samples about which the model is least certain. These are usually the ones for which it predicts probabilities close to the decision threshold. Then we have these uncertain samples labeled by a human and retrain our model on this new data! 不确定性采样通常是从业者尝试的第一种方法,因为它所需的工作量极小,且往往能带来良好的初始收益。不确定性采样的概念很简单:首先,仅标注足够创建初始训练集的样本,并用这些样本训练初始模型。这个初始模型不必非常完美!我们只需要它能对未标注样本的概率做出粗略估计。一旦模型训练完成,我们就识别出模型最不确定的样本。这些样本通常是模型预测概率接近决策阈值的样本。然后,我们让标注员对这些不确定的样本进行标注,并利用这些新数据重新训练模型!