To install click the Add extension button. That's it.

The source code for the WIKI 2 extension is being checked by specialists of the Mozilla Foundation, Google, and Apple. You could also do it yourself at any point in time.

4,5
Kelly Slayton
Congratulations on this excellent venture… what a great idea!
Alexander Grigorievskiy
I use WIKI 2 every day and almost forgot how the original Wikipedia looks like.
Live Statistics
English Articles
Improved in 24 Hours
Languages
Recent
Show all languages
What we do. Every page goes through several hundred of perfecting techniques; in live mode. Quite the same Wikipedia. Just better.
.
Leo
Newton
Brights
Milds

# Stochastic chains with memory of variable length

Stochastic chains with memory of variable length are a family of stochastic chains of finite order in a finite alphabet, such as, for every time pass, only one finite suffix of the past, called context, is necessary to predict the next symbol. These models were introduced in the information theory literature by Jorma Rissanen in 1983,[1] as a universal tool to data compression, but recently have been used to model data in different areas such as biology,[2] linguistics[3] and music.[4]

## Definition

A stochastic chain with memory of variable length is a stochastic chain ${\displaystyle (X_{n})_{n\in Z}}$, taking values in a finite alphabet ${\displaystyle A}$, and characterized by a probabilistic context tree ${\displaystyle (\tau ,p)}$, so that

• ${\displaystyle \tau }$ is the group of all contexts. A context ${\displaystyle X_{n-l},\ldots ,X_{n-1}}$, being ${\displaystyle l}$ the size of the context, is a finite portion of the past ${\displaystyle X_{-\infty },\ldots ,X_{n-1}}$, which is relevant to predict the next symbol ${\displaystyle X_{n}}$;
• ${\displaystyle p}$ is a family of transition probabilities associated with each context.

## History

The class of stochastic chains with memory of variable length was introduced by Jorma Rissanen in the article A universal system for data compression system.[1] Such class of stochastic chains was popularized in the statistical and probabilistic community by P. Bühlmann and A. J. Wyner in 1999, in the article Variable Length Markov Chains. Named by Bühlmann and Wyner as “variable length Markov chains” (VLMC), these chains are also known as “variable order Markov models" (VOM), “probabilistic suffix trees[2] and “context tree models”.[5] The name “stochastic chains with memory of variable length” seems to have been introduced by Galves and Löcherbach, in 2008, in the article of the same name.[6]

## Examples

### Interrupted light source

Consider a system by a lamp, an observer and a door between both of them. The lamp has two possible states: on, represented by 1, or off, represented by 0. When the lamp is on, the observer may see the light through the door, depending on which state the door is at the time: open, 1, or closed, 0. such states are independent of the original state of the lamp.

Let ${\displaystyle (X_{n})_{n\geq 0}}$ a Markov chain that represents the state of the lamp, with values in ${\displaystyle A={0,1}}$ and let ${\displaystyle p}$ be a probability transition matrix. Also, let ${\displaystyle (\xi _{n})_{n\geq 0}}$ be a sequence of independent random variables that represents the door's states, also taking values in ${\displaystyle A}$, independent of the chain ${\displaystyle (X_{n})_{n\geq 0}}$ and such that

${\displaystyle \mathbb {P} (\xi _{n}=1)=1-\varepsilon }$

where ${\displaystyle 0<\epsilon <1}$. Define a new sequence ${\displaystyle (Z_{n})_{n\geq 0}}$ such that

${\displaystyle Z_{n}=X_{n}\xi _{n}}$ for every ${\displaystyle (Z_{n})_{n\geq 0}.}$

