Vector Quantization
π― Learning Objectives
By the end of this lesson, you should be able to:
- Explain why scalar quantization is suboptimal for correlated signals.
- Form vectors from sample streams and interpret them as points in
- Describe Voronoi regions and the nearest-neighbor decision rule in vector form.
- State and apply the LindeβBuzoβGray (LBG) algorithm to train a codebook.
- Compute centroid updates (sample averages) for codewords.
- Explain the geometric advantage of VQ (denser packing, lower distortion).
Introduction:
Scalar quantization assumes a memoryless source: individual samples are statistically independent. Many real signals (speech, audio, images, temperature series) exhibit memory: neighboring samples are statistically dependent. Vector Quantization (VQ) groups consecutive samples into vectors and quantizes those vectors jointly, which captures correlation and reduces distortion.
Vector formation (clean vector notation):
For vector dimension form non-overlapping block vectors:
Each block is a point in -dimensional Euclidean space. Using capital-bold for codewords and region labels avoids confusion.
Example (scalar sequence):
With we form:
Why Vector Quantization?
- Scalar quantizers treat each scalar independently and typically form rectangular cells aligned with axes.
- Vector quantizers place codewords where the data actually lies and partition space into Voronoi regions.
- This enables denser packing (reduced average distance to a codeword) and lower mean-squared error for the same bit rate.
Nearest-neighbor decision rule (vector form)
A vector is assigned to the region corresponding to the codeword with minimum Euclidean distance:
where the Euclidean norm is
Use this to build Voronoi partitions:
Voronoi region boundary (midpoint hyperplane between two codewords)
The boundary between neighboring codewords and is the set of points equidistant to both. The midpoint (point on the line joining the two codewords) is:
The decision hyperplane is perpendicular to and passes through
LindeβBuzoβGray (LBG) Algorithm β Vector Lloyd-Max
The LBG algorithm iteratively minimizes average squared error by alternating partition and centroid update steps.
- Choose number of codewords and initialize codebook (random or seeded).
- Partition step: assign each training vector to the closest codeword:
- Centroid update: recompute each codeword as the centroid (sample average) of its assigned vectors:
- Repeat steps 2β3 until codeword changes are below threshold or distortion converges.
If you have access to a continuous PDF , the centroid becomes the conditional expectation:
Worked numerical example (clean vector math)
Training data (as vectors, ):
Initial codewords:
Compute distances and assign:
- is closest to
- are closest to
Centroid updates:
Repeat partition/update until convergence.
Encoder & Decoder (precise flow)
Encoder
- Form non-overlapping vectors
- For each compute
- Transmit index bits if fixed-length indices.
Decoder
- Receive index
- Reconstruct vector
- Concatenate vectors to form output sample stream.
Reconstruction rule:
Practical considerations
- Training set: choose representative samples (training set) that match target signal statistics. Use separate test set for evaluation.
- Empty cells: if a region becomes empty, reinitialize (e.g., split a high-distortion codeword or pick a random training vector).
- High-dimensionality: as increases, data becomes sparse β need larger training sets to estimate centroids robustly.
- Complexity: nearest-neighbor search can be accelerated with KD-trees or approximate NN methods for large M.
Key Takeaways
- Write vectors as and codewords as to avoid ambiguity.
- VQ partitions into Voronoi regions and assigns vectors by nearest neighbor.
- LBG iteratively updates codewords to centroids (sample averages) β a vector LloydβMax.
- VQ can reduce distortion significantly for correlated sources (speech, images).
Visual Demonstration
Vector Quantizer β LBG (Advanced)
Visual Demonstration
Audio Vector Quantizer (LBG) β Interactive
Distortion vs Iteration
π§ Quick Quiz
1) What is the main purpose of vector quantization?
2) In the LBG algorithm, what does the centroid update step compute?
3) What geometric structure defines the decision regions in VQ?
4) What criterion determines vector-to-codeword assignment in VQ?
5) Why is codebook stored at both encoder and decoder in VQ?