零點文本分類(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) 自動生成聚類標簽。

登錄后免費查看全文
立即登錄
App下載
技術鄰APP
工程師必備
  • 項目客服
  • 培訓客服
  • 平臺客服

TOP