In order to determine the last instant that the observer could see the lamp on, i.e. to identify the least instant ${\displaystyle k}$, with ${\displaystyle k in which ${\displaystyle Z_{k}=1}$.

Using a context tree it's possible to represent the past states of the sequence, showing which are relevant to identify the next state.

The stochastic chain ${\displaystyle (Z_{n})_{n\in \mathbb {Z} }}$ is, then, a chain with memory of variable length, taking values in ${\displaystyle A}$ and compatible with the probabilistic context tree ${\displaystyle (\tau ,p)}$, where

${\displaystyle \tau =\{1,10,100,\cdots \}\cup \{0^{\infty }\}.}$

## Inferences in chains with variable length

Given a sample ${\displaystyle X_{l},\ldots ,X_{n}}$, one can find the appropriated context tree using the following algorithms.

### The context algorithm

In the article A Universal Data Compression System,[1] Rissanen introduced a consistent algorithm to estimate the probabilistic context tree that generates the data. This algorithm's function can be summarized in two steps:

1. Given the sample produced by a chain with memory of variable length, we start with the maximum tree whose branches are all the candidates to contexts to the sample;
2. The branches in this tree are then cut until you obtain the smallest tree that's well adapted to the data. Deciding whether or not shortening the context is done through a given gain function, such as the ratio of the log-likelihood.

Be ${\displaystyle X_{0},\ldots ,X_{n-1}}$ a sample of a finite probabilistic tree ${\displaystyle (\tau ,p)}$. For any sequence ${\displaystyle x_{-j}^{-1}}$ with ${\displaystyle j\leq n}$, it is possible to denote by ${\displaystyle N_{n}(x_{-j}^{-1})}$ the number of occurrences of the sequence in the sample, i.e.,

${\displaystyle N_{n}(x_{-j}^{-1})=\sum _{t=0}^{n-j}\mathbf {1} \left\{X_{t}^{t+j-1}=x_{-j}^{-1}\right\}}$

Rissanen first built a context maximum candidate, given by ${\displaystyle X_{n-K(n)}^{n-1}}$, where ${\displaystyle K(n)=C\log {n}}$ and ${\displaystyle C}$ is an arbitrary positive constant. The intuitive reason for the choice of ${\displaystyle C\log {n}}$ comes from the impossibility of estimating the probabilities of sequence with lengths greater than ${\displaystyle \log {n}}$ based in a sample of size ${\displaystyle n}$.

From there, Rissanen shortens the maximum candidate through successive cutting the branches according to a sequence of tests based in statistical likelihood ratio. In a more formal definition, if bANnxk1b0 define the probability estimator of the transition probability ${\displaystyle p}$ by

${\displaystyle {\hat {p}}_{n}(a\mid x_{-k}^{-1})={\frac {N_{n}(x_{-k}^{-1}a)}{\sum _{b\in A}N_{n}(x_{-k}^{-1}b)}}}$

where ${\displaystyle x_{-j}^{-1}a=(x_{-j},\ldots ,x_{-1},a)}$. If ${\displaystyle \sum _{b\in A}N_{n}(x_{-k}^{-1}b)\,=\,0}$, define ${\displaystyle {\hat {p}}_{n}(a\mid x_{-k}^{-1})\,=\,1/|A|}$.

To ${\displaystyle i\geq 1}$, define

${\displaystyle \Lambda _{n}(x_{-i}^{-1})\,=\,2\,\sum _{y\in A}\sum _{a\in A}N_{n}(yx_{-i}^{-1}a)\log \left[{\frac {{\hat {p}}_{n}(a\mid x_{-i}^{-1}y)}{{\hat {p}}_{n}(a\mid x_{-i}^{-1})}}\right]\,}$

where ${\displaystyle yx_{-i}^{-1}=(y,x_{-i},\ldots ,x_{-1})}$ and

${\displaystyle {\hat {p}}_{n}(a\mid x_{-i}^{-1}y)={\frac {N_{n}(yx_{-i}^{-1}a)}{\sum _{b\in A}N_{n}(yx_{-i}^{-1}b)}}.}$

Note that ${\displaystyle \Lambda _{n}(x_{-i}^{-1})}$ is the ratio of the log-likelihood to test the consistency of the sample with the probabilistic context tree ${\displaystyle (\tau ,p)}$ against the alternative that is consistent with ${\displaystyle (\tau ',p')}$, where ${\displaystyle \tau }$ and ${\displaystyle \tau '}$ differ only by a set of sibling knots.

The length of the current estimated context is defined by

${\displaystyle {\hat {\ell }}_{n}(X_{0}^{n-1})=\max \left\{i=1,\ldots ,K(n):\Lambda _{n}(X_{n-i}^{n-1})\,>\,C\log n\right\}\,}$

where ${\displaystyle C}$ is any positive constant. At last, by Rissanen,[1] there's the following result. Given ${\displaystyle X_{0},\ldots ,X_{n-1}}$ of a finite probabilistic context tree ${\displaystyle (\tau ,p)}$, then

${\displaystyle P\left({\hat {\ell }}_{n}(X_{0}^{n-1})\neq \ell (X_{0}^{n-1})\right)\longrightarrow 0,}$

when ${\displaystyle n\rightarrow \infty }$.

### Bayesian information criterion (BIC)

The estimator of the context tree by BIC with a penalty constant ${\displaystyle c>0}$ is defined as

${\displaystyle {\hat {\tau }}_{\mathrm {BIC} }={\underset {\tau \in {\mathcal {T}}_{n}}{\arg \max }}\{\log L_{\tau }(X_{1}^{n})-c\,{\textrm {d}}f(\tau )\log n\}}$

### Smallest maximizer criterion (SMC)

The smallest maximizer criterion[3] is calculated by selecting the smallest tree τ of a set of champion trees C such that

${\displaystyle \lim _{n\to \infty }{\frac {\log L_{\tau }(X_{1}^{n})-\log L_{\hat {\tau }}(X_{1}^{n})}{n}}=0}$