C5w2: emojify -grader calls out error -code passes

Grader reports this error:
Cell #14. Can’t compile the student’s code. Error: KeyError(‘never’,)

However, In Cell 14, when I run the code, it passes. Is grader running different enviroment version? This is what I see in notebook:

cell 14:
print(“Training set:”)
pred_train = predict(X_train, Y_train, W, b, word_to_vec_map)
print(‘Test set:’)
pred_test = predict(X_test, Y_test, W, b, word_to_vec_map)

Training set:
Accuracy: 0.9772727272727273
Test set:
Accuracy: 0.8571428571428571

The KeyError message typically means you are using the wrong dictionary somewhere.

Search the forum for KeyError and you will find other suggestions for this issue.

Thank you - found a trove of info! … moving on to the next bug - section 22, same error, but for ‘funny’
sounds like the same dictionary problem.

Hope it is OK to resume discussion here - am fumbling getting to 0 bugs, I’m afraid as I do not understand the error messages relative to the problem at hand.

UNC 2:

23     assert np.allclose(pred.transpose(), Y), "Model must give a perfect accuracy"

google says: Raises an AssertionError if two objects are not equal up to desired tolerance.

So, computed tol in pred is likely the problem?

Not sure what to do about it, and am guessing on problem.

thanks for any light on this.

I think there is a pointer to the answer, but I need more info to read what it has to say:

pointer: #predict is defined in emo_utils.py

Googling for it in various Python areas does not turn it up. Looks like emoji utility?


Now running into the ‘funny’ error from cell 22 again, although all compiles clean for me and I am using any_word for avg.

Interesting, that in the mix up of cell numbering that happens all of the time, I now need to differentiate between 12 and 22, as 12 is now numbered ‘22’, and so is the 22 correctly in sequence.

/thank you

The cells numbers are sequential from when you started the kernel. They aren’t permanent index values.

No. The problem is your code doesn’t return the correct results.

Search the Forums, and leave off of Google searches for the answers.