Hello All,
I am confused with viterbi forward probability calculation formula.
getting value from matrix A, should be fix row and iterating over column.
However when we implement the formula in calculation it is iterating over rows:
for i ->:
for j ->:
for k ->:
prob = Best_prob + A[k, j] +B
Isn’t A is going row wise? Your clarification is highly appreciated. Thanks
Best,
PS
Hi @peeyush_sahu
If only one single previous tag could be the best, then yes. But any previous tag could be the best and we don’t know which until we check.
I think it’s better to illustrate through the example:
Transition matrix A (log probs):
Best probs:
Best paths:
The strange case is that best probability of word “will” to be emitted by LS tag is not through the best previous tag of “temperature”->NN but as if “temperature” was emitted by “(” tag.
In other words, the best probability for word “will” to be emitted through “LS” tag is through the the “temperature”->“(” (log prob of -37.38) tag and not the “temperature”->NN tag (log prob of -26.44, which is significantly higher > -37.38).
Concrete calculations:
best_log(temperature->“(”) = -37.38
tranistion_log(“(”->LS) = -6.526
emission_log(LS->will) = -10.998
---------------------------
Sum = -54.91
versus:
best_log(temperature->NN) = -26.44
tranistion_log(NN->LS) = -18.705
emission_log(LS->will) = -10.998
---------------------------
Sum = -56.14
This example is not very practical since the actual best probability is that “will” was emitted by MD tag through previous tag of “temperature” being NN tag.
But this example is to illustrate the point that we have to check every previous tag because transition probabilities matter in this type of model (Hidden Markov Model with dynamic programming).
That is why we have:
- i (word index),
- j (current tag)
- k (previous tag)
Cheers