NEED HELP with C1_W3_Assignment

In the week 3 of Natural Language Processing with Classification and Vector Spaces in the programming assignment for this week I am facing a peculiar problem where even after passing the test cases I am failing the assignment for the below to graded functions -


As yo can see the test cases are passing and the logic is also correct.
image
image
I checked everything tried to redo everything, still the same issue.
Can anyone please help?
Let me know please if more details are needed.

2 Likes

The tests run by the grader maybe different, send me only those 2 functions in private I will check them and see if there are any problems!

1 Like

This is a very common mistake: you are probably directly referencing the global variable word_embeddings from the body of your get_country function, instead of referencing it through the formal parameter embeddings. It works in the notebook, because that’s the value that is actually passed in that one test case. Your code is wrong, because it is not general: it fails when the grader passes a different embeddings dictionary.

Then get_accuracy also fails, because it calls get_country.

Just because you pass one set of tests does not mean your code is completely correct.

3 Likes

Hi Gent,
I have sent you a dm

1 Like

Thanks Paulin,
Your suggestion worked, I see the mistake now.
Many thanks for the help

2 Likes

I think that you solved this problem with Paul’s help! There is nothing wrong in the code you sent me!

1 Like

Thanks, gent for your time!

1 Like

Thank you very much. I wonder how i missed this. Spent hours checking the other functions. Thanks a lot.

1 Like