Weighted automaton

From HandWiki
Revision as of 00:43, 7 February 2024 by Steve Marsio (talk | contribs) (link)
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
Short description: Finite-state machine where edges carry weights
Hasse diagram of some classes of quantitative automata, ordered by expressiveness.[1](Fig.1)

In theoretical computer science and formal language theory, a weighted automaton or weighted finite-state machine is a generalization of a finite-state machine in which the edges have weights, for example real numbers or integers. Finite-state machines are only capable of answering decision problems; they take as input a string and produce a Boolean output, i.e. either "accept" or "reject". In contrast, weighted automata produce a quantitative output, for example a count of how many answers are possible on a given input string, or a probability of how likely the input string is according to a probability distribution.[2] They are one of the simplest studied models of quantitative automata.[1](Fig.1)

The definition of a weighted automaton is generally given over an arbitrary semiring [math]\displaystyle{ R }[/math], an abstract set with an addition operation [math]\displaystyle{ + }[/math] and a multiplication operation [math]\displaystyle{ \times }[/math]. The automaton consists of a finite set of states, a finite input alphabet of characters [math]\displaystyle{ \Sigma }[/math] and edges which are labeled with both a character in [math]\displaystyle{ \Sigma }[/math] and a weight in [math]\displaystyle{ R }[/math]. The weight of any path in the automaton is defined to be the product of weights along the path, and the weight of a string is the sum of the weights of all paths which are labeled with that string. The weighted automaton thus defines a function from [math]\displaystyle{ \Sigma^* }[/math] to [math]\displaystyle{ R }[/math].[2]

Weighted automata generalize deterministic finite automata (DFAs) and nondeterministic finite automata (NFAs), which correspond to weighted automata over the Boolean semiring, where addition is logical disjunction and multiplication is logical conjunction. In the DFA case, there is only one accepting path for any input string, so disjunction is not applied. When the weights are real numbers and the outgoing weights for each state add to one, weighted automata can be considered a probabilistic model and are also known as probabilistic automata. These machines define a probability distribution over all strings, and are related to other probabilistic models such as Markov decision processes and Markov chains.

Weighted automata have applications in natural language processing where they are used to assign weights to words and sentences,[3][2](pp571-596) as well as in image compression.[2](pp453-480) They were first introduced by Marcel-Paul Schützenberger in his 1961 paper On the definition of a family of automata.[4] Since their introduction, many extensions have been proposed, for example nested weighted automata,[5] cost register automata,[6] and weighted finite-state transducers.[7] Researchers have studied weighted automata from the perspective of learning a machine from its input-output behavior[8] (see computational learning theory) and studying decidability questions.[9]

Definition

A commutative semiring (or rig) is a set R equipped with two distinguished elements [math]\displaystyle{ 0 \ne 1 }[/math] and addition and multiplication operations [math]\displaystyle{ \oplus }[/math] and [math]\displaystyle{ \otimes }[/math] such that [math]\displaystyle{ \oplus }[/math] is commutative and associative with identity [math]\displaystyle{ 0 }[/math], [math]\displaystyle{ \otimes }[/math] is commutative and associative with identity [math]\displaystyle{ 1 }[/math], [math]\displaystyle{ \otimes }[/math] distributes over [math]\displaystyle{ \oplus }[/math], and 0 is an absorbing element for [math]\displaystyle{ \otimes }[/math].

