| 
  • If you are citizen of an European Union member nation, you may not use this service unless you are at least 16 years old.

  • You already know Dokkio is an AI-powered assistant to organize & manage your digital files & messages. Very soon, Dokkio will support Outlook as well as One Drive. Check it out today!

View
 

Scribe Notes 4(13 Feb)

Page history last edited by MEI Yuchen 15 years, 1 month ago

Some notations in symbol-by-symbol source coding

Formula: alphabet set

Formula     c(x): the codeword of x, or the bit sequence of x

                   l(x): length of the codeword of x, or the number of bits of the bit sequence

                   Formula: the maximum length among all codewords

                   L: the expected length of codewords. i.e. Formula

                       If there are m symbols in Formula, then Formula

 

Definitions of different classes of code:

1. nonsingular code

    Eevery element in Formula maps into a different codeword string.

    i.e. Formula     Formula

2. uniquely decodabl code

    Different sequences maps into different streams of codewords.

   i.e. Formula     Formula

     (If Formula, then Formula the codeword stream for Formula)

3. Prefix code (a.k.a prefix-free code, instantaneous code)

    No codeword is the prefix of any other code.

Relationship between these classes of code:

slide errorPlugin error: That plugin is not available.

From Text book Cover/Thomas Page106

 

Question in Problem Set 4

Q2

(b)

Formula 

                          Formula    //Formulacan be any sequence consisting of N symbols; Formulais the length of Formula

                          Formula

Compare the two expressions, we find that if i is Formula, then A(i) is the number of source sequences mapping into length-i codeword stream.

The size of length-i codeword stream is Formula(binary case).

By the definition of uniquely decodable code, at most one source sequence is mapped into one codeword stream.

Therefore, no more than Formula source sequences can be mapped into length-i codeword, i.e. Formula

Formula

Take Nth root at both side, we get Formula.

(c)

The inequality we derived in (b) holds for any N.

In order to find the upper bound for the LHS, we need to minimize the RHS.

By simple analysis, the minimum value of RHS, 1, is reached when n is infinity.

So, Formula. The Kraft Inequality holds in this specific case.

Follow the same procedure, we can prove that all uniquely decodable code satisfy the Kraft Inequality.

 

Q3 is basically skipped in class.

Some questions to think about:

Formula. Is H(X) a good lower bound for L? Is it possible to get an equality?

The answers are affirmative. (e.g. fair coin tossing)

Note that this bound is true for any uniquely decodable code.

 

Q4

(a)

Why is it hard to achieve the entropy bound?

Formula

l(i) is always an integer while log(1/p(i)) is usually not a rational number. They are not equal generally.

The easiest way to make logarithm an integer is to use ceiling function.

(b)

Shannon code: choose l(i) such that Formula.

First of all, make sure that Shannon code can be achieved as a prefix code. (By Kraft Inequality)

By direct computation, we get the upper bound for L.  Formula

Consider again the bounds for L, Formula. The gap may be large sometimes.

e.g. Biased coin tossing. Pr(head)=0.99999 and Pr(tail)=0.00001. Then H(X) is nearly 0 and L is 1.

(c)

To improve the performance, we can encode a sequece of symbols instead of one symbol at a time.

Let Formula denote the expected length of codeword stream when source sequence has N symbols.

By (b) Formula

Then, Formula. The gap is reduced to 1/n, which tends to 0 as n tends to infinity.

However, when n is large, the space complexity is quite high.

 

Q5  Concentrate on prefix code

(a)

i)   Can be easily done using proof by contradiction.

     (Be careful with the signs: Formula)

ii)  Consider a code tree.

     Formula and Formula have the longest codewords and they only differ in the last bit, that is equivalent to say,

     the two codewords are siblings(having the same parent node) in the code tree.

     Proof by contradiction:

     Suppose one longest codeword doesn't have a sibling, then we can move it to its parent. (There couldn't be any codeword occupying its parent position originally, since the code is prefix-free.) Therefore, the expected length is shortened and a better code is formed, which contradicts the assumption that the code is the best.

iii)  Greedy algorithm: each time combine the least two probabilities and keep others unchanged

      Illustrated by the following example from text book Cover/Thomas Page119

      slide errorPlugin error: That plugin is not available.

      Let L denote the original expected length and L' denote the expected length after one iteration.

      Formula

           Formula

           Formula

      To minimize L is equivalent to minimize L'.(Formal prove is in the text book)

      The code generated by this algorithm is also the best among all uniquely decodable code. (Why?)

      (Remark: This algorithm is one type of dynamic programming.)

(e)

Huffman code is not adopted in many practical applicaions because the sender has to obtain the statistics information of source file, form the code tree, send the tree before the content of the file can be transmitted.

Comments (0)

You don't have permission to comment on this page.