FACTOID # 71: 72% of people in Mali earn less than $1 per day.
 
 Home   Encyclopedia   Statistics   Countries A-Z   Flags   Maps   Education   Forum   FAQ   About 
 
WHAT'S NEW
RECENT ARTICLES
More Recent Articles »
 

FACTS & STATISTICS    Simple view

  1. Select countries to view: (hold down Control key and click to select several)

     

     

    Compare:

     

     

  1. Select fact or statistic: (* = graphable)

     

     

     

  2. (OPTIONAL) Compare to statistic: (both need to be graphable)

     

     

     

  3. View result as:

     

       
(OR) SEARCH ALL encyclopedia, stats & forums:   

Encyclopedia > Viterbi algorithm

The Viterbi algorithm, named after its developer Andrew Viterbi, is a dynamic programming algorithm for finding the most likely sequence of hidden states – known as the Viterbi path – that result in a sequence of observed events, especially in the context of hidden Markov models. The forward algorithm is a closely related algorithm for computing the probability of a sequence of observed events. Its a subset of a wider topic known as information theory. Andrew Viterbi (March 9, 1935) is an American Electrical Engineer and businessman. ... In computer science, dynamic programming is a method for reducing the runtime of algorithms exhibiting the properties of overlapping subproblems and optimal substructure, described below. ... Flowcharts are often used to represent algorithms. ... In statistics, a likelihood function is a conditional probability function considered a function of its second argument with its first argument held fixed, thus: and also any other function proportional to such a function. ... A hidden Markov model (HMM) is a statistical model where the system being modelled is assumed to be a Markov process with unknown parameters, and the challenge is to determine the hidden parameters, from the observable parameters, based on this assumption. ... Information theory is the mathematical theory of data communication and storage founded in 1948 by Claude E. Shannon. ...


The Viterbi algorithm was originally conceived as an error-correction scheme for noisy digital communication links, finding universal application in decoding the convolutional codes used in both CDMA and GSM digital cellular, dial-up modems, satellite, deep-space communications, and 802.11 wireless LANs. It is now also commonly used in speech recognition, keyword spotting, computational linguistics, and bioinformatics. For example, in speech-to-text speech recognition, the acoustic signal is treated as the observed sequence of events, and a string of text is considered to be the "hidden cause" of the acoustic signal. The Viterbi algorithm finds the most likely string of text given the acoustic signal. In computer science and information theory, error correction consists of using methods to detect and/or correct errors in the transmission or storage of data by the use of some amount of redundant data and (in the case of transmission) the selective retransmission of incorrect segments of the data. ... In telecommunication, a convolutional code is a type of error-correction code in which (a) each m-bit information symbol (each m-bit string) to be encoded is transformed into an n-bit symbol, where m/n is the code rate (n >= m) and (b) the transformation is a function... General Information Generically (as a multiplexing scheme), code division multiple access (CDMA) is any use of any form of spread spectrum by multiple transmitters to send to the same receiver on the same frequency channel at the same time without harmful interference. ... Not to be confused with Get Some Mates The Global System for Mobile Communications (GSM) is the most popular standard for mobile phones in the world. ... In telecommunication, the term dial-up has the following meanings: Dial-up access, typically to the Internet A service feature in which a user initiates service on a previously arranged trunk or transfers, without human intervention, from an active trunk to a standby trunk. ... IEEE 802. ... Speech recognition technologies allow computers equipped with a source of sound input, such as a microphone, to interpret human speech, for example, for transcription or as an alternative method of interacting with a computer. ... Keyword spotting is a subfield of speech recognition that deals with the identification of keywords in utterances. ... Computational linguistics is an interdisciplinary field dealing with the statistical and logical modeling of natural language from a computational perspective. ... Bioinformatics or computational biology is the use of techniques from applied mathematics, informatics, statistics, and computer science to solve biological problems. ...


The algorithm is not general; it makes a number of assumptions. First, both the observed events and hidden events must be in a sequence. This sequence often corresponds to time. Second, these two sequences need to be aligned, and an observed event needs to correspond to exactly one hidden event. Third, computing the most likely hidden sequence up to a certain point t must depend only on the observed event at point t, and the most likely sequence at point t − 1. These assumptions are all satisfied in a first-order hidden Markov model.


