Docsity

Information Theory, Inference, and Learning Algorithms, Notas de estudo de Física

Toggle sidebar
bg1
Copyright Cambridge University Press 2003. On-screen viewing permitted. Printing not permitted. http://www.cambridge.org/0521642981
You can buy this book for 30 pounds or $50. See http://www.inference.phy.cam.ac.uk/mackay/itila/ for links.
Information Theory, Inference, and Learning Algorithms
David J.C. MacKay
pf3
pf4
pf5
pf8
pf9
pfa
pfd
pfe
pff
pf12
pf13
pf14
pf15
pf16
pf17
pf18
pf19
pf1a
pf1b
pf1c
pf1d
pf1e
pf1f
pf20
pf21
pf22
pf23
pf24
pf25
pf26
pf27
pf28
pf29
pf2a
pf2b
pf2c
pf2d
pf2e
pf2f
pf30
pf31
pf32
pf33
pf34
pf35
pf36
pf37
pf38
pf39
pf3a
pf3b
pf3c
pf3d
pf3e
pf3f
pf40
pf41
pf42
pf43
pf44
pf45
pf46
pf47
pf48
pf49
pf4a
pf4b
pf4c
pf4d
pf4e
pf4f
pf50
pf51
pf52
pf53
pf54
pf55
pf56
pf57
pf58
pf59
pf5a
pf5b
pf5c
pf5d
pf5e
pf5f
pf60
pf61
pf62
pf63
pf64

Pré-visualização parcial do texto

Baixe Information Theory, Inference, and Learning Algorithms e outras Notas de estudo em PDF para Física, somente na Docsity!

You can buy this book for 30 pounds or $50. See http://www.inference.phy.cam.ac.uk/mackay/itila/ for links.

Information Theory, Inference, and Learning Algorithms

David J.C. MacKay

You can buy this book for 30 pounds or $50. See http://www.inference.phy.cam.ac.uk/mackay/itila/ for links.

Information Theory,

Inference,

and Learning Algorithms

David J.C. MacKay

[email protected]

©^ c1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002, 2003, 2004, 2005 ©cCambridge University Press 2003

Version 7.2 (fourth printing) March 28, 2005

Please send feedback on this book via http://www.inference.phy.cam.ac.uk/mackay/itila/

Version 6.0 of this book was published by C.U.P. in September 2003. It will remain viewable on-screen on the above website, in postscript, djvu, and pdf formats.

In the second printing (version 6.6) minor typos were corrected, and the book design was slightly altered to modify the placement of section numbers.

In the third printing (version 7.0) minor typos were corrected, and chapter 8 was renamed ‘Dependent random variables’ (instead of ‘Correlated’).

In the fourth printing (version 7.2) minor typos were corrected.

