# UNQ_C7 GRADED FUNCTION: viterbi_backward

Hi,
I am getting this error message

IndexError Traceback (most recent call last)
in
1 # Run and test your function
----> 2 pred = viterbi_backward(best_probs, best_paths, prep, states)
3 m=len(pred)
4 print(‘The prediction for pred[-7:m-1] is: \n’, prep[-7:m-1], “\n”, pred[-7:m-1], “\n”)
5 print(‘The prediction for pred[0:8] is: \n’, pred[0:7], “\n”, prep[0:7])

in viterbi_backward(best_probs, best_paths, corpus, states)
57 # and the column representing the word’s position in the corpus
58 # to retrieve the predicted POS for the word at position i-1 in the corpus
—> 59 z[i - 1] = best_paths[pos_tag_for_word_i,i]
60
61 # Get the previous word’s POS tag in string form

IndexError: index -208545 is out of bounds for axis 0 with size 46

Hi @hvjrocks,

Can you share your lab ID with me ? In the assignment, when you click the top right “Help” button, a panel will open and your lab ID will be shown at the bottom.

I shall take a look.

When you reply back, kindly tag me in the post so that I’m notified.

Thanks,
Mubsi