條件隨機域

Conditional Random Fields

簡介

條件隨機場 (conditional random fields, CRFs),是一種鑑別式機率模型,是隨機場的一種,常用於標注或分析序列資料,如自然語言文字或是生物序列。

如同馬爾可夫隨機場 (markov random fiels, MRF),條件隨機場為無向性之圖模型 (undirected graph model),圖中的頂點代表隨機變數,頂點間的連線代表隨機變數間的相依關係,在條件隨機場當中,隨機變數 Y 的分佈為條件機率,給定的觀察值則為隨機變數 X。原則上,條件隨機場的圖模型佈局是可以任意給定的,一般常用的佈局是鏈結式的架構,鏈結式架構不論在訓練 (training)、推論 (inference)、或是解碼 (decoding)上,都存在有效率的演算法可供演算。


條件隨機場跟隱藏式馬可夫模型 (hidden markov model, HMM)及最大熵馬可夫模型 (maximum entropy markov model, MEMM)常被一起提及。HMM由於強烈的假設獨立性,因此無法考慮到上下文之間的關係,MEMM雖然可以解決此問題,但也因此產生標註偏移問題 (label bias problem),CRFs可以透過全域最佳化的方式,保留MEMM的優點並處理標註偏移問題。

Wikipedia (conditional random fields, CRFs)

A conditional random field (CRF) is a type of discriminative undirected probabilistic graphical model. It is most often used for labeling or parsing of sequential data, such as natural language text or biological sequences and computer vision. Specifically, CRFs find applications in shallow parsing, named entity recognition and gene finding, among other tasks, being an alternative to the related hidden Markov models. In computer vision, CRFs are often used for image segmentation, object recognition and as a general approach to combine features from different sources.

來源/作者

  • J. Lafferty, A. McCallum, and F. Pereira. Conditional random fields: probabilistic models for segmenting and labeling sequence data. In International Conference on Machine Learning, 2001.

基本概念

最簡單的CRFs是鏈結式的架構,以下說明其基本概念。

相關CRF++工具說明請參照CRF++官方網站


以標註序列資料為例,CRFs係以最大機率為原則的方式選取標籤,機率算法如下圖:

其中參數定義請參照附件檔案


而為了最佳化準確度,必須最大化一定義的目標函數,不斷的透過迭代修正,以取得最佳的參數,目標函數如下:

而得出參數後,便可對測試資料進行標註之準確度驗證,以CRF++工具為例,下圖為測試結果:

參考文獻

  • J. Lafferty, A. McCallum, and F. Pereira. Conditional random fields: probabilistic models for segmenting and labeling sequence data. In International Conference on Machine Learning, 2001.

  • Hanna M. Wallach. Conditional Random Fields: An Introduction. University of Pennsylvania CIS Technical Report MS-CIS-04-21, 2004.

  • Chales Elken. Log-linear models and conditional random fields. Notes for a tutorial at CIKM'08, 2008.

檔案

條件隨機域.pdf