(C.U.P. replace this page with their own page ii.)

  • 1 Introduction to Information Theory Preface v
  • 2 Probability, Entropy, and Inference
  • 3 More about Inference
  • I Data Compression
    • 4 The Source Coding Theorem
    • 5 Symbol Codes
    • 6 Stream Codes
    • 7 Codes for Integers
  • II Noisy-Channel Coding
    • 8 Dependent Random Variables
    • 9 Communication over a Noisy Channel
    • 10 The Noisy-Channel Coding Theorem
    • 11 Error-Correcting Codes and Real Channels
  • III Further Topics in Information Theory
    • 12 Hash Codes: Codes for Efficient Information Retrieval
    • 13 Binary Codes
    • 14 Very Good Linear Codes Exist
    • 15 Further Exercises on Information Theory
    • 16 Message Passing
    • 17 Communication over Constrained Noiseless Channels
    • 18 Crosswords and Codebreaking
    • 19 Why have Sex? Information Acquisition and Evolution
  • IV Probabilities and Inference
    • 20 An Example Inference Task: Clustering
    • 21 Exact Inference by Complete Enumeration
    • 22 Maximum Likelihood and Clustering
    • 23 Useful Probability Distributions
    • 24 Exact Marginalization
    • 25 Exact Marginalization in Trellises
    • 26 Exact Marginalization in Graphs
    • 27 Laplace’s Method
    • 28 Model Comparison and Occam’s Razor You can buy this book for 30 pounds or $50. See http://www.inference.phy.cam.ac.uk/mackay/itila/ for links.
    • 29 Monte Carlo Methods
    • 30 Efficient Monte Carlo Methods
    • 31 Ising Models
    • 32 Exact Monte Carlo Sampling
    • 33 Variational Methods
      • elling 34 Independent Component Analysis and Latent Variable Mod-
    • 35 Random Inference Topics
    • 36 Decision Theory
    • 37 Bayesian Inference and Sampling Theory
  • V Neural networks
    • 38 Introduction to Neural Networks
    • 39 The Single Neuron as a Classifier
    • 40 Capacity of a Single Neuron
    • 41 Learning as Inference
    • 42 Hopfield Networks
    • 43 Boltzmann Machines
    • 44 Supervised Learning in Multilayer Networks
    • 45 Gaussian Processes
    • 46 Deconvolution
  • VI Sparse Graph Codes
    • 47 Low-Density Parity-Check Codes
    • 48 Convolutional Codes and Turbo Codes
    • 49 Repeat–Accumulate Codes
    • 50 Digital Fountain Codes
  • VII Appendices
    • A Notation
    • B Some Physics
    • C Some Mathematics
    • Bibliography
    • Index

You can buy this book for 30 pounds or $50. See http://www.inference.phy.cam.ac.uk/mackay/itila/ for links.

Preface

This book is aimed at senior undergraduates and graduate students in Engi- neering, Science, Mathematics, and Computing. It expects familiarity with calculus, probability theory, and linear algebra as taught in a first- or second- year undergraduate course on mathematics for scientists and engineers. Conventional courses on information theory cover not only the beauti- ful theoretical ideas of Shannon, but also practical solutions to communica- tion problems. This book goes further, bringing in Bayesian data modelling, Monte Carlo methods, variational methods, clustering algorithms, and neural networks. Why unify information theory and machine learning? Because they are two sides of the same coin. In the 1960s, a single field, cybernetics, was populated by information theorists, computer scientists, and neuroscientists, all studying common problems. Information theory and machine learning still belong together. Brains are the ultimate compression and communication systems. And the state-of-the-art algorithms for both data compression and error-correcting codes use the same tools as machine learning.

How to use this book

The essential dependencies between chapters are indicated in the figure on the next page. An arrow from one chapter to another indicates that the second chapter requires some of the first. Within Parts I, II, IV, and V of this book, chapters on advanced or optional topics are towards the end. All chapters of Part III are optional on a first reading, except perhaps for Chapter 16 (Message Passing). The same system sometimes applies within a chapter: the final sections of- ten deal with advanced topics that can be skipped on a first reading. For exam- ple in two key chapters – Chapter 4 (The Source Coding Theorem) and Chap- ter 10 (The Noisy-Channel Coding Theorem) – the first-time reader should detour at section 4.5 and section 10.4 respectively. Pages vii–x show a few ways to use this book. First, I give the roadmap for a course that I teach in Cambridge: ‘Information theory, pattern recognition, and neural networks’. The book is also intended as a textbook for traditional courses in information theory. The second roadmap shows the chapters for an introductory information theory course and the third for a course aimed at an understanding of state-of-the-art error-correcting codes. The fourth roadmap shows how to use the text in a conventional course on machine learning.

v

You can buy this book for 30 pounds or $50. See http://www.inference.phy.cam.ac.uk/mackay/itila/ for links.

Preface vii

1 Introduction to Information Theory

2 Probability, Entropy, and Inference

3 More about Inference

I Data Compression

4 The Source Coding Theorem 5 Symbol Codes 6 Stream Codes 7 Codes for Integers

