NLP with Probabilistic models - C2_W2_Assignment

For “def create_transition_matrix(alpha, tag_counts, transition_counts)”, why is to get the count of the previous tag from tag_counts at index position i? why not “i -1”? thanks

Hi @AndrewS

If your first for loop (each row of the transition matrix A) is bounded as for i in range(num_tags): then you could easily see that the first value i gets is 0 and if you would try to index “i-1” you would get something you don’t want to.

On the other hand if your first for loop is in range(1, num_tags+1), then the case is different and you would index with “i-1”

2 Likes