概述
這是部署最廣泛的 NLP 任務之一,因為它能將雜亂的自由文本轉化為系統可以處理的結構化標籤。
深入探討
Text classification assigns categories to documents, messages, or other text sequences. Binary classification selects between two labels, such as spam and not spam. Multi-class classification assigns exactly one category from a larger set, while multi-label classification permits several categories for the same example. An article can carry both politics and economy tags without requiring those topics to exclude each other. Sentiment and intent can also be classification targets when the task defines their labels. Representations differ across systems: sparse word-count features and dense learned embeddings are two possibilities. A classifier converts those features into scores associated with the defined labels. Evaluation should match the intended decisions. Accuracy is the fraction of correct predictions, but it can conceal failures on a rare category. If almost every message is ordinary, always predicting ordinary can score highly while missing every relevant spam case. Recall for a designated positive class is true positives divided by all actual positives. Precision instead divides true positives by all predicted positives. In an illustrative evaluation with six true positives and two false positives, precision is six divided by eight, or 75 percent. Those quantities answer different questions. A model can have a useful recall yet flag many irrelevant messages. A further distinction concerns output scores: single-label softmax scores sum to one across mutually exclusive alternatives, whereas a separate sigmoid score for each label permits several labels to score highly together. Neither transformation alone establishes that scores are calibrated estimates of real-world frequency.
現實世界的實施
電子郵件提供者從您的收件匣中過濾垃圾郵件和網路釣魚郵件。
品牌對產品評論和社交貼文進行情緒分析,以衡量客戶情緒。
支援台根據訊息內容自動將收到的工單路由到正確的團隊。
社交平台標記仇恨言論或有毒評論以供審核。
文本分類的未來
標籤描述和範例可以讓人更容易探索新的分類任務,但它們無法在不同領域間建立一致的效能。比較稀疏模型、密集編碼器和提示語言模型,可以揭示不同的準確率、延遲和維護權衡。在實際應用中,評估應涵蓋罕見類別以及遺漏或錯誤標籤帶來的後果。語言和輸入來源的變更也可能會改變這些結果。請在適用的情況下回報各類別的精確率與召回率,並將輸出校準與指派類別的行為分開評估。
付諸實踐
為什麼這很重要
- 速度與規模. 語言工作流程可以在不犧牲一致性的情況下更快地移動。
- 交通與覆蓋範圍. 它擴展了跨語言和溝通方式的訪問。
- 更明確的決策. 團隊可以花更多時間進行判斷,而自動化則可以處理重複。
留意
- 幻覺的事實可以悄悄地進入報告、支持流程或研究成果。
- 及時的敏感性可能會在類似的請求中產生不一致的結果。
- 如果存取控制薄弱,敏感文字資料可能會暴露。
後續步驟
- 在推出之前定義輸出格式、語氣和品質標準。
- 當準確性很重要時,請使用可信任來源進行地面回應。
- 為高風險輸出保留人工審查檢查點。
- 追蹤故障模式並定期重新訓練提示或工作流程。
不斷探索
常見問題
什麼是文字分類?
文字分類會自動將文字片段分類,例如將電子郵件標記為垃圾郵件或將評論標記為正面。它是部署最廣泛的 NLP 任務之一,因為它將雜亂的自由文字轉換為系統可以操作的結構化標籤。
文字分類器如何建立輸入文件的輸出?
輸出會將文字與任務定義的類別建立關聯。
哪個場景是多標籤分類的範例?
多標籤分類允許多個類別同時應用於同一項目。
在一個類別占主導地位的文本資料集上,較高的整體準確率可以掩蓋什麼?
預測多數類別可以產生高準確率,但會漏掉所有罕見的正樣本,因此針對特定類別的評估至關重要。
分類任務中召回率衡量什麼?
召回率是系統正確識別的真陽性案例的比例,記錄了它錯過了多少。
在特定任務的零樣本文字分類中,新的分類任務缺少什麼?
零樣本模型可以經過預訓練或在其他任務上訓練;所缺少的僅是特定任務的標籤範例。