II Noisy-Channel Coding

8 Dependent Random Variables 9 Communication over a Noisy Channel 10 The Noisy-Channel Coding Theorem 11 Error-Correcting Codes and Real Channels

III Further Topics in Information Theory

12 Hash Codes 13 Binary Codes 14 Very Good Linear Codes Exist 15 Further Exercises on Information Theory 16 Message Passing 17 Constrained Noiseless Channels 18 Crosswords and Codebreaking 19 Why have Sex?

IV Probabilities and Inference

20 An Example Inference Task: Clustering 21 Exact Inference by Complete Enumeration 22 Maximum Likelihood and Clustering 23 Useful Probability Distributions 24 Exact Marginalization 25 Exact Marginalization in Trellises 26 Exact Marginalization in Graphs 27 Laplace’s Method 28 Model Comparison and Occam’s Razor 29 Monte Carlo Methods 30 Efficient Monte Carlo Methods 31 Ising Models 32 Exact Monte Carlo Sampling 33 Variational Methods 34 Independent Component Analysis 35 Random Inference Topics 36 Decision Theory 37 Bayesian Inference and Sampling Theory

V Neural networks

38 Introduction to Neural Networks 39 The Single Neuron as a Classifier 40 Capacity of a Single Neuron 41 Learning as Inference 42 Hopfield Networks 43 Boltzmann Machines 44 Supervised Learning in Multilayer Networks 45 Gaussian Processes 46 Deconvolution

VI Sparse Graph Codes

47 Low-Density Parity-Check Codes 48 Convolutional Codes and Turbo Codes 49 Repeat–Accumulate Codes 50 Digital Fountain Codes

1 Introduction to Information Theory 2 Probability, Entropy, and Inference 3 More about Inference

4 The Source Coding Theorem 5 Symbol Codes 6 Stream Codes

8 Dependent Random Variables 9 Communication over a Noisy Channel 10 The Noisy-Channel Coding Theorem 11 Error-Correcting Codes and Real Channels

20 An Example Inference Task: Clustering 21 Exact Inference by Complete Enumeration 22 Maximum Likelihood and Clustering

24 Exact Marginalization

27 Laplace’s Method

29 Monte Carlo Methods 30 Efficient Monte Carlo Methods 31 Ising Models 32 Exact Monte Carlo Sampling 33 Variational Methods

38 Introduction to Neural Networks 39 The Single Neuron as a Classifier 40 Capacity of a Single Neuron 41 Learning as Inference 42 Hopfield Networks

47 Low-Density Parity-Check Codes

My Cambridge Course on, Information Theory, Pattern Recognition, and Neural Networks

You can buy this book for 30 pounds or $50. See http://www.inference.phy.cam.ac.uk/mackay/itila/ for links.

viii Preface

1 Introduction to Information Theory 2 Probability, Entropy, and Inference 3 More about Inference

I Data Compression

4 The Source Coding Theorem 5 Symbol Codes 6 Stream Codes 7 Codes for Integers

II Noisy-Channel Coding

8 Dependent Random Variables 9 Communication over a Noisy Channel 10 The Noisy-Channel Coding Theorem 11 Error-Correcting Codes and Real Channels

III Further Topics in Information Theory

12 Hash Codes 13 Binary Codes 14 Very Good Linear Codes Exist 15 Further Exercises on Information Theory 16 Message Passing 17 Constrained Noiseless Channels 18 Crosswords and Codebreaking 19 Why have Sex?

IV Probabilities and Inference

20 An Example Inference Task: Clustering 21 Exact Inference by Complete Enumeration 22 Maximum Likelihood and Clustering 23 Useful Probability Distributions 24 Exact Marginalization 25 Exact Marginalization in Trellises 26 Exact Marginalization in Graphs 27 Laplace’s Method 28 Model Comparison and Occam’s Razor 29 Monte Carlo Methods 30 Efficient Monte Carlo Methods 31 Ising Models 32 Exact Monte Carlo Sampling 33 Variational Methods 34 Independent Component Analysis 35 Random Inference Topics 36 Decision Theory 37 Bayesian Inference and Sampling Theory

