Premium Partner

NLP ETH - Know your semirings

In the ETH NLP course, a variety of semirings is used to compute different things (normalizer, log-normalizer, most probable path, etc.) in algorithms like viterbi for conditional random fields or CYK

In the ETH NLP course, a variety of semirings is used to compute different things (normalizer, log-normalizer, most probable path, etc.) in algorithms like viterbi for conditional random fields or CYK


Kartei Details

Karten 10
Sprache Deutsch
Kategorie Informatik
Stufe Universität
Erstellt / Aktualisiert 15.02.2021 / 24.01.2022
Lizenzierung Keine Angabe
Weblink
https://card2brain.ch/box/20210215_nlp_eth_know_your_semirings
Einbinden
<iframe src="https://card2brain.ch/box/20210215_nlp_eth_know_your_semirings/embed" width="780" height="150" scrolling="no" frameborder="0"></iframe>

Describe the Boolean Semiring

The Boolean Semiring can be used for things like recognition algorithms (e.g. can this string be expressed by a syntax tree for CYK).

\(\langle \{0,1\}, \lor, \land, 0, 1\rangle\)

Describe the Viterbi Semiring

The Viterbi Semiring corresponds to finding the most probable sequence of states. It is defined as follows:

\(\langle [0,1], \max, \times, 0, 1\rangle\)

Describe the Inside Semiring

The Inside Semiring is used to find the Normalizer of a CRF

\(\langle \mathbb{R}^+ \cup \{+\infty\}, +, \times, 0, 1\rangle\)

Describe the Real Semiring

The Real Semiring is used for shortest path if there are negative weights

\(\langle \mathbb{R} \cup \{+\infty\}, min, +, +\infty ,0\rangle\)

Describe the Tropical Semiring

The tropical semiring is used to find the shortest path in cases when there are no negative weights in the graph

\(\langle \mathbb{R}^+ \cup \{+\infty\}, min, +, +\infty ,0\rangle\)

Describe the Counting Semiring

Used to find the number of paths in a graph

\(\langle \mathbb{N}, +, \times, 0 ,1\rangle\)

Describe the Log-Semiring

The Log-Semiring can be used to compute the Log-Normalizer for CRFs or CYK

 

\(\langle \mathbb{R} \cup \{-\infty, +\infty\}, log(e^a + e^b), a + b, -\infty ,0\rangle\)

Note that the base can be something different than e but not = 1

How do you show that something is a semiring?

  1. Show that \(\langle set, \oplus,\overline{0}\rangle\) is a commutative monoid
    • Show that it is closed regarding \(\oplus\)
    • (a + b) + c = a + (b + c)
    • 0 + a = a + 0 = a
    • a + b = b + a
  2. Show that \(\langle set, \otimes,\overline{1}\rangle\)is a monoid
    • Show that it is closed regarding \(\otimes\)
    • (a x b) x c = a x (b x c)
    • 1 x a = a x 1 = a 
  3. Show that \(\overline{0}\) annihilates \(\otimes\)
    • 0 x a = a x 0 = 0
  4. Show that \(\otimes\) distributes over \(\oplus\)
    • a x (b + c) = (a x b) + (a x c)
    • (a + b) x c = (a x c) + (b x c)