Examples#

This gallery walks through every public feature of mathematicskit.information_theory: entropy, mutual information and divergence; lossless source codes from Shannon-Fano and Huffman to arithmetic coding and Lempel-Ziv; channel capacity, the noisy-channel coding theorem and rate-distortion; and error-correcting codes from Hamming to Gallager’s LDPC codes.

Each script in this gallery is self-contained and can be run directly with python examples/information_theory/<section>/<script>.py.

Sections#

  • entropy – Hartley’s measure, Shannon entropy, mutual information, and the Kullback-Leibler divergence.

  • source_coding – the typical set, Shannon-Fano and Huffman codes, the Kraft-McMillan inequality, Elias gamma codes, arithmetic coding, and LZ78.

  • channels – capacity of the binary symmetric and Gaussian channels, random codes, rate-distortion, and Blahut-Arimoto.

  • channel_codes – Hamming codes, convolutional codes and Viterbi decoding, and LDPC codes with bit flipping.

Channel codes#

Error-correcting codes and their decoders.

Hamming codes (1950)

Hamming codes (1950)

Convolutional codes (1955)

Convolutional codes (1955)

The Viterbi algorithm (1967)

The Viterbi algorithm (1967)

Gallager’s low-density parity-check codes (1962-1963)

Gallager's low-density parity-check codes (1962-1963)

Channels#

Channel capacity, the noisy-channel coding theorem, and rate-distortion.

Capacity of the binary symmetric channel (1948)

Capacity of the binary symmetric channel (1948)

The noisy-channel coding theorem (1948)

The noisy-channel coding theorem (1948)

The Shannon-Hartley theorem (1949)

The Shannon-Hartley theorem (1949)

Rate-distortion theory (1959)

Rate-distortion theory (1959)

The Blahut-Arimoto algorithm (1972)

The Blahut-Arimoto algorithm (1972)

Entropy#

Measures of information: Hartley, Shannon, mutual information, and divergence.

Hartley’s measure of information (1928)

Hartley's measure of information (1928)

Shannon entropy (1948)

Shannon entropy (1948)

Mutual information (1948)

Mutual information (1948)

The Kullback-Leibler divergence (1951)

The Kullback-Leibler divergence (1951)

Source coding#

Lossless compression: from the typical set to Huffman, arithmetic, and Lempel-Ziv codes.

Shannon’s source coding theorem: the typical set (1948)

Shannon's source coding theorem: the typical set (1948)

Shannon-Fano coding (1948-1949)

Shannon-Fano coding (1948-1949)

The Kraft-McMillan inequality (1949, 1956)

The Kraft-McMillan inequality (1949, 1956)

Huffman coding (1952)

Huffman coding (1952)

Elias’ universal code for the integers (1975)

Elias' universal code for the integers (1975)

Arithmetic coding (1976)

Arithmetic coding (1976)

Lempel-Ziv compression (1977-1978)

Lempel-Ziv compression (1977-1978)

Gallery generated by Sphinx-Gallery