V Neural networks

38 Introduction to Neural Networks 39 The Single Neuron as a Classifier 40 Capacity of a Single Neuron 41 Learning as Inference 42 Hopfield Networks 43 Boltzmann Machines 44 Supervised Learning in Multilayer Networks 45 Gaussian Processes 46 Deconvolution

VI Sparse Graph Codes

47 Low-Density Parity-Check Codes 48 Convolutional Codes and Turbo Codes 49 Repeat–Accumulate Codes 50 Digital Fountain Codes

1 Introduction to Information Theory 2 Probability, Entropy, and Inference

4 The Source Coding Theorem 5 Symbol Codes 6 Stream Codes

8 Dependent Random Variables 9 Communication over a Noisy Channel 10 The Noisy-Channel Coding Theorem

Short Course on Information Theory

You can buy this book for 30 pounds or $50. See http://www.inference.phy.cam.ac.uk/mackay/itila/ for links.

x Preface

1 Introduction to Information Theory 2 Probability, Entropy, and Inference 3 More about Inference

I Data Compression

4 The Source Coding Theorem 5 Symbol Codes 6 Stream Codes 7 Codes for Integers

II Noisy-Channel Coding

8 Dependent Random Variables 9 Communication over a Noisy Channel 10 The Noisy-Channel Coding Theorem 11 Error-Correcting Codes and Real Channels

III Further Topics in Information Theory

12 Hash Codes 13 Binary Codes 14 Very Good Linear Codes Exist 15 Further Exercises on Information Theory 16 Message Passing 17 Constrained Noiseless Channels 18 Crosswords and Codebreaking 19 Why have Sex?

IV Probabilities and Inference

20 An Example Inference Task: Clustering 21 Exact Inference by Complete Enumeration 22 Maximum Likelihood and Clustering 23 Useful Probability Distributions 24 Exact Marginalization 25 Exact Marginalization in Trellises 26 Exact Marginalization in Graphs 27 Laplace’s Method 28 Model Comparison and Occam’s Razor 29 Monte Carlo Methods 30 Efficient Monte Carlo Methods 31 Ising Models 32 Exact Monte Carlo Sampling 33 Variational Methods 34 Independent Component Analysis 35 Random Inference Topics 36 Decision Theory 37 Bayesian Inference and Sampling Theory

V Neural networks

38 Introduction to Neural Networks 39 The Single Neuron as a Classifier 40 Capacity of a Single Neuron 41 Learning as Inference 42 Hopfield Networks 43 Boltzmann Machines 44 Supervised Learning in Multilayer Networks 45 Gaussian Processes 46 Deconvolution

VI Sparse Graph Codes

47 Low-Density Parity-Check Codes 48 Convolutional Codes and Turbo Codes 49 Repeat–Accumulate Codes 50 Digital Fountain Codes

2 Probability, Entropy, and Inference 3 More about Inference

20 An Example Inference Task: Clustering 21 Exact Inference by Complete Enumeration 22 Maximum Likelihood and Clustering

24 Exact Marginalization

27 Laplace’s Method 28 Model Comparison and Occam’s Razor 29 Monte Carlo Methods 30 Efficient Monte Carlo Methods 31 Ising Models 32 Exact Monte Carlo Sampling 33 Variational Methods 34 Independent Component Analysis

38 Introduction to Neural Networks 39 The Single Neuron as a Classifier 40 Capacity of a Single Neuron 41 Learning as Inference 42 Hopfield Networks 43 Boltzmann Machines 44 Supervised Learning in Multilayer Networks 45 Gaussian Processes

A Course on Bayesian Inference and Machine Learning

You can buy this book for 30 pounds or $50. See http://www.inference.phy.cam.ac.uk/mackay/itila/ for links.

Preface xi

