Docsity

Information Theory and Computer Organization Problem Set - Prof. G. Bishop, Assignments of Computer Architecture and Organization

Toggle sidebar
bg1
Comp 441 โ€“ Spring 2007 - 1 - Problem Set #1
The UNIVERSITY of NORTH CAROLINA at CHAPEL HILL
Comp 411 Computer Organization
Spring 2007
Problem Set #1
Issued Tuesday, 1/16/2007; Due Tuesday, 1/23/2007
Homework Information: Some of the problems are probably too long to be done the night before the
due date, so plan accordingly. Late homework will not be accepted. Feel free to get help from others, but
the work you hand in should be your own.
Problem 1. โ€œMiss Information?โ€
In lecture we learned that information resolves uncertainty, and that information is measured in units of
bits. In order to uniquely identify one of N equally likely alternatives, log2N bits of information must be
communicated. This is equivalent to saying that log2N bits are needed to encode any particular choice. If
we learn a fact that only narrows down a list of possible alternatives to a choice of M candidates (M <
N), we say that weโ€™ve received log2(N/M) bits of information. For example, if we start with 4 equally
likely alternatives, weโ€™ll need 2 bits to provide a unique encoding for each of the 4 alternatives. If we
learn a fact that narrows the number of alternatives down to 2, that fact has conveyed log2(4/2) = 1 bit of
information.
(A) How many bits are required to uniquely encode all playing cards in a standard deck of 52? If you
are told a cardโ€™s suit, how many bits of information are conveyed? If you are told that the same
card is a face card, how many additional bits are conveyed?
(B) How many total bits of information are in a single deck of cards? If all cards with values 2 to 6
inclusive are removed from the deck (all suits), how many total bits are required to encode the
resulting smaller deck? In this smaller deck, how many bits are required to encode the cardโ€™s suit?
Itโ€™s face value (7, 8, 9, 10, J, Q, K, or A)?
Consider the situation when the N alternatives are not equally likely. It still takes log2N bits to encode
any particular choice, but with clever encoding the average number of bits needed to encode a choice
might be smaller. For example, suppose there were three alternatives
(โ€œAโ€, โ€œBโ€, and โ€œCโ€) with the following probabilities of being chosen:
p(โ€œAโ€) = 0.5
p(โ€œBโ€) = 0.3
p(โ€œCโ€) = 0.1
p(โ€œDโ€) = 0.1
We might encode โ€œAโ€ with the string โ€œ0โ€, โ€œBโ€ with โ€œ10โ€, โ€œCโ€ with โ€œ110โ€, and โ€œDโ€ with โ€œ111โ€.
(C) If we record the results of making a sequence of choices by concatenating from left-to-right the bit
strings that encode each choice, what sequence of choices is represented by the bit string
โ€œ0100111110010โ€?
(D) What is the expected length of the bit string that encodes the results of making 1000 choices?
What is the length in the worst case? How do these numbers compare with 1000*log2(4/1)?
pf3

Partial preview of the text

Download Information Theory and Computer Organization Problem Set - Prof. G. Bishop and more Assignments Computer Architecture and Organization in PDF only on Docsity!

The UNIVERSITY of NORTH CAROLINA at CHAPEL HILL

Comp 411 Computer Organization Spring 2007

Problem Set # Issued Tuesday, 1/16/2007; Due Tuesday, 1/23/

Homework Information : Some of the problems are probably too long to be done the night before the due date, so plan accordingly. Late homework will not be accepted. Feel free to get help from others, but the work you hand in should be your own.

Problem 1. โ€œMiss Information?โ€

In lecture we learned that information resolves uncertainty, and that information is measured in units of bits. In order to uniquely identify one of N equally likely alternatives, log 2 N bits of information must be communicated. This is equivalent to saying that log 2 N bits are needed to encode any particular choice. If we learn a fact that only narrows down a list of possible alternatives to a choice of M candidates ( M < N ), we say that weโ€™ve received log 2 ( N/M ) bits of information. For example, if we start with 4 equally likely alternatives, weโ€™ll need 2 bits to provide a unique encoding for each of the 4 alternatives. If we learn a fact that narrows the number of alternatives down to 2, that fact has conveyed log 2 (4/2) = 1 bit of information.

(A) How many bits are required to uniquely encode all playing cards in a standard deck of 52? If you are told a cardโ€™s suit, how many bits of information are conveyed? If you are told that the same card is a face card, how many additional bits are conveyed?

(B) How many total bits of information are in a single deck of cards? If all cards with values 2 to 6 inclusive are removed from the deck (all suits), how many total bits are required to encode the resulting smaller deck? In this smaller deck, how many bits are required to encode the cardโ€™s suit? Itโ€™s face value (7, 8, 9, 10, J, Q, K, or A)?

Consider the situation when the N alternatives are not equally likely. It still takes log 2 N bits to encode any particular choice, but with clever encoding the average number of bits needed to encode a choice might be smaller. For example, suppose there were three alternatives (โ€œAโ€, โ€œBโ€, and โ€œCโ€) with the following probabilities of being chosen:

p(โ€œAโ€) = 0. p(โ€œBโ€) = 0. p(โ€œCโ€) = 0. p(โ€œDโ€) = 0.

We might encode โ€œAโ€ with the string โ€œ0โ€, โ€œBโ€ with โ€œ10โ€, โ€œCโ€ with โ€œ110โ€, and โ€œDโ€ with โ€œ111โ€.

(C) If we record the results of making a sequence of choices by concatenating from left-to-right the bit strings that encode each choice, what sequence of choices is represented by the bit string โ€œ0100111110010โ€?

(D) What is the expected length of the bit string that encodes the results of making 1000 choices? What is the length in the worst case? How do these numbers compare with 1000*log 2 (4/1)?

Intuitively it seems that we get less information when we learn of a likely choice and more information when we learn of an unlikely choice. This intuition is reflected in the following formula for the average number of bits of information (Entropy) received about a choice made from N alternatives when each alternative has a (possibly different) probability pi :

Bits of information = ( i )

N

i

 pi p

=

1

log 2

(E) How much information do you receive, on average, from a single flip of a crooked coin where ptail = 0.375 and phead = 0.625? Is this more or less than the amount of information you receive from the flip of a fair coin?

(F) A data stream is composed of a sequence of three characters, { u , d , s }. What probabilities would you assign to these to maximize the entropy? What probabilities would you assign to minimize the entropy? Assume that the probabilities of u, d, and s are p( u ) = 0.7, p( d ) = 0.2, and p( s ) = 0.1. What is the entropy of this data stream? How close can you come to achieving this number of bits in practice? Suppose, that you assign a unique code to every 2- character combination, { uu, ud, us, du, dd, ds, su, sd, ss }. Devise a variable length code to for this data stream, and compute its entropy (you can assume all data streams are composed of an even number of characters). What is the entropy of this data stream? How close can you come to achieving this number of bits in practice?