iit-cs585 / assignments

Assignments for IIT CS585
3 stars 7 forks source link

test_hmm_fit_transition in assignment 2 #13

Closed prateekagrawal06 closed 7 years ago

prateekagrawal06 commented 7 years ago

Hi Professor,

In assignment 2, for the function test_hmm_fit_transition. self.assertEqual(0.750, round(model.transition_probas['N']['V'], 3))

total number of N in the tags are 5 and the total number of times V is there given N is 3. Therefore P(V|N) = 3/5 = 0.6 .

But it is given 0.750.

Please correct me if a have understood the problem wrong.

aronwc commented 7 years ago

model.transition_probas['N']['V'] = p(V|N), not p(N|V)

In the example, there are 4 transitions from N to something other than the end of the sentence. 3 of these transition to V. So, 3/4=.75.

Best, Aron

prateekagrawal06 commented 7 years ago

But the total number of N's in the example is 5. According to the formula you taught in the class, it says to counter the number of time N has appeared in the data.

aronwc commented 7 years ago

Yes, there are a few variants of HMMs to consider depending on whether or not we include an "end state" in the model.

In this assignment, we are not including an end state, and so we only need to consider cases where N appears prior to the final word when estimating transition probabilities. Otherwise, P(q|N) would not sum to one across all states q.

prateekagrawal06 commented 7 years ago

Ok Professor, Thanks a lot