Weighted automaton explained
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.[1] They are one of the simplest studied models of quantitative automata.
, an
abstract set with an addition operation
and a multiplication operation
. The automaton consists of a finite set of states, a finite input alphabet of
characters
and edges which are labeled with both a character in
and a weight in
. 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
to
.
[1] 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,[2] [1] as well as in image compression.[1] They were first introduced by Marcel-Paul Schützenberger in his 1961 paper On the definition of a family of automata.[3] Since their introduction, many extensions have been proposed, for example nested weighted automata,[4] cost register automata,[5] and weighted finite-state transducers.[6] Researchers have studied weighted automata from the perspective of learning a machine from its input-output behavior[7] (see computational learning theory) and studying decidability questions.[8]
Definition
A commutative semiring (or rig) is a set R equipped with two distinguished elements
and addition and multiplication operations
and
such that
is
commutative and
associative with
identity
,
is commutative and associative with identity
,
distributes over
, and 0 is an
absorbing element for
.
A weighted automaton over
is a tuple l{A}=(Q,\Sigma,\Delta,I,F)
where:
is a finite set of states.
is a finite alphabet.
\Delta\subseteqQ x \Sigma x R x Q
is a finite set of transitions
, where
is called a
character and
is called a
weight.
is an initial weight function.
is a final weight function.
A path on input
is a finite path in the graph, where the concatenation of the character labels equals
. The
weight of the path
is the product (
) of the weights along the path, additionally multiplied by the initial and final weights
. The
weight of the word
is the sum (
) of the weights of all paths on input
(or 0 if there are no accepting paths). In this way the machine defines a function
.
Ambiguity and determinism
Since
is a
set of transitions, weighted automata allow multiple transitions (or paths) on a single input string.Therefore a weighted automaton can be considered analogous to a
nondeterministic finite automaton (NFA).As is the case with NFAs, restrictions of weighted automata are considered that correspond to the concepts of
deterministic finite automaton and
unambiguous finite automaton (deterministic weighted automata and unambiguous weighted automata, respectively).
First, a preliminary definition: the underlying NFA of
is an NFA formed by removing all transitions with weight
and then erasing all of the weights on the transitions
, so that the new transition set lies in
. The initial states and final states are the set of states
such that
and
, respectively.
A weighted automaton is deterministic if the underlying NFA is deterministic and unambiguous if the underlying NFA is unambiguous.Every deterministic weighted automaton is unambiguous.
In both the deterministic and unambiguous cases, there is always at most one accepting path, so the
operation is never applied and can be omitted from the definition.
Variations
- The requirement that there is a zero element for
is sometimes omitted; in this case the machine defines a
partial function from
to
rather than a total function.
, where
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.
[1] 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.
- Some authors omit the initial and final weight functions
and
. Instead,
and
are replaced by a set of initial and final states. If epsilon transitions are not present, this technically decreases expressiveness as it forces
to depend only on the number of states that are both initial and final.
with entries in
for each
, rather than a set of transitions. The entry of the matrix at
is the sum of all transitions labeled
.
[1] [9] - Some authors restrict to specific semirings, such as
or
, particularly when studying decidability results.
[8] [3] Notes and References
- Book: 2009. Droste. Manfred. Kuich. Werner. Vogler. Heiko. Handbook of Weighted Automata. Monographs in Theoretical Computer Science. An EATCS Series . en-gb. 10.1007/978-3-642-01492-5. 2009hwa..book.....D . 978-3-642-01491-8 . 1431-2654. chs.1-4, pp.3-26, 69-71, 122-126.
- Web site: Chiang. David. Weighted Automata. 2021-11-09. Natural Language Processing (CSE 40657/60657), course notes, Fall 2019.
- Schützenberger. M. P.. 1961-09-01. On the definition of a family of automata. Information and Control. en. 4. 2. 245–270. 10.1016/S0019-9958(61)80020-X. 0019-9958.
- Chatterjee. Krishnendu. Henzinger. Thomas A.. Otop. Jan. 2017-12-14. Nested Weighted Automata. ACM Transactions on Computational Logic. 18. 4. 31:1–31:44. 10.1145/3152769. 1504.06117 . 15070803 . 1529-3785.
- Book: Alur . Rajeev . D'Antoni . Loris . Deshmukh . Jyotirmoy . Raghothaman . Mukund . Yuan . Yifei . 2013 28th Annual ACM/IEEE Symposium on Logic in Computer Science . Regular Functions and Cost Register Automata . 2013 . https://ieeexplore.ieee.org/document/6571532 . 13–22 . 10.1109/LICS.2013.65. 978-1-4799-0413-6 . 1286659 .
- Mohri. Mehryar. Pereira. Fernando. Riley. Michael. 2002-01-01. Weighted finite-state transducers in speech recognition. Computer Speech & Language. en. 16. 1. 69–88. 10.1006/csla.2001.0184. 0885-2308.
- Book: Balle. Borja. Mohri. Mehryar. Algebraic Informatics . Learning Weighted Automata . 2015. Maletti. Andreas. https://link.springer.com/chapter/10.1007/978-3-319-23021-4_1. Lecture Notes in Computer Science. 9270 . en. Cham. Springer International Publishing. 1–21. 10.1007/978-3-319-23021-4_1. 978-3-319-23021-4.
- Book: Almagor. Shaull. Boker. Udi. Kupferman. Orna. Automated Technology for Verification and Analysis . What's Decidable about Weighted Automata? . 2011. Bultan. Tevfik. Hsiung. Pao-Ann. https://link.springer.com/chapter/10.1007/978-3-642-24372-1_37. Lecture Notes in Computer Science. 6996 . en. Berlin, Heidelberg. Springer. 482–491. 10.1007/978-3-642-24372-1_37. 978-3-642-24372-1. 10159261 .
- Droste. Manfred. Gastin. Paul. 2007-06-21. Weighted automata and weighted logics. Theoretical Computer Science. Automata, Languages and Programming. en. 380. 1. 69–86. 10.1016/j.tcs.2007.02.055. 0304-3975. free.