Professional Documents
Culture Documents
Training
A simple training algorithm for vector quantization is:
A more sophisticated algorithm reduces the bias in the density matching estimation, and
ensures that all points are used, by including an extra sensitivity parameter:
The algorithm can be iteratively updated with 'live' data, rather than by picking random
points from a data set, but this will introduce some bias if the data is temporally
correlated over many samples.
Applications
Vector quantization is used for lossy data compression, lossy data correction and density
estimation.
Lossy data correction, or prediction, is used to recover data missing from some
dimensions. It is done by finding the nearest group with the data dimensions available,
then predicting the result based on the values for the missing dimensions, assuming that
they will have the same value as the group's centroid.
For density estimation, the area/volume that is closer to a particular centroid than to any
other is inversely proportional to the density (due to the density matching property of the
algorithm).
The set of discrete amplitude levels is quantized jointly rather than each sample being
quantized separately. Consider a K-dimensional vector [x1,x2,...,xk] of amplitude levels.
It is compressed by choosing the nearest matching vector from a set of N-dimensional
vectors [y1,y2,...,yn].
All possible combinations of the N-dimensional vector [y1,y2,...,yn] form the codebook.
Only the index of the codeword in the codebook is sent instead of the quantized values.
This conserves space and achieves more compression.
Twin vector quantization (VQF) is part of the MPEG-4 standard dealing with time
domain weighted interleaved vector quantization.
• Cinepak
• Sorenson codec
• Indeo
• Westwood's VQA format, used in many games
• CELP
• G.729
• TwinVQ
• Ogg Vorbis [1]
• AMR-WB+
• DTS
Context mixing
Context mixing is a type of data compression algorithm in which the next-
symbol predictions of two or more statistical models are combined to yield a prediction
that is often more accurate than any of the individual predictions. For example, one
simple method (not necessarily the best) is to average the probabilities assigned by each
model. The random forest is another method: it outputs the prediction that is the mode of
the predictions output by individual models. Combining models is an active area of
research in machine learning.
The PAQ series of data compression programs use context mixing to assign probabilities
to individual bits of the input.
For example, suppose that we are compressing a text file. We wish to predict whether the
next character will be a linefeed, given that the previous character was a period (context
A) and that the last linefeed occurred 72 characters ago (context B). Suppose that a
linefeed previously occurred after 1 of the last 5 periods (P(X|A) = 1/5 = 0.2) and in 5 out
of the last 10 lines at column 72 (P(X|B) = 5/10 = 0.5). How should these predictions be
combined?
Two general approaches have been used, linear and logistic mixing. Linear mixing uses a
weighted average of the predictions weighted by evidence. In this example, P(X|B) gets
more weight than P(X|A) because P(X|B) is based on a greater number of tests. Older
versions of PAQ uses this approach[1]. Newer versions use logistic (or neural network)
mixing by first transforming the predictions into the logistic domain, log(p/(1-p)) before
averaging[2]. This effectively gives greater weight to predictions near 0 or 1, in this case
P(X|A). In both cases, additional weights may be given to each of the input models and
adapted to favor the models that have given the most accurate predictions in the past. All
but the oldest versions of PAQ use adaptive weighting.
Most context mixing compressors predict one bit of input at a time. The output
probability is simply the probability that the next bit will be a 1.
Linear Mixing
We are given a set of predictions Pi(1) = n1i/ni, where ni = n0i + n1i, and n0i and n1i are the
counts of 0 and 1 bits respectively for the i'th model. The probabilities are computed by
weighted addition of the 0 and 1 counts:
• S0 = Σi wi n0i
• S1 = Σi wi n1i
• S = S0 + S1
• P(0) = S0 / S
• P(1) = S1 / S
The weights wi are initially equal and always sum to 1. Under the initial conditions, each
model is weighted in proportion to evidence. The weights are then adjusted to favor the
more accurate models. Suppose we are given that the actual bit being predicted is y (0 or
1). Then the weight adjustment is:
• ni = n0i + n1i
• error = y – P(1)
• wi ← wi + [(S n1i - S1 ni) / (S0 S1)] error
Logistic Mixing
Let Pi(1) be the prediction by the i'th model that the next bit will be a 1. Then the final
prediction P(1) is calculated:
• xi = stretch(Pi(1))
• P(1) = squash(Σi wi xi)
where P(1) is the probability that the next bit will be a 1, Pi(1) is the probability estimated
by the i'th model, and
After each prediction, the model is updated by adjusting the weights to minimize coding
cost.
• wi ← wi + η xi (y - P(1))
where η is the learning rate (typically 0.002 to 0.01), y is the predicted bit, and (y - P(1))
is the prediction error.