Conditional/Discriminative Random Fields (CRF)

Conditional/Discriminative Random Fields (CRF)

Conditional/Discriminative Random Fields (CRF)

CRF - Formula

formulas 𝜙𝑗(𝒚, 𝒙) = 𝑒𝜃𝑗·𝑓𝑗(𝒚, 𝒙)

  • 𝐏(𝒀=𝒚|𝑿=𝒙) = 𝛱0≤𝑗≤𝑘[ 𝜙𝑗(𝒚, 𝒙) ] / 𝑍(𝒙)

  • 𝐏(𝒀=𝒚|𝑿=𝒙) = 𝛱0≤𝑗≤𝑘[ 𝑒𝜃𝑗·𝑓𝑗(𝒚, 𝒙) ] / 𝑍(𝒙)
  • 𝐏(𝒀=𝒚|𝑿=𝒙) = 𝑒𝛴0≤𝑗≤𝑘[ 𝜃𝑗·𝑓𝑗(𝒚, 𝒙) ] / 𝑍(𝒙)

where:

  • 𝑍(𝑿=𝒙) = 𝛴𝑦1∊𝑌1 ... 𝛴𝑦𝑘∊𝑌𝐾 [ 𝛱0≤𝑗≤𝑘 [ 𝜙𝑗(𝑦1, ..., 𝑦𝐾, 𝒙) ] ]
  • 𝑍(𝑿=𝒙) = 𝛴𝑦1∊𝑌1 ... 𝛴𝑦𝐾∊𝑌𝐾 [ 𝛱0≤𝑗≤𝑘[ 𝑒𝜃𝑗·𝑓𝑗(𝑦1, ..., 𝑦𝐾, 𝒙) ] ]
  • 𝑍(𝑿=𝒙) = 𝛴𝑦1∊𝑌1 ... 𝛴𝑦𝐾∊𝑌𝐾 [ 𝑒𝛴0≤𝑗≤𝑘[ 𝜃𝑗·𝑓𝑗(𝑦1, ..., 𝑦𝐾, 𝒙) ]]

𝑿 = {𝑋1, ..., 𝑋𝐽}𝒀 = {𝑌1 , ..., 𝑌𝐾}
Descriptionsource/input/observed variablestarget/output/hidden variables
Example 1pixel values and processed featuresclass for every pixel
Example 2words in a sentencelabels for every word

(𝒀,𝑿) is a CRF when each of the random variables 𝑌𝑖, conditioned on 𝑿, obeys the Markov Property with respect to the graph. Thus, a CRF is a Random Field globally conditioned on the observation 𝑿. Where the hidden variables 𝒀 are globally conditioned on the observed variables 𝑿

CRF - Graphical Model

CRF - Variants

First-Order Linear Chain CRF

Second-Order Linear Chain CRF

Generic CRF
simple CRF where hidden variables are aligned in chainsgraph of arbitrary structure as long as it represents the label sequences being modeled

  • 𝐏(𝒀=𝒚|𝑿=𝒙;𝜽) = 𝑒𝛴1≤𝑖≤𝐾𝛴0≤𝑗≤𝑘[ 𝜃𝑗·𝑓𝑗(𝑦𝑖-1, 𝑦𝑖, 𝒙) ] / 𝑍(𝒙)
  • 𝑍(𝑿=𝒙) = 𝛴𝑦1∊𝑌1 ... 𝛴𝑦𝐾∊𝑌𝐾[ 𝑒𝛴1≤𝑖≤𝐾𝛴0≤𝑗≤𝑘[ 𝜃𝑗·𝑓𝑗(𝑦𝑖-1, 𝑦𝑖, 𝒙) ] ]
  • 𝐏(𝒀=𝒚|𝑿=𝒙;𝜽) = 𝑒𝛴0≤𝑗≤𝑘[ 𝜃𝑗·𝑓𝑗(𝒚,𝒙) ] / 𝑍(𝒙)

  • 𝑍(𝑿=𝒙) = 𝛴𝑦1∊𝑌1 ... 𝛴𝑦𝐾∊𝑌𝐾[ 𝑒𝛴0≤𝑗≤𝑘[ 𝜃𝑗·𝑓𝑗(𝑦1, ..., 𝑦𝑘, 𝒙) ] ]
  • 𝐏(𝒀=𝒚|𝑿=𝒙;𝜽) = 𝑒𝛴0≤𝑗≤𝑘[ 𝜃𝑗·𝑓𝑗(𝒚, 𝒙) ] / 𝑍(𝒙)
  • 𝑍(𝑿=𝒙) = 𝛴𝑦1∊𝑌1 ... 𝛴𝑦𝐾∊𝑌𝐾 [ 𝑒𝛴0≤𝑗≤𝑘[ 𝜃𝑗·𝑓𝑗(𝑦1, ..., 𝑦𝐾, 𝒙) ] ]

CRF - Example Use

Part-of-Speech (PoS) Tagging

conditional-random-field-log-linear-model-example.drawio

CRF - Comparisons

CRF - Resources