Course 2 Week 2 Assignment Viterbi Backward - 3 Tests passed 1 Test failed

True, if you print out pred[-1] after the first and the second loop, you will see that somewhere pred[-1] got overwritten in the second for loop.

I had the same problem. Everything I implemented was correct.
I observed that the pred[-1] was correctly assigned (with “–s–”) in the first loop. But, after the second loop pred[-1] is “#”. I could not find how pred[-1] got overwritten.
This is the problem you also faced.
How I solved it:
store pred[m - 1] in some variable (say temp) and then before returning replace pred[-1] with temp.
It worked.

4 Likes

It seems to me that in the loop of step 2, we cannot double update the last element of z to avoid the error.

1 Like

@Mubsi
please i need you to check Ex7 , i have the same problem
note book id is: pldrnywv

thanks

1 Like

Hi am getting and test failed in Viterbi backward algorithm my lab ID: lbnwniwtrphg

1 Like

Hi @manish_singh,

Your pred[m - 1] is incorrect.

Best,
Mubsi

1 Like

Hi @Mubsi
I have the same issue, I tried changing the range of the second for loop but in both cases, I got the same error for the mismatch of the last character in a particular test case.


My lab id : rpscoyintppy
Please check.

Thanks in advance.

1 Like

Hi @Arunava_Chakraborty,

There are many things wrong with your implementation of the exercise, particularly the ranges you have selected. I’ll DM you with more details.

Best,
Mubsi

1 Like

Hello sir @Mubsi, I am getting same error with my work, I am getting ‘#’ instead of ‘–s–’ . Can you please help me fix it? My lab id is: izslfbkjahyx. Thank you!

1 Like

Hi @Sujan_Kapali1,

Let me DM you regarding this.

1 Like

Hi Sir @Mubsi, I am facing the same issue. Please help me fix it. My lab id is: mnwiiywkprgv

1 Like

Hi @Mubsi,
I am also facing the same issue. Can you please take a look or guide me.
Lab Id: njljosvxdgtc

Thanks

1 Like

Hi @Agrim_Jain,

Other than the mistakes quoted above your:

  • Second for loop has incorrect range and implementation
  • pred[i - 1] is incorrect

Cheers,
Mubsi

1 Like

Hi @Sonu_Chhabra,

Your pred[m - 1], pos_tag_for_word_i, z[i - 1] and pred[i - 1] are incorrect.

Cheers,
Mubsi

1 Like

Sir, It would be really helpful if you could suggest corrections as I am unable to rectify the mistake despite trying many times.

1 Like

Hey @Agrim_Jain,
Can you please DM me your current implementation of the viterbi_backward function, so that I can take a look and try to help you out.

Cheers,
Elemento

I am also facing the same issue. 3 tests passed and 1 test failed

1 Like

{Moderator’s Edit: Please don’t mention Lab ID unless explicitly asked for}

1 Like

Hey @NIKHILM710,
Welcome to the community. As you can see it’s a long thread and many common mistakes have already been discussed regarding the implementation of this function. So, can you please go through them once, and see if either of these help.

Cheers,
Elemento

1 Like

Hi Elemento,
I visited the thread yesterday. But it didn’t helped me to find out error in Viterbi backward function.
{Moderator’s Edit: Please don’t mention Lab ID unless explicitly asked for}

Thanks,
Nkhil

Hey @NIKHILM710,
The mentors don’t have the access to your labs, only Mubsi has that. Can you please DM me the implementation of your viterbi_backward function?

Cheers,
Elemento

1 Like