About the exercises

You can understand a subject only by creating it for yourself. The exercises play an essential role in this book. For guidance, each has a rating (similar to that used by Knuth (1968)) from 1 to 5 to indicate its difficulty. In addition, exercises that are especially recommended are marked by a marginal encouraging rat. Some exercises that require the use of a computer are marked with a C. Answers to many exercises are provided. Use them wisely. Where a solu- tion is provided, this is indicated by including its page number alongside the difficulty rating. Solutions to many of the other exercises will be supplied to instructors using this book in their teaching; please email [email protected].

Summary of codes for exercises

Especially recommended

. Recommended C Parts require a computer [p. 42] Solution provided on page 42

[ 1 ] Simple (one minute) [ 2 ] Medium (quarter hour) [ 3 ] Moderately hard [ 4 ] Hard [ 5 ] Research project

Internet resources

The website

http://www.inference.phy.cam.ac.uk/mackay/itila

contains several resources:

  1. Software. Teaching software that I use in lectures, interactive software, and research software, written in perl, octave, tcl, C, and gnuplot. Also some animations.
  2. Corrections to the book. Thank you in advance for emailing these!
  3. This book. The book is provided in postscript, pdf, and djvu formats for on-screen viewing. The same copyright restrictions apply as to a normal book.

About this edition

This is the fourth printing of the first edition. In the second printing, the design of the book was altered slightly. Page-numbering generally remained unchanged, except in chapters 1, 6, and 28, where a few paragraphs, figures, and equations moved around. All equation, section, and exercise numbers were unchanged. In the third printing, chapter 8 was renamed ‘Dependent Random Variables’, instead of ‘Correlated’, which was sloppy.

You can buy this book for 30 pounds or $50. See http://www.inference.phy.cam.ac.uk/mackay/itila/ for links.

About Chapter 1

In the first chapter, you will need to be familiar with the binomial distribution. And to solve the exercises in the text – which I urge you to do – you will need to know Stirling’s approximation for the factorial function, x! ' xx^ e−x, and be able to apply it to

