Discrete Universal Denoiser
# Discrete Universal Denoiser

In information theory and signal processing, the Discrete Universal Denoiser (DUDE) is a denoising scheme for recovering sequences over a finite alphabet, which have been corrupted by a discrete memoryless channel. The DUDE was proposed in 2005 by Tsachy Weissman, Erik Ordentlich, Gadiel Seroussi, Sergio Verdú and Marcelo J. Weinberger.

## Overview

The Discrete Universal Denoiser (DUDE) is a denoising scheme that estimates an unknown signal $x^{n}=\left(x_{1}\ldots x_{n}\right)$ over a finite alphabet from a noisy version $z^{n}=\left(z_{1}\ldots z_{n}\right)$. While most denoising schemes in the signal processing and statistics literature deal with signals over an infinite alphabet (notably, real-valued signals), the DUDE addresses the finite alphabet case. The noisy version $z^{n}$ is assumed to be generated by transmitting $x^{n}$ through a known discrete memoryless channel.

For a fixed context length parameter $k$, the DUDE counts of the occurrences of all the strings of length $2k+1$ appearing in $z^{n}$. The estimated value ${\hat {x}}_{i}$ is determined based the two-sided length-$k$ context $\left(z_{i-k},\ldots ,z_{i-1},z_{i+1},\ldots ,z_{i+k}\right)$ of $z_{i}$, taking into account all the other tokens in $z^{n}$ with the same context, as well as the known channel matrix and the loss function being used.

The idea underlying the DUDE is best illustrated when $x^{n}$ is a realization of a random vector $X^{n}$. If the conditional distribution $X_{i}|Z_{i-k},\ldots ,Z_{i-1},Z_{i+1},\ldots ,Z_{i+k}$, namely the distribution of the noiseless symbol $X_{i}$ conditional on its noisy context $\left(Z_{i-k},\ldots ,Z_{i-1},Z_{i+1},\ldots ,Z_{i+k}\right)$ was available, the optimal estimator ${\hat {X}}_{i}$ would be the Bayes Response to $X_{i}|Z_{i-k},\ldots ,Z_{i-1},Z_{i+1},\ldots ,Z_{i+k}$. Fortunately, when the channel matrix is known and non-degenerate, this conditional distribution can be expressed in terms of the conditional distribution $Z_{i}|Z_{i-k},\ldots ,Z_{i-1},Z_{i+1},\ldots ,Z_{i+k}$, namely the distribution of the noisy symbol $Z_{i}$ conditional on its noisy context. This conditional distribution, in turn, can be estimated from an individual observed noisy signal $Z^{n}$ by virtue of the Law of Large Numbers,

provided $n$ is “large enough”.

Applying the DUDE scheme with a context length $k$ to a sequence of length $n$ over a finite alphabet ${\mathcal {Z}}$ requires $O(n)$ operations and space $O\left(\min(n,|{\mathcal {Z}}|^{2k})\right)$.

Under certain assumptions, the DUDE is a universal scheme in the sense of asymptotically performing as well as an optimal denoiser, which has oracle access to the unknown sequence. More specifically, assume that the denoising performance is measured using a given single-character fidelity criterion, and consider the regime where the sequence length $n$ tends to infinity and the context length $k=k_{n}$ tends to infinity “not too fast”. In the stochastic setting, where a doubly infinite sequence noiseless sequence $\mathbf {x}$ is a realization of a stationary process $\mathbf {X}$, the DUDE asymptotically performs, in expectation, as well as the best denoiser, which has oracle access to the source distribution $\mathbf {X}$. In the single-sequence, or “semi-stochastic” setting with a fixed doubly infinite sequence $\mathbf {x}$, the DUDE asymptotically performs as well as the best “sliding window” denoiser, namely any denoiser that determines ${\hat {x}}_{i}$ from the window $\left(z_{i-k},\ldots ,z_{i+k}\right)$, which has oracle access to $\mathbf {x}$.

## The discrete denoising problem