The terms "Viterbi path" and "Viterbi algorithm" are also applied to related dynamic programming algorithms that discover the single most likely explanation for an observation. For example, in stochastic parsing a dynamic programming algorithm can be used to discover the single most likely context-free derivation (parse) of a string, which is sometimes called the "Viterbi parse". A parser is a computer program or a component of a program that analyses the grammatical structure of an input, with respect to a given formal grammar, a process known as parsing. ...

Contents


Overview

As a simplified description, we need to understand the assumptions listed above. First, we need to understand that the Viterbi algorithm operates on a state machine assumption. That is there are a finite number of states, however large, that can be listed. At each state, or if you prefer node, multiple sequences or paths can lead to it -- but there will only be one that will be the most likely, called the "survivor path" to that state. This is a fundamental assumption of the algorithm because the algorithm will examine all possible paths leading to a state and only keep the one most likely. This way the algorithm does not have to keep track of multiple paths, only one per state. A second key assumption is that a transition from a previous state to a new state is marked by a incremental metric, usually a number. This transition is computed from the event. The third key assumption is that the events are cumulative over a path in some sense, usually additive. So the crux of the algorithm is to keep a number for each state. Then when an event happens, the algorithm examines moving forward to a new set of states by combining the metric of a possible previous state with the incremental metric of the transition due to the event and chooses the best. It should be noted here that the incremental metric associated with an event is dependant upon the transition possibility from the old state to the new state. For example in data communications, it may be possible to only transmit half the symbols from an odd numbered state and the other half from an even numbered state. Additionally, in many cases the state transition table is not fully connected. A simple example would be a car that has 3 states, forward, stop and reverse. A transition from forward to reverse is not allowed. It must first enter the stop state. After computing the combinations of incremental metric and state metric, only the best survives and all other paths are discarded.. This is the crux of the algorithm. There are modifications to the basic algorithm which allow for a forward search in addition to the backwards one described here.


Path history must be stored. In some cases, the search history is finite because the state machine at the encoder starts in a known state and there is sufficient memory to keep all the paths. In some other cases, one example is convolutional encoding, the decoder must truncate the history at a depth large enough to keep performance to an acceptable level. Although, the Viterbi algorithm is very efficient, there are modifications that reduce the computational load; the memory requirements tend to remain constant.


A concrete example

Assume you have a friend who lives far away and whom you call daily to talk about what each of you did that day. Your friend has only three things he's interested in: walking in the park, shopping, and cleaning his apartment. The choice of what to do is determined exclusively by the weather on a given day. You have no definite information about the weather where your friend lives, but you know general trends. Based on what he tells you he did each day, you try to guess what the weather must have been like.


You believe that the weather operates as a discrete Markov chain. There are two states, "Rainy" and "Sunny", but you cannot observe them directly, that is, they are hidden from you. On each day, there is a certain chance that your friend will perform one of the following activities, depending on the weather: "walk", "shop", or "clean". Since your friend tells you about his activities, those are the observations. The entire system is that of a hidden Markov model (HMM). In mathematics, a (discrete-time) Markov chain, named after Andrei Markov, is a discrete-time stochastic process with the Markov property. ...


You know the general weather trends in the area and you know what your friend likes to do on average. In other words, the parameters of the HMM are known. In fact, you can write them down in the Python programming language: Python is an interpreted programming language created by Guido van Rossum in 1990. ...

 states = ('Rainy', 'Sunny') observations = ('walk', 'shop', 'clean') start_probability = {'Rainy': 0.6, 'Sunny': 0.4} transition_probability = { 'Rainy' : {'Rainy': 0.7, 'Sunny': 0.3}, 'Sunny' : {'Rainy': 0.4, 'Sunny': 0.6}, } emission_probability = { 'Rainy' : {'walk': 0.1, 'shop': 0.4, 'clean': 0.5}, 'Sunny' : {'walk': 0.6, 'shop': 0.3, 'clean': 0.1}, } 

