Question about pi (initial state distribution) in the Cipher code

Post Reply
leon1209
Posts: 6
Joined: Thu May 28, 2020 3:58 am

Question about pi (initial state distribution) in the Cipher code

Post by leon1209 » Thu May 28, 2020 4:14 am

Hi LazyProgrammer,

Nice to meet you :P . I have a question about the pi variable in your Cipher code.

I tried the code with a simple text. For instance, " I love the cat, the camera, and the Mac."

In this sentence, we have three letter c in total. But in your code dealing with pi variable, i.e., the initial state distribution, it seems that you only count the first letter for every word, namely 2 total c instead of 3. Then the way you compute the probability of c seems to be 2/9 (total number of the words)

My question is that why don't we count all the c appearing in the sentence and divide it by the total letters in this sentence? namely, 3/29 (total number of the letters)

Thanks!

lazyprogrammer
Site Admin
Posts: 37
Joined: Sat Jul 28, 2018 3:46 am

Re: Question about pi (initial state distribution) in the Cipher code

Post by lazyprogrammer » Thu May 28, 2020 4:32 am

Thanks for your question.

The name is a huge hint: initial state distribution.

You should also look at the probability model equation to confirm that it represents the first letter of a word.

Post Reply

Return to “Data Science: Natural Language Processing (NLP) in Python”