Let ${\mathcal {X}}$ be the finite alphabet of a fixed but unknown original “noiseless” sequence $x^{n}=\left(x_{1},\ldots ,x_{n}\right)\in {\mathcal {X}}^{n}$. The sequence is fed into a discrete memoryless channel (DMC). The DMC operates on each symbol $x_{i}$ independently, producing a corresponding random symbol $Z_{i}$ in a finite alphabet ${\mathcal {Z}}$. The DMC is known and given as a ${\mathcal {X}}$-by-${\mathcal {Z}}$ Markov matrix $\Pi$, whose entries are $\pi (x,z)=\mathbb {P} \left(Z=z\,|\,X=x\right)$. It is convenient to write $\pi _{z}$ for the $z$-column of $\Pi$. The DMC produces a random noisy sequence $Z^{n}=\left(z_{1},\ldots ,z_{n}\right)\in {\mathcal {Z}}^{n}$. A specific realization of this random vector will be denoted by $z^{n}$. A denoiser is a function ${\hat {X}}^{n}:{\mathcal {Z}}^{n}\to {\mathcal {X}}^{n}$ that attempts to recover the noiseless sequence $x^{n}$ from a distorted version $z^{n}$. A specific denoised sequence is denoted by ${\hat {x}}^{n}={\hat {X}}^{n}\left(z^{n}\right)=\left({\hat {X}}_{1}(z^{n}),\ldots ,{\hat {X}}_{n}(z^{n})\right)$. The problem of choosing the denoiser ${\hat {X}}^{n}$ is known as signal estimation, filtering or smoothing. To compare candidate denoisers, we choose a single-symbol fidelity criterion $\Lambda :{\mathcal {X}}\times {\mathcal {X}}\to [0,\infty )$ (for example, the Hamming loss) and define the per-symbol loss of the denoiser ${\hat {X}}^{n}$ at $(x^{n},z^{n})$ by

Ordering the elements of the alphabet ${\mathcal {X}}$ by ${\mathcal {X}}=\left(a_{1},\ldots ,a_{|{\mathcal {X}}|}\right)$, the fidelity criterion can be given by a $|{\mathcal {X}}|$-by-$|{\mathcal {X}}|$ matrix, with columns of the form

## The DUDE scheme

### Step 1: Calculating the empirical distribution in each context

The DUDE corrects symbols according to their context. The context length $k$ used is a tuning parameter of the scheme. For $k+1\leq i\leq n-k$, define the left context of the $i$-th symbol in $z^{n}$ by $l^{k}(z^{n},i)=\left(z_{i-k},\ldots ,z_{i-1}\right)$ and the corresponding right context as $r^{k}(z^{n},i)=\left(z_{i+1},\ldots ,z_{i+k}\right)$. A two-sided context is a combination $(l^{k},r^{k})$ of a left and a right context.

The first step of the DUDE scheme is to calculate the empirical distribution of symbols in each possible two-sided context along the noisy sequence $z^{n}$. Formally, a given two-sided context $(l^{k},r^{k})\in {\mathcal {Z}}^{k}\times {\mathcal {Z}}^{k}$ that appears once or more along $z^{n}$ determines an empirical probability distribution over ${\mathcal {Z}}$, whose value at the symbol $z$ is

Thus, the first step of the DUDE scheme with context length $k$ is to scan the input noisy sequence $z^{n}$ once, and store the length-$|{\mathcal {Z}}|$ empirical distribution vector $\mu \left(z^{n},l^{k},r^{k}\right)$ (or its non-normalized version, the count vector) for each two-sided context found along $z^{n}$. Since there are at most $N_{n,k}=\min \left(n,|{\mathcal {Z}}|^{2k}\right)$ possible two-sided contexts along $z^{n}$, this step requires $O(n)$ operations and storage $O(N_{n,k})$.

### Step 2: Calculating the Bayes response to each context

Denote the column of single-symbol fidelity criterion $\Lambda$, corresponding to the symbol ${\hat {x}}\in {\mathcal {X}}$, by $\lambda _{\hat {x}}$. We define the Bayes Response to any vector $\mathbf {v}$ of length $|{\mathcal {X}}|$ with non-negative entries as

This definition is motivated in the background below.

The second step of the DUDE scheme is to calculate, for each two-sided context $(l^{k},r^{k})$ observed in the previous step along $z^{n}$, and for each symbol $z\in {\mathcal {Z}}$ observed in each context (namely, any $z$ such that $l^{r}zr^{k}$ is a substring of $z^{n}$) the Bayes response to the vector $\Pi ^{-\top }\mu \left(z^{n}\,,\,l^{k}\,,\,r^{k}\right)\odot \pi _{z}$, namely

Note that the sequence $z^{n}$ and the context length $k$ are implicit. Here, $\pi _{z}$ is the $z$-column of $\Pi$ and for vectors $\mathbf {a}$ and $\mathbf {b}$, $\mathbf {a} \odot \mathbf {b}$ denotes their Schur (entrywise) product, defined by $\left(\mathbf {a} \odot \mathbf {b} \right)_{i}=a_{i}b_{i}$. Matrix multiplication is evaluated before the Schur product, so that $\Pi ^{-\top }\mu \odot \pi _{z}$ stands for $(\Pi ^{-\top }\mu )\odot \pi _{z}$.

This formula assumed that the channel matrix $\Pi$ is square ($|{\mathcal {X}}|=|{\mathcal {Z}}|$) and invertible. When $|{\mathcal {X}}|\leq |{\mathcal {Z}}|$ and $\Pi$ is not invertible, under the reasonable assumption that it has full row rank, we replace $(\Pi ^{\top })^{-1}$ above with its Moore-Penrose pseudo-inverse $\left(\Pi \Pi ^{\top }\right)^{-1}\Pi$ and calculate instead