A weighted automaton over [math]\displaystyle{ R }[/math] is a tuple [math]\displaystyle{ \mathcal{A} = (Q, \Sigma, \Delta, I, F) }[/math] where:

  • [math]\displaystyle{ Q }[/math] is a finite set of states.
  • [math]\displaystyle{ \Sigma }[/math] is a finite alphabet.
  • [math]\displaystyle{ \Delta \subseteq Q \times \Sigma \times R \times Q }[/math] is a finite set of transitions [math]\displaystyle{ (q, \sigma, w, q') }[/math], where [math]\displaystyle{ \sigma }[/math] is called a character and [math]\displaystyle{ w }[/math] is called a weight.
  • [math]\displaystyle{ I: Q \to R }[/math] is an initial weight function.
  • [math]\displaystyle{ F: Q \to R }[/math] is a final weight function.

A path on input [math]\displaystyle{ w \in \Sigma^* }[/math] is a finite path in the graph, where the concatenation of the character labels equals [math]\displaystyle{ w }[/math]. The weight of the path [math]\displaystyle{ q_0, q_1, \ldots, q_n }[/math] is the product ([math]\displaystyle{ \otimes }[/math]) of the weights along the path, additionally multiplied by the initial and final weights [math]\displaystyle{ I(q_0) \otimes I(q_n) }[/math]. The weight of the word [math]\displaystyle{ w }[/math] is the sum ([math]\displaystyle{ \oplus }[/math]) of the weights of all paths on input [math]\displaystyle{ w }[/math] (or 0 if there are no accepting paths). In this way the machine defines a function [math]\displaystyle{ [\![ \mathcal{A} ]\!]: \Sigma^* \to R }[/math].

The underlying NFA of [math]\displaystyle{ \mathcal{A} }[/math] is an NFA formed by removing all transitions with weight [math]\displaystyle{ 0 }[/math] and then erasing all of the weights on the transitions [math]\displaystyle{ \Delta }[/math], so that the new transition set lies in [math]\displaystyle{ Q \times \Sigma \times Q }[/math]. The initial states and final states are the set of states [math]\displaystyle{ q }[/math] such that [math]\displaystyle{ I(q) \ne 0 }[/math] and [math]\displaystyle{ F(q) \ne 0 }[/math], respectively.

Variations

  • A weighted automaton is deterministic if the underlying NFA is deterministic and unambiguous if the underlying NFA is unambiguous. In these cases, there is always exactly one accepting path, so the [math]\displaystyle{ \oplus }[/math] operation is never applied and can be omitted from the definition.
  • It is possible to extend the definition to allow epsilon transitions [math]\displaystyle{ (q, \epsilon, w, q') }[/math], where [math]\displaystyle{ \epsilon }[/math] is the empty string. In this case, one must then require that there are no cycles of epsilon transitions. This does not increase the expressiveness of weighted automata.[2][10] If epsilon transitions are allowed, the initial weights and final weights can be replaced by initial and final sets of states without loss of expressiveness.
  • The transition function can be given as a matrix [math]\displaystyle{ \Delta_\sigma \in R^{Q \times Q} }[/math] with entries in [math]\displaystyle{ R }[/math] for each [math]\displaystyle{ \sigma }[/math], rather than a set of transitions. The entry of the matrix at [math]\displaystyle{ (q, q') }[/math] is the sum of all transitions labeled [math]\displaystyle{ (q, \sigma, q') }[/math].[2][11]
  • Some authors omit the initial and final weight functions [math]\displaystyle{ I }[/math] and [math]\displaystyle{ F }[/math].[1] Instead, [math]\displaystyle{ I }[/math] and [math]\displaystyle{ F }[/math] are replaced by a set of initial and final states. If epsilon transitions are not present, this technically decreases expressiveness as it forces [math]\displaystyle{ [\![ \mathcal{A} ]\!](\varepsilon) }[/math] to depend only on the number of states that are both initial and final.
  • Some authors restrict to specific semirings, such as [math]\displaystyle{ \mathbb{N} }[/math] or [math]\displaystyle{ \mathbb{Z} }[/math], particularly when studying decidability results.[1][9][4]
  • The requirement that there is a zero element for [math]\displaystyle{ \oplus }[/math] is sometimes omitted; in this case the machine defines a partial function from [math]\displaystyle{ \Sigma^* }[/math] to [math]\displaystyle{ R }[/math] rather than a total function.

See also

References

  1. 1.0 1.1 1.2 1.3 Chatterjee, Krishnendu; Henzinger, Thomas A.; Otop, Jan (2016). "Quantitative Monitor Automata". in Rival, Xavier (in en). Static Analysis. Lecture Notes in Computer Science. 9837. Berlin, Heidelberg: Springer. pp. 23–38. doi:10.1007/978-3-662-53413-7_2. ISBN 978-3-662-53413-7. https://link.springer.com/chapter/10.1007%2F978-3-662-53413-7_2. 
  2. 2.0 2.1 2.2 2.3 2.4 2.5 Droste, Manfred; Kuich, Werner; Vogler, Heiko, eds (2009) (in en-gb). Handbook of Weighted Automata. Monographs in Theoretical Computer Science. An EATCS Series. doi:10.1007/978-3-642-01492-5. ISBN 978-3-642-01491-8. Bibcode2009hwa..book.....D. https://link.springer.com/book/10.1007/978-3-642-01492-5.  chs.1-4, pp.3-26, 69-71, 122-126.
  3. Chiang, David. "Weighted Automata". https://www3.nd.edu/~dchiang/teaching/nlp/2019/notes/chapter4v3.pdf. 
  4. 4.0 4.1 Schützenberger, M. P. (1961-09-01). "On the definition of a family of automata" (in en). Information and Control 4 (2): 245–270. doi:10.1016/S0019-9958(61)80020-X. ISSN 0019-9958. 
  5. Chatterjee, Krishnendu; Henzinger, Thomas A.; Otop, Jan (2017-12-14). "Nested Weighted Automata". ACM Transactions on Computational Logic 18 (4): 31:1–31:44. doi:10.1145/3152769. ISSN 1529-3785. https://doi.org/10.1145/3152769. 
  6. Alur, Rajeev; D'Antoni, Loris; Deshmukh, Jyotirmoy; Raghothaman, Mukund; Yuan, Yifei (2013). "Regular Functions and Cost Register Automata". 2013 28th Annual ACM/IEEE Symposium on Logic in Computer Science. pp. 13–22. doi:10.1109/LICS.2013.65. ISBN 978-1-4799-0413-6. https://ieeexplore.ieee.org/document/6571532. 
  7. Mohri, Mehryar; Pereira, Fernando; Riley, Michael (2002-01-01). "Weighted finite-state transducers in speech recognition" (in en). Computer Speech & Language 16 (1): 69–88. doi:10.1006/csla.2001.0184. ISSN 0885-2308. https://repository.upenn.edu/bitstreams/0473dbb0-8787-4c32-97f6-0d3f6edaffed/download. 
  8. Balle, Borja; Mohri, Mehryar (2015). "Learning Weighted Automata". in Maletti, Andreas (in en). Algebraic Informatics. Lecture Notes in Computer Science. 9270. Cham: Springer International Publishing. pp. 1–21. doi:10.1007/978-3-319-23021-4_1. ISBN 978-3-319-23021-4. https://link.springer.com/chapter/10.1007/978-3-319-23021-4_1. 
  9. 9.0 9.1 Almagor, Shaull; Boker, Udi; Kupferman, Orna (2011). "What's Decidable about Weighted Automata?". in Bultan, Tevfik; Hsiung, Pao-Ann (in en). Automated Technology for Verification and Analysis. Lecture Notes in Computer Science. 6996. Berlin, Heidelberg: Springer. pp. 482–491. doi:10.1007/978-3-642-24372-1_37. ISBN 978-3-642-24372-1. https://link.springer.com/chapter/10.1007/978-3-642-24372-1_37. 
  10. Mohri, Mehryar (2009), Droste, Manfred; Kuich, Werner; Vogler, Heiko, eds., "Weighted Automata Algorithms" (in en), Handbook of Weighted Automata, Monographs in Theoretical Computer Science. An EATCS Series (Berlin, Heidelberg: Springer): pp. 213–254, doi:10.1007/978-3-642-01492-5_6, ISBN 978-3-642-01492-5, Bibcode2009hwa..book..213M, https://doi.org/10.1007/978-3-642-01492-5_6, retrieved 2021-11-11 
  11. Droste, Manfred; Gastin, Paul (2007-06-21). "Weighted automata and weighted logics" (in en). Theoretical Computer Science. Automata, Languages and Programming 380 (1): 69–86. doi:10.1016/j.tcs.2007.02.055. ISSN 0304-3975.