(N

r

= (^) (N −Nr^ !)! r!. These topics are reviewed below. Unfamiliar notation? See Appendix A, p.598.

The binomial distribution

Example 1.1. A bent coin has probability f of coming up heads. The coin is tossed N times. What is the probability distribution of the number of heads, r? What are the mean and variance of r?

0

0 1 2 3 4 5 6 7 8 9 10 r

Figure 1.1. The binomial distribution P (r | f = 0. 3 , N = 10).

Solution. The number of heads has a binomial distribution.

P (r | f, N ) =

N

r

f r(1 − f )N^ −r. (1.1)

The mean, E[r], and variance, var[r], of this distribution are defined by

E[r] ≡

∑^ N

r=

P (r | f, N ) r (1.2)

var[r] ≡ E

[

(r − E[r])^2

]

= E[r^2 ] − (E[r])^2 =

∑^ N

r=

P (r | f, N )r^2 − (E[r])^2. (1.4)

Rather than evaluating the sums over r in (1.2) and (1.4) directly, it is easiest to obtain the mean and variance by noting that r is the sum of N independent random variables, namely, the number of heads in the first toss (which is either zero or one), the number of heads in the second toss, and so forth. In general,

E[x + y] = E[x] + E[y] for any random variables x and y; var[x + y] = var[x] + var[y] if x and y are independent.

So the mean of r is the sum of the means of those random variables, and the variance of r is the sum of their variances. The mean number of heads in a single toss is f × 1 + (1 − f ) × 0 = f , and the variance of the number of heads in a single toss is [ f × 12 + (1 − f ) × 02

]

− f 2 = f − f 2 = f (1 − f ), (1.6)

so the mean and variance of r are:

E[r] = N f and var[r] = N f (1 − f ). 2 (1.7)

You can buy this book for 30 pounds or $50. See http://www.inference.phy.cam.ac.uk/mackay/itila/ for links.

2 About Chapter 1

Approximating x! and

(N

r

0

0 5 10 15 20 25 r

Figure 1.2. The Poisson distribution P (r | λ = 15).

Let’s derive Stirling’s approximation by an unconventional route. We start from the Poisson distribution with mean λ,

P (r | λ) = e−λ^

λr r!

r ∈ { 0 , 1 , 2 ,.. .}. (1.8)

For large λ, this distribution is well approximated – at least in the vicinity of r ' λ – by a Gaussian distribution with mean λ and variance λ:

e−λ^ λr r!

2 πλ

e−^

(r−λ)^2 2 λ (^). (1.9)

Let’s plug r = λ into this formula, then rearrange it.

e−λ^

λλ λ!

2 πλ

⇒ λ! ' λλ^ e−λ

2 πλ. (1.11)

This is Stirling’s approximation for the factorial function.

x! ' xx^ e−x

2 πx ⇔ ln x! ' x ln x − x + 12 ln 2πx. (1.12)

We have derived not only the leading order behaviour, x! ' xx^ e−x, but also, at no cost, the next-order correction term

2 πx. We now apply Stirling’s approximation to ln

(N

r

ln

N

r

≡ ln

N!

(N − r)! r!

' (N − r) ln

N

N − r

  • r ln

N

r

Since all the terms in this equation are logarithms, this result can be rewritten in any base. We will denote natural logarithms (loge) by ‘ln’, and logarithms Recall that log 2 x = loge x loge 2 .

Note that ∂ log 2 x ∂x = 1 loge 2

1 x .

to base 2 (log 2 ) by ‘log’. If we introduce the binary entropy function,

H 2 (x) ≡ x log

x

  • (1−x) log

(1−x)

then we can rewrite the approximation (1.13) as H 2 (x)

0

1

0 0.2 0.4 0.6 0.8 (^1) x

Figure 1.3. The binary entropy function.

log

N

r

' N H 2 (r/N ), (1.15)

or, equivalently, (^) ( N r

' 2 N H^2 (r/N^ ). (1.16)

If we need a more accurate approximation, we can include terms of the next order from Stirling’s approximation (1.12):

log

N

r

' N H 2 (r/N ) − 12 log

[

2 πN

N −r N

r N

]

You can buy this book for 30 pounds or $50. See http://www.inference.phy.cam.ac.uk/mackay/itila/ for links.

4 1 — Introduction to Information Theory

transmitted message. We would prefer to have a communication channel for which this probability was zero – or so close to zero that for practical purposes it is indistinguishable from zero. Let’s consider a noisy disk drive that transmits each bit correctly with probability (1−f ) and incorrectly with probability f. This model communi- cation channel is known as the binary symmetric channel (figure 1.4).

x

@@R 1

y P^ (y^ = 0^ |^ x^ = 0)^ =^1 −^ f^ ; P (y = 1 | x = 0) = f ;

P (y = 0 | x = 1) = f ; P (y = 1 | x = 1) = 1 − f.

Figure 1.4. The binary symmetric channel. The transmitted symbol is x and the received symbol y. The noise level, the probability that a bit is flipped, is f.

(1 − f )

(1 − f )

f

@@ @@R 1

Figure 1.5. A binary data sequence of length 10 000 transmitted over a binary symmetric channel with noise level f = 0.1. [Dilbert image Copyright c©1997 United Feature Syndicate, Inc., used with permission.]

As an example, let’s imagine that f = 0.1, that is, ten per cent of the bits are flipped (figure 1.5). A useful disk drive would flip no bits at all in its entire lifetime. If we expect to read and write a gigabyte per day for ten years, we require a bit error probability of the order of 10−^15 , or smaller. There are two approaches to this goal.

The physical solution

The physical solution is to improve the physical characteristics of the commu- nication channel to reduce its error probability. We could improve our disk drive by

  1. using more reliable components in its circuitry;
  2. evacuating the air from the disk enclosure so as to eliminate the turbu- lence that perturbs the reading head from the track;
  3. using a larger magnetic patch to represent each bit; or
  4. using higher-power signals or cooling the circuitry in order to reduce thermal noise.

These physical modifications typically increase the cost of the communication channel.

The ‘system’ solution

Information theory and coding theory offer an alternative (and much more ex- citing) approach: we accept the given noisy channel as it is and add communi- cation systems to it so that we can detect and correct the errors introduced by the channel. As shown in figure 1.6, we add an encoder before the channel and a decoder after it. The encoder encodes the source message s into a transmit- ted message t, adding redundancy to the original message in some way. The channel adds noise to the transmitted message, yielding a received message r. The decoder uses the known redundancy introduced by the encoding system to infer both the original signal s and the added noise.

You can buy this book for 30 pounds or $50. See http://www.inference.phy.cam.ac.uk/mackay/itila/ for links.

1.2: Error-correcting codes for the binary symmetric channel 5

Noisy channel

Encoder Decoder

Source

t

s

r

ˆs

6

6 ?

Figure 1.6. The ‘system’ solution for achieving reliable communication over a noisy channel. The encoding system introduces systematic redundancy into the transmitted vector t. The decoding system uses this known redundancy to deduce from the received vector r both the original source vector and the noise introduced by the channel.

Whereas physical solutions give incremental channel improvements only at an ever-increasing cost, system solutions can turn noisy channels into reliable communication channels with the only cost being a computational requirement at the encoder and decoder. Information theory is concerned with the theoretical limitations and po- tentials of such systems. ‘What is the best error-correcting performance we could achieve?’ Coding theory is concerned with the creation of practical encoding and decoding systems.

1.2 Error-correcting codes for the binary symmetric channel

We now consider examples of encoding and decoding systems. What is the simplest way to add useful redundancy to a transmission? [To make the rules of the game clear: we want to be able to detect and correct errors; and re- transmission is not an option. We get only one chance to encode, transmit, and decode.]

Repetition codes

A straightforward idea is to repeat every bit of the message a prearranged number of times – for example, three times, as shown in table 1.7. We call this repetition code ‘R 3 ’.

Source Transmitted sequence sequence s t 0 000 1 111

Table 1.7. The repetition code R 3.

Imagine that we transmit the source message

s = 0 0 1 0 1 1 0

over a binary symmetric channel with noise level f = 0.1 using this repetition code. We can describe the channel as ‘adding’ a sparse noise vector n to the transmitted vector – adding in modulo 2 arithmetic, i.e., the binary algebra in which 1 + 1 = 0. A possible noise vector n and received vector r = t + n are shown in figure 1.8.

s 0 0 1 0 1 1 0 t

n 0 0 0 0 0 1 0 0 0 0 0 0 1 0 1 0 0 0 0 0 0 r 0 0 0 0 0 1 1 1 1 0 0 0 0 1 0 1 1 1 0 0 0

Figure 1.8. An example transmission using R 3.

How should we decode this received vector? The optimal algorithm looks at the received bits three at a time and takes a majority vote (algorithm 1.9).

You can buy this book for 30 pounds or $50. See http://www.inference.phy.cam.ac.uk/mackay/itila/ for links.

1.2: Error-correcting codes for the binary symmetric channel 7

Thus the majority-vote decoder shown in algorithm 1.9 is the optimal decoder if we assume that the channel is a binary symmetric channel and that the two possible source messages 0 and 1 have equal prior probability.

We now apply the majority vote decoder to the received vector of figure 1.8. The first three received bits are all 0 , so we decode this triplet as a 0. In the second triplet of figure 1.8, there are two 0 s and one 1 , so we decode this triplet as a 0 – which in this case corrects the error. Not all errors are corrected, however. If we are unlucky and two errors fall in a single block, as in the fifth triplet of figure 1.8, then the decoding rule gets the wrong answer, as shown in figure 1.10.

s 0 0 1 0 1 1 0 t

n 0 0 0 0 0 1 0 0 0 0 0 0 1 0 1 0 0 0 0 0 0 r 0 0 0︸︷︷︸ 0 0 1︸︷︷︸ 1 1 1︸︷︷︸ 0 0 0︸︷︷︸ 0 1 0︸︷︷︸ 1 1 1︸︷︷︸ 0 0 0︸︷︷︸ ˆs 0 0 1 0 0 1 0 corrected errors? undetected errors?

Figure 1.10. Decoding the received vector from figure 1.8.

Exercise 1.2.[2,^ p.16]^ Show that the error probability is reduced by the use of The exercise’s rating, e.g.‘[ 2 ]’, indicates its difficulty: ‘1’ exercises are the easiest. Exercises that are accompanied by a marginal rat are especially recommended. If a solution or partial solution is provided, the page is indicated after the difficulty rating; for example, this exercise’s solution is on page 16.

R 3 by computing the error probability of this code for a binary symmetric channel with noise level f.

The error probability is dominated by the probability that two bits in a block of three are flipped, which scales as f 2. In the case of the binary symmetric channel with f = 0.1, the R 3 code has a probability of error, after decoding, of pb ' 0 .03 per bit. Figure 1.11 shows the result of transmitting a binary image over a binary symmetric channel using the repetition code.

s

encoder t channel

f = 10%

r decoder

ˆs

Figure 1.11. Transmitting 10 000 source bits over a binary symmetric channel with f = 10% using a repetition code and the majority vote decoding algorithm. The probability of decoded bit error has fallen to about 3%; the rate has fallen to 1/3.

You can buy this book for 30 pounds or $50. See http://www.inference.phy.cam.ac.uk/mackay/itila/ for links.

8 1 — Introduction to Information Theory

0

0 0.2 0.4 0.6 0.8 1 Rate

R5 more useful codes

R

R

R

pb

1e-

1e-

1e- 0 0.2 0.4 0.6 0.8 1 Rate

more useful codes

R R

R

R

Figure 1.12. Error probability pb versus rate for repetition codes over a binary symmetric channel with f = 0.1. The right-hand figure shows pb on a logarithmic scale. We would like the rate to be large and pb to be small.

The repetition code R 3 has therefore reduced the probability of error, as desired. Yet we have lost something: our rate of information transfer has fallen by a factor of three. So if we use a repetition code to communicate data over a telephone line, it will reduce the error frequency, but it will also reduce our communication rate. We will have to pay three times as much for each phone call. Similarly, we would need three of the original noisy gigabyte disk drives in order to create a one-gigabyte disk drive with pb = 0.03. Can we push the error probability lower, to the values required for a sell- able disk drive – 10−^15? We could achieve lower error probabilities by using repetition codes with more repetitions.

Exercise 1.3.[3,^ p.16]^ (a) Show that the probability of error of RN , the repe- tition code with N repetitions, is

pb =

∑^ N

n=(N +1)/ 2

N

n

f n(1 − f )N^ −n, (1.24)

for odd N. (b) Assuming f = 0.1, which of the terms in this sum is the biggest? How much bigger is it than the second-biggest term? (c) Use Stirling’s approximation (p.2) to approximate the

(N

n

in the largest term, and find, approximately, the probability of error of the repetition code with N repetitions. (d) Assuming f = 0.1, find how many repetitions are required to get the probability of error down to 10−^15. [Answer: about 60.]

So to build a single gigabyte disk drive with the required reliability from noisy gigabyte drives with f = 0.1, we would need sixty of the noisy disk drives. The tradeoff between error probability and rate for repetition codes is shown in figure 1.12.

Block codes – the (7, 4) Hamming code

We would like to communicate with tiny probability of error and at a substan- tial rate. Can we improve on repetition codes? What if we add redundancy to blocks of data instead of encoding one bit at a time? We now study a simple block code.