By caching the inverse or pseudo-inverse $\Pi ^{-\top }$, and the values $\lambda _{\hat {x}}\odot \pi _{z}$ for the relevant pairs $({\hat {x}},z)\in {\mathcal {X}}\times {\mathcal {Z}}$, this step requires $O(N_{k,n})$ operations and $O(N_{k,n})$ storage.

### Step 3: Estimating each symbol by the Bayes response to its context

The third and final step of the DUDE scheme is to scan $z^{n}$ again and compute the actual denoised sequence ${\hat {X}}^{n}(z^{n})=\left({\hat {X}}_{1}(z^{n}),\ldots ,{\hat {X}}_{n}(z^{n})\right)$. The denoised symbol chosen to replace $z_{i}$ is the Bayes response to the two-sided context of the symbol, namely

This step requires $O(n)$ operations and used the data structure constructed in the previous step.

In summary, the entire DUDE requires $O(n)$ operations and $O(N_{k,n})$ storage.

## Asymptotic optimality properties

The DUDE is designed to be universally optimal, namely optimal (is some sense, under some assumptions) regardless of the original sequence $x^{n}$.

Let ${\hat {X}}_{DUDE}^{n}:{\mathcal {Z}}^{n}\to {\mathcal {X}}^{n}$ denote a sequence of DUDE schemes, as described above, where ${\hat {X}}_{DUDE}^{n}$ uses a context length $k_{n}$ that is implicit in the notation. We only require that $\lim _{n\to \infty }k_{n}=\infty$ and that $k_{n}|{\mathcal {Z}}|^{2K_{n}}=o\left({\frac {n}{\log n}}\right)$.

### For a stationary source

Denote by ${\mathcal {D}}_{n}$ the set of all $n$-block denoisers, namely all maps ${\hat {X}}^{n}:{\mathcal {Z}}^{n}\to {\mathcal {X}}^{n}$.

Let $\mathbf {X}$ be an unknown stationary source and $\mathbf {Z}$ be the distribution of the corresponding noisy sequence. Then

and both limits exist. If, in addition the source $\mathbf {X}$ is ergodic, then

### For an individual sequence

Denote by ${\mathcal {D}}_{n,k}$ the set of all $n$-block $k$-th order sliding window denoisers, namely all maps ${\hat {X}}^{n}:{\mathcal {Z}}\to {\mathcal {X}}$ of the form ${\hat {X}}_{i}(z^{n})=f\left(z_{i-k},\ldots ,z_{i+k}\right)$ with $f:{\mathcal {Z}}^{2k+1}\to {\mathcal {X}}$ arbitrary.

Let $\mathbf {x} \in {\mathcal {X}}^{\infty }$ be an unknown noiseless sequence stationary source and $\mathbf {Z}$ be the distribution of the corresponding noisy sequence. Then

### Non-asymptotic performance

Let ${\hat {X}}_{k}^{n}$ denote the DUDE on with context length $k$ defined on $n$-blocks. Then there exist explicit constants $A,C>0$ and $B>1$ that depend on $\left(\Pi ,\Lambda \right)$ alone, such that for any $n,k$ and any $x^{n}\in {\mathcal {X}}^{n}$ we have

where $Z^{n}$ is the noisy sequence corresponding to $x^{n}$ (whose randomness is due to the channel alone)

In fact holds with the same constants $A,B$ as above for any $n$-block denoiser ${\hat {X}}^{n}\in {\mathcal {D}}^{n}$. The lower bound proof requires that the channel matrix $\Pi$ be square and the pair $\left(\Pi ,\Lambda \right)$ satisfies a certain technical condition.

## Background

To motivate the particular definition of the DUDE using the Bayes response to a particular vector, we now find the optimal denoiser in the non-universal case, where the unknown sequence $x^{n}$ is a realization of a random vector $X^{n}$, whose distribution is known.

Consider first the case $n=1$. Since the joint distribution of $(X,Z)$ is known, given the observed noisy symbol $z$, the unknown symbol $X\in {\mathcal {X}}$ is distributed according to the known distribution $\mathbb {P} (X=x|Z=z)$. By ordering the elements of ${\mathcal {X}}$, we can describe this conditional distribution on ${\mathcal {X}}$ using a probability vector $\mathbf {P} _{X|z}$, indexed by ${\mathcal {X}}$, whose $x$-entry is $\mathbb {P} \left(X=x|Z=z\right)$. Clearly the expected loss for the choice of estimated symbol ${\hat {x}}$ is $\lambda _{\hat {x}}^{\top }\mathbf {P} _{X|z}$.

