零点文本分类(Zero Shot Text Classification)

1 引言

在过去的文章中,我们使用了不同的技术来进行主题模拟,主要包括LDA,Top2Vec和BERTopic, 这些技术能够从大量文本中进行文本分类聚合出一类主题。

主题模拟的艺术(The Art of Topic Modeling)---以Step-Path Failure为例

BERTopic(V0.9.0)主题模拟技术

GeotechSet数据集主题模拟(Topic Modeling)

Top2Vec (V1.0.26)主题模拟代码的改进

LDA Topic Modeling(主题建模): 以Rocscience 2021用户会议为例

另一种非常有趣的主题模拟技术称为零点文本分类(Zero Shot Text Classification),这种技术是根据用户指定的分类标签来判断一段文本是否属于这个类别。例如:“one day I will see the world"这个句子,我们给定三个分类标签['travel', 'cooking', 'dancing'],尽管句子中没有出现"travel", 通过学习我们可以判别出这个句子属于'travel'类别。这就是零点文本分类的核心。


2 模型选择

在本次试验中,我们使用了两个预训练模型,这两个模型的区别是微调使用的数据集不同。 一个是bart-large-mnli,这是bart-large在MultiNLI(MNLI)数据集上训练后的检查点[BART: Denoising Sequence-to-Sequence Pre-training for Natural Language Generation, Translation, and Comprehension]。该模型基于NLI的零点文本分类模型,参看Yin et al (2019) Benchmarking Zero-shot Text Classification: Datasets, Evaluation and Entailment Approach. 另一个模型是distilbert-base-uncased-mnli,该模型是uncased DistilBERT model在Multi-Genre Natural Language Inference (MNLI)上微调产生的。MNLI语料库包含大约433k个假设/前提对。它与SNLI语料库类似,但涵盖了一系列的口语和书面文本。

零点文本分类(Zero Shot Text Classification)的图1


3 试验过程

试验的目的是想确定从文本中分离出来的单句属于哪一个指定的分类标签。

3.1 准备文本:本文可以在代码中直接输入,然而一个更有效的方法是从文件调入,通过分句代码可以把整篇文本分割成单句。出于测试目的,手动输入了13个句子。

3.2 准备分类标签:输入一些分类标签,用来判断句子属于哪一个标签。

零点文本分类(Zero Shot Text Classification)的图2

3.3 输入一个指定的标签,例如"rock mechanics", 对每个句子,排名第一或第二属于这个分类。由于使用的两个模型类似,因此得出的部分结果有可能重复,去掉其中重复的句子,最后列出结果。这个求解思路使用下面的代码来实现:

零点文本分类(Zero Shot Text Classification)的图3

得到如下结果:

(1) Failure modes of multilayered rock masses, with each layer characterized by different material properties, are complicated.

(2) Out-of-plane rock bridge failure Interaction between pre-existing discontinuities may lead to the failure of intact rock bridges between discontinuities

(3) 3D Particle-Based DEM Investigation into the Shear Behaviour of Incipient Rock Joints

(4) Preliminary results suggest that in addition to increasing shear strength along potential failure surfaces, intact rock bridge content can also influence the internal strength and deformability of potential slide volumes.

(5) The time dependence of the rock bridge failure process is modeled utilizing subcritical crack growth.

(6) In these instabilities, some natural or manmade external factors motivate and overturn a rock mass.

(7) An integrated field mapping-numerical modelling approach to characterising discontinuity persistence and intact rock bridges in large open pit slopes


4 发展方向

零点文本分类是一个非常有趣的主题聚类技术。其发展方向可能有:(1) 用我们自己的数据集微调目前的模型;(2) 自动生成聚类标签。

默认 最新
当前暂无评论,小编等你评论哦!
点赞 评论 收藏
关注