Difference between revisions of "2S2122 Activity 2.2"
Ryan Antonio (talk | contribs) |
Ryan Antonio (talk | contribs) |
||
Line 1: | Line 1: | ||
== Instructions == | == Instructions == | ||
− | There are two parts to this exercise. | + | There are two parts to this exercise. |
+ | |||
+ | 1. Read through the discussion about information and language. | ||
+ | |||
+ | 2. After understanding the discussion, we'll replicate it so that you can get hands on experience on the analysis. | ||
'''Submission guidelines:''' | '''Submission guidelines:''' |
Revision as of 08:54, 14 February 2022
Instructions
There are two parts to this exercise.
1. Read through the discussion about information and language.
2. After understanding the discussion, we'll replicate it so that you can get hands on experience on the analysis.
Submission guidelines:
- For every programming exercise, you are to submit your .ipynb file into your respective submission bin.
- To download your .ipynb file, first in your Google Colab page go to File > Download > Download .ipynb file.
- Don't forget to rename your .ipynb file with the following format "class_lastname_firstname_studentnumber.ipynb".
Information and Language
One interesting application of recognizing how entropy plays a role in our everyday life is to determine the average information per letter in a language. In this programming exercise, we will explore and try to understand what entropy means for the English language. Before we begin let's set the context of our problem first.
- We'll be characterizing the information content of the English language based only on the frequency of letters.
- We'll expand this problem to a block of letters but get the relative entropy for a single letter only.
- We'll exclude the conditional probabilities for this exercise because that will be more challenging to build.
Let's first begin by defining the word N-block as the number of letters we are combining to represent a single outcome in a random variable . Consider the sentence:
"The quick brown fox jumps over the lazy dog"
When we say we want to get the 1-block, then contains . Of course the elements can be re-arranged in order . The set also contains the space. For now let's consider spaces as an important component in our analysis. The sentence above is known to have all the letters in the alphabet. Remember, a random variable would also have a probability distribution associated with it. We can determine the probability based on the frequency of letters for the entire set. For example, appears times, the letter appears times, the letter appears times and so on. The total number of occurrences of each outcome is . The probability distribution would be:
We expanded the distribution for clarity.