C2W2 Viterbi algorithm Accuracy is 0.9528 and expected is 0.9531

Hello, for Viterbi algorithm, I am getting accuracy of 0.9528 whereas expected in 0.9531. Any ideas why?

Hi @VibhavGarg

Check this thread and see if that is your problem too (Exercise 7).

Hi @arvyzukai , The other tests all passed. I had a problem with the for loop index, i fixed that

Not sure what the issue is, the autograder passed all tests. Thanks

@VibhavGarg , have you passed all the tests but not sure what the problem was?

@arvyzukai yes

Same error here. No clue on what the issue is. All other tests passed except accuracy.
I see for loop is already provided. Any help is appreciated:

Tried to see debug with print() statements. But, no luck.

@Deepti_Prasad - tagged from other thread.

yo can DM the code screenshot. click on my name and then message. I am suspecting one of the key function might be used incorrectly

@awebdesigner09

  1. Issue in viterbi forward

For code line


#Calculate the probability = 
# best probs of POS tag k, previous word i-1 +  
# log(prob of transition from POS k to POS j) + 
# log(prob that emission of POS j is word i)
                

previous POS tag mentioned in one of the iteration as a list but incorrectly, make sure j is is written as [j]

  1. Issue in viterbi backward

For code line


## Step 2 ##
# Find the best POS tags by walking backward through the best_paths
# From the last word in the corpus to the 0th word in the corpus

z is the unique ID which will get you the best pos tag for position i in the corpus,so it should be z[i]

Your compute accuracy code is correct.

Regards
DP

1 Like

Thanks for the response. Are you referring to Viterbi forward or backward methods?

My comments mentions both grade cells, so yes. Try to read responses with carefully line by line, it mentions both.

1 Like

Thanks for your response. I tried to figure out, unfortunately I did understood/found issue you pointed out for ‘forward’.

And, I have corrected backward by using z[i] as suggested. That matched accuracy and solved the issue.

Thank you so much.

1 Like