Define the Bayes Envelope of a probability vector $\mathbf {v}$, describing a probability distribution on ${\mathcal {X}}$, as the minimal expected loss $U(\mathbf {v} )=\min _{{\hat {x}}\in {\mathcal {X}}}\mathbf {v} ^{\top }\lambda _{\hat {x}}$, and the Bayes Response to $\mathbf {v}$ as the prediction that achieves this minimum, ${\hat {X}}_{Bayes}(\mathbf {v} )={\text{argmin}}_{{\hat {x}}\in {\mathcal {X}}}\mathbf {v} ^{\top }\lambda _{\hat {x}}$. Observe that the Bayes response is scale invariant in the sense that ${\hat {X}}_{Bayes}(\mathbf {v} )={\hat {X}}_{Bayes}(\alpha \mathbf {v} )$ for $\alpha >0$.

For the case $n=1$, then, the optimal denoiser is ${\hat {X}}(z)={\hat {X}}_{Bayes}\left(\mathbf {P} _{X|z}\right)$. This optimal denoiser can be expressed using the marginal distribution of $Z$ alone, as follows. When the channel matrix $\Pi$ is invertible, we have $\mathbf {P} _{X|z}\propto \Pi ^{-\top }P_{Z}\odot \pi _{z}$ where $\pi _{z}$ is the $z$-th column of $\Pi$. This implies that the optimal denoiser is given equivalently by ${\hat {X}}(z)={\hat {X}}_{Bayes}\left(\Pi ^{-\top }\mathbf {P} _{Z}\odot \pi _{z}\right)$. When $|{\mathcal {X}}|\leq |{\mathcal {Z}}|$ and $\Pi$ is not invertible, under the reasonable assumption that it has full row rank, we can replace $\Pi ^{-1}$ with its Moore-Penrose pseudo-inverse and obtain

Turning now to arbitrary $n$, the optimal denoiser ${\hat {X}}^{opt}(z^{n})$ (with minimal expected loss) is therefore given by the Bayes response to $\mathbf {P} _{X_{i}|z^{n}}$

where $\mathbf {P} _{X_{i}|z^{n}}$ is a vector indexed by ${\mathcal {X}}$, whose $x$-entry is $\mathbb {P} \left(X_{i}=x|Z^{n}=z^{n}\right)$. The conditional probability vector $\mathbf {P} _{X_{i}|z^{n}}$ is hard to compute. A derivation analogous to the case $n=1$ above shows that the optimal denoiser admits an alternative representation, namely ${\hat {X}}_{i}^{opt}(z^{n})={\hat {X}}_{Bayes}\left(\Pi ^{-\top }\mathbf {P} _{Z_{i},z^{n\backslash i}}\odot \pi _{z_{i}}\right)$, where $z^{n\backslash i}=\left(z_{1},\ldots ,z_{i-1},z_{i+1},\ldots ,z_{n}\right)\in {\mathcal {Z}}^{n-1}$ is a given vector and $\mathbf {P} _{Z_{i},z^{n\backslash i}}$ is the probability vector indexed by ${\mathcal {Z}}$ whose $z$-entry is $\mathbb {P} \left((Z_{1},\ldots ,Z_{n})=(z_{1},\ldots ,z_{i-1},z,z_{i+1},\ldots ,z_{n})\right)\,.$ Again, $\Pi ^{-\top }$ is replaced by a pseudo-inverse if $\Pi$ is not square or not invertible.

When the distribution of $X$ (and therefore, of $Z$) is not available, the DUDE replaces the unknown vector $\mathbf {P} _{Z_{i},z^{n\backslash i}}$ with an empirical estimate obtained along the noisy sequence $z^{n}$ itself, namely with $\mu \left(Z_{i},l^{k}(Z^{n},i),r^{k}(Z^{n},i)\right)$. This leads to the above definition of the DUDE.

While the convergence arguments behind the optimality properties above are more subtle, we note that the above, combined with the Birkhoff Ergodic Theorem, is enough to prove that for a stationary ergodic source, the DUDE with context-length $k$ is asymptotically optimal all $k$-th order sliding window denoisers.

## Extensions

The basic DUDE as described here assumes a signal with a one-dimensional index set over a finite alphabet, a known memoryless channel and a context length that is fixed in advance. Relaxations of each of these assumptions have been considered in turn. Specifically:

* Infinite alphabets
* Channels with memory
* Unknown channel matrix
* Variable context and adaptive choice of context length
* Two-dimensional signals

## Applications

### Application to image denoising

A DUDE-based framework for grayscale image denoising achieves state-of-the-art denoising for impulse-type noise channels (e.g., "salt and pepper" or "M-ary symmetric" noise), and good performance on the Gaussian channel (comparable to the Non-local means image denoising scheme on this channel). A different DUDE variant applicable to grayscale images is presented in.

### Application to channel decoding of uncompressed sources

The DUDE has led to universal algorithms for channel decoding of uncompressed sources.

