01.08.2013 Views

Information Theory, Inference, and Learning ... - MAELabs UCSD

Information Theory, Inference, and Learning ... - MAELabs UCSD

Information Theory, Inference, and Learning ... - MAELabs UCSD

SHOW MORE
SHOW LESS

You also want an ePaper? Increase the reach of your titles

YUMPU automatically turns print PDFs into web optimized ePapers that Google loves.

Copyright Cambridge University Press 2003. On-screen viewing permitted. Printing not permitted. http://www.cambridge.org/0521642981<br />

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

114 6 — Stream Codes<br />

symbol given the string thus far. Let these probabilities be:<br />

Context<br />

(sequence thus far) Probability of next symbol<br />

P (a) = 0.425 P (b) = 0.425 P (✷) = 0.15<br />

b P (a | b) = 0.28 P (b | b) = 0.57 P (✷ | b) = 0.15<br />

bb P (a | bb) = 0.21 P (b | bb) = 0.64 P (✷ | bb) = 0.15<br />

bbb P (a | bbb) = 0.17 P (b | bbb) = 0.68 P (✷ | bbb) = 0.15<br />

bbba P (a | bbba) = 0.28 P (b | bbba) = 0.57 P (✷ | bbba) = 0.15<br />

Figure 6.4 shows the corresponding intervals. The interval b is the middle<br />

0.425 of [0, 1). The interval bb is the middle 0.567 of b, <strong>and</strong> so forth.<br />

a<br />

b<br />

✷<br />

ba<br />

bb<br />

b✷<br />

bba<br />

bbb<br />

bbba<br />

bbbb<br />

bbb✷<br />

bb✷<br />

00000<br />

0000<br />

00001<br />

000<br />

00010<br />

0001<br />

00011<br />

00<br />

00100<br />

0010<br />

00101<br />

001<br />

00110<br />

0011<br />

00111<br />

0<br />

01000<br />

0100<br />

01001<br />

010<br />

01010<br />

0101<br />

01011<br />

01<br />

01100<br />

0110<br />

01101<br />

011<br />

01110<br />

0111<br />

01111<br />

10000<br />

✂<br />

1000<br />

10001<br />

✂<br />

100<br />

10010<br />

✂<br />

1001 ✂<br />

10011<br />

10<br />

10100<br />

1010 ❇<br />

10101<br />

❇<br />

101<br />

10110<br />

❇<br />

1011<br />

10111<br />

❇<br />

1<br />

11000<br />

1100<br />

11001<br />

110<br />

11010<br />

1101<br />

11011<br />

11<br />

11100<br />

1110<br />

11101<br />

111<br />

11110<br />

1111<br />

11111<br />

bbba<br />

bbbaa<br />

bbbab<br />

bbba✷<br />

10010111<br />

10011000<br />

10011001<br />

10011010<br />

10011011<br />

10011100<br />

10011101<br />

10011110<br />

❈❈❖ 10011111<br />

❈10100000<br />

❈<br />

100111101<br />

When the first symbol ‘b’ is observed, the encoder knows that the encoded<br />

string will start ‘01’, ‘10’, or ‘11’, but does not know which. The encoder<br />

writes nothing for the time being, <strong>and</strong> examines the next symbol, which is ‘b’.<br />

The interval ‘bb’ lies wholly within interval ‘1’, so the encoder can write the<br />

first bit: ‘1’. The third symbol ‘b’ narrows down the interval a little, but not<br />

quite enough for it to lie wholly within interval ‘10’. Only when the next ‘a’<br />

is read from the source can we transmit some more bits. Interval ‘bbba’ lies<br />

wholly within the interval ‘1001’, so the encoder adds ‘001’ to the ‘1’ it has<br />

written. Finally when the ‘✷’ arrives, we need a procedure for terminating the<br />

encoding. Magnifying the interval ‘bbba✷’ (figure 6.4, right) we note that the<br />

marked interval ‘100111101’ is wholly contained by bbba✷, so the encoding<br />

can be completed by appending ‘11101’.<br />

Figure 6.4. Illustration of the<br />

arithmetic coding process as the<br />

sequence bbba✷ is transmitted.<br />

10011

Hooray! Your file is uploaded and ready to be published.

Saved successfully!

Ooh no, something went wrong!