In this fragment, start_probability refers to your uncertainty about which state the HMM is in when your friend first calls you (all you know is that it tends to be rainy on average). The particular probability distribution used here is not the equilibrium one, which is (given the transition probabilities) actually approximately {'Rainy': 0.571, 'Sunny': 0.429}. The transition_probability refers to the change of the weather in the underlying Markov chain. In this example, there is only a 30% chance that tomorrow will be sunny if today is rainy. The emission_probability tells you how likely your friend is to perform a certain activity on each day. If it's rainy, there is a 50% chance that he is cleaning his apartment; if it's sunny, there is a 60% chance that he will go outside for a walk.


You talk to your friend three days in a row and discover that on the first day he went for a walk, on the second day he went shopping, and on the third day he cleaned his apartment. You have two questions: What is the overall probability of this sequence of observations? And what is the most likely sequence of rainy/sunny days that would explain these observations? The first question is answered by the forward algorithm; the second question is answered by the Viterbi algorithm. These two algorithms are structurally so similar (in fact, they are both instances of the same abstract algorithm) that they can be implemented in a single function:

 def forward_viterbi(y, X, sp, tp, ep): T = {} for state in X: ## prob. V. path V. prob. T[state] = (sp[state], [state], sp[state]) for output in y: U = {} for next_state in X: total = 0 argmax = None valmax = 0 for state in X: (prob, v_path, v_prob) = T[state] p = ep[next_state][output] * tp[state][next_state] prob *= p v_prob *= p total += prob if v_prob > valmax: argmax = v_path + [next_state] valmax = v_prob U[next_state] = (total, argmax, valmax) T = U ## apply sum/max to the final states: total = 0 argmax = None valmax = 0 for state in X: (prob, v_path, v_prob) = T[state] total += prob if v_prob > valmax: argmax = v_path valmax = v_prob return (total, argmax, valmax) 

The function forward_viterbi takes the following arguments: y is the sequence of observations, e.g. ['walk', 'shop', 'clean']; X is the set of hidden states; sp is the start probability; tp are the transition probabilities; and ep are the emission probabilities.


The algorithm works on the mappings T and U. Each is a mapping from a state to a triple (prob, v_path, v_prob), where prob is the total probability of all paths from the start to the current state, v_path is the Viterbi path up to the current state, and v_prob is the probability of the Viterbi path up to the current state. The mapping T holds this information for a given point t in time, and the main loop constructs U, which holds similar information for time t+1. Because of the Markov property, information about any point in time prior to t is not needed. In probability theory, a stochastic process has the Markov property if the conditional probability distribution of future states of the process, given the present state, depends only upon the current state, i. ...


The algorithm begins by initializing T to the start probabilities: the total probability for a state is just the start probability of that state; and the Viterbi path to a start state is the singleton path consisting only of that state; the probability of the Viterbi path is the same as the start probability.


The main loop considers the observations from y in sequence. Its loop invariant is that T contains the correct information up to but excluding the point in time of the current observation. The algorithm then computes the triple (prob, v_path, v_prob) for each possible next state. The total probability of a given next state, total is obtained by adding up the probabilities of all paths reaching that state. More precisely, the algorithm iterates over all possible source states. For each source state, T holds the total probability of all paths to that state. This probability is then multiplied by the emission probability of the current observation and the transition probability from the source state to the next state. The resulting probability prob is then added to total. The probability of the Viterbi path is computed in a similar fashion, but instead of adding across all paths one performs a discrete maximization. Initially the maximum value valmax is zero. For each source state, the probability of the Viterbi path to that state is known. This too is multiplied with the emission and transition probabilities and replaces valmax if it is greater than its current value. The Viterbi path itself is computed as the corresponding argmax of that maximization, by extending the Viterbi path that leads to the current state with the next state. The triple (prob, v_path, v_prob) computed in this fashion is stored in U and once U has been computed for all possible next states, it replaces T, thus ensuring that the loop invariant holds at the end of the iteration. In computer science, a loop invariant is an invariant used to prove properties of loops. ... In mathematics, arg max (or argmax) stands for the argument of the maximum, that is to say, the value of the given argument for which the value of the given expression attains its maximum value. ...


In the end another summation/maximization is performed (this could also be done inside the main loop by adding a pseudo-observation after the last real observation).


In the running example, the forward/Viterbi algorithm is used as follows:

 def example(): return forward_viterbi(['walk', 'shop', 'clean'], states, start_probability, transition_probability, emission_probability) 

This reveals that the total probability of ['walk', 'shop', 'clean'] is 0.033612 and that the Viterbi path is ['Sunny', 'Rainy', 'Rainy', 'Rainy']. The Viterbi path contains four states because the third observation was generated by the third state and a transition to the fourth state. In other words, given the observed activities, it was most likely sunny when your friend went for a walk and then it started to rain the next day and kept on raining.


Extensions

With the algorithm called Iterative Viterbi Decoding one can find the subsequence of an observation that matches best (on average) to a given HMM. Iterative Viterbi Decoding, developed by M.C.Silaghi (1998) works by iterating the call to a modified Viterbi algorithm, reestimating the score for a filler until convergence. Iterative Viterbi Decoding is an algorithm that spots the subsequence S of an observation O={o1,...,on} having the highest average probability (i. ... Iterative Viterbi Decoding is an algorithm that spots the subsequence S of an observation O={o1,...,on} having the highest average probability (i. ...


An alternate algorithm, called the Lazy Viterbi algorithm, has been recently proposed. This works by not expanding any nodes until it really needs to, and usually manages to get away with doing a lot less work (in software) than the ordinary Viterbi algorithm for the same result - however, it is not so easy to parallelize in hardware.


See also

In computer science and statistical computing, the Baum-Welch algorithm is used to find the unknown parameters of a hidden Markov model (HMM). ... A hidden Markov model (HMM) is a statistical model where the system being modelled is assumed to be a Markov process with unknown parameters, and the challenge is to determine the hidden parameters, from the observable parameters, based on this assumption. ...

References

  • Andrew J. Viterbi. Error bounds for convolutional codes and an asymptotically optimum decoding algorithm. IEEE Transactions on Information Theory 13(2):260–267, April 1967. (The Viterbi decoding algorithm is described in section IV.)
  • G. D. Forney. The Viterbi algorithm. Proceedings of the IEEE 61(3):268–278, March 1973.
  • L. R. Rabiner. A tutorial on hidden Markov models and selected applications in speech recognition. Proceedings of the IEEE 77(2):257–286, February 1989. (Describes the forward algorithm and Viterbi algorithm for HMMs).
  • J Feldman, I Abou-Faycal and M Frigo. A Fast Maximum-Likelihood Decoder for Convolutional Codes.

External links

  • An interview with Andrew Viterbi, including some background on the discovery of the Viterbi algorithm

  Results from FactBites:
 
Viterbi algorithm decoding method and apparatus - Patent 5504784 (3975 words)
Viterbi algorithm decoder, operatively coupled to the sampler, for decoding, according to Viterbi algorithm, the sampled phase angle and the sampled magnitude into a decoded symbol using a metric that limits effects on the metric's value as the difference between the sampled phase angle and the decoded symbol increases.
The Viterbi algorithm decoder 311, by applying the Viterbi algorithm using one of the metrics as previously described, decodes the data from the sampler 309 into a code word that is used in conventional ways that are known in the art.
The Viterbi algorithm decoder 417, by applying the Viterbi algorithm using one of the metrics as previously described, decodes the data from the deinterleaver 415 into a code word that is used in conventional ways that are known in the art.
Viterbi algorithm - Wikipedia, the free encyclopedia (1467 words)
The Viterbi algorithm was originally conceived as an error-correction scheme for noisy digital communication links, finding universal application in decoding the convolutional codes used in CDMA and GSM digital cellular, dial modems, satellite and deep-space communications, and 802.11 wireless LANs.
The algorithm begins by initializing T to the start probabilities: the total probability for a state is just the start probability of that state; and the Viterbi path to a start state is the singleton path consisting only of that state; the probability of the Viterbi path is the same as the start probability.
The Viterbi path itself is computed as the corresponding argmax of that maximization, by extending the Viterbi path that leads to the current state with the next state.
  More results at FactBites »


 

COMMENTARY     


Share your thoughts, questions and commentary here
Your name
Your comments
Please enter the 5-letter protection code

Want to know more?
Search encyclopedia, statistics and forums:

 


Lesson Plans | Student Area | Student FAQ | Reviews | Press Releases |  Feeds | Contact
The Wikipedia article included on this page is licensed under the GFDL.
Images may be subject to relevant owners' copyright.
All other elements are (c) copyright NationMaster.com 2003-5. All Rights Reserved.
Usage implies agreement with terms.