Semirings¶
Semiring¶
- class supar.structs.semiring.Semiring[source]¶
Base semiring class [Goodman 1999].
A semiring is defined by a tuple \(<K, \oplus, \otimes, \mathbf{0}, \mathbf{1}>\). \(K\) is a set of values; \(\oplus\) is commutative, associative and has an identity element 0; \(\otimes\) is associative, has an identity element 1 and distributes over +.
LogSemiring¶
MaxSemiring¶
KMaxSemiring¶
EntropySemiring¶
- class supar.structs.semiring.EntropySemiring[source]¶
Entropy expectation semiring \(<\oplus, +, [-\infty, 0], [0, 0]>\), where \(\oplus\) computes the log-values and the running distributional entropy \(H[p]\) [Hwa 2000, Kim et al. 2019, Li & Eisner 2009].
CrossEntropySemiring¶
- class supar.structs.semiring.CrossEntropySemiring[source]¶
Cross Entropy expectation semiring \(<\oplus, +, [-\infty, -\infty, 0], [0, 0, 0]>\), where \(\oplus\) computes the log-values and the running distributional cross entropy \(H[p,q]\) of the two distributions [Li & Eisner 2009].
KLDivergenceSemiring¶
- class supar.structs.semiring.KLDivergenceSemiring[source]¶
KL divergence expectation semiring \(<\oplus, +, [-\infty, -\infty, 0], [0, 0, 0]>\), where \(\oplus\) computes the log-values and the running distributional KL divergence \(KL[p \parallel q]\) of the two distributions [Li & Eisner 2009].
SampledSemiring¶
SparsemaxSemiring¶
- class supar.structs.semiring.SparsemaxSemiring[source]¶
Sparsemax semiring \(<\mathrm{sparsemax}, +, -\infty, 0>\) [Correia et al. 2020, Martins & Astudillo 2016, Mensch & Blondel 2018].