C5 W2 A2 - Emojify Sequence Model Grading Problem

I am constantly getting 0/100 for the assignment. I checked my codes several times with a fine tooth comb, I do not see any error . I resubmitted the assignment this evening, again, it showed “All the tests passed”.

But on submission, it grades 0/100 with a message:

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

I have seen other posts with the same problem. I do not know if I am missing something or it has to do with computerized grading system.

Can anyone please suggest the solution. I will very much appreciate assistance.

Thanks

To get replies on the Forum, it is important that you post in an area where the mentors will notice it. The Course forum areas have mentors, the “Resources” area does not.

=================
The “KeyError(…)” is due to a mistake in your code. Usually this means you’re testing for words from the sentence, instead of checking that the words are in the correct dictionary.

I have looked into my code, worked several days, and did not find any mistake. As you suggested that I was testing word from the sentences. I found that was not the case, all testing was from the dictionary word_to_vec_map.

Is there any other mistake that the automated grading can see and I can not figure out because it is masked by
" All tests passed".

I need help to bring it to closure, it is my only remaining assignment in my five DLS courses to clear.

I will appreciate your assistance.

I saw notes in the assignment page stating that assignment was updated this morning(8/16/2021) removing some unnecessary codes and revising other codes. I resubmitted my assignment again this morning, instead of Cell#14 problem, I get a new message regarding :

Cell#12: Cant compile the student’s code. TypeError( unsupported operand types for “Nonetype” and “float”.

UNIT TEST

def model_test(target):

Create a controlled word to vec map

word_to_vec_map = {‘a’: [3, 3], ‘synonym_of_a’: [3, 3], ‘a_nw’: [2, 4], ‘a_s’: [3, 2], ‘a_n’: [3, 4],
‘c’: [-2, 1], ‘c_n’: [-2, 2],‘c_ne’: [-1, 2], ‘c_e’: [-1, 1], ‘c_se’: [-1, 0],
‘c_s’: [-2, 0], ‘c_sw’: [-3, 0], ‘c_w’: [-3, 1], ‘c_nw’: [-3, 2]
}

Convert lists to np.arrays

for key in word_to_vec_map.keys():
word_to_vec_map[key] = np.array(word_to_vec_map[key])

Training set. Sentences composed of a_* words will be of class 0 and sentences composed of c_* words will be of class 1

X = np.asarray([‘a a_s synonym_of_a a_n c_sw’, ‘a a_s a_n c_sw’, ‘a_s a a_n’, ‘synonym_of_a a a_s a_n c_sw’, " a_s a_n",
" a a_s a_n c “, " a_n a c c c_e”,
‘c c_nw c_n c c_ne’, ‘c_e c c_se c_s’, ‘c_nw c a_s c_e c_e’, ‘c_e a_nw c_sw’, ‘c_sw c c_ne c_ne’])

Y = np.asarray([0, 0, 0, 0, 0, 0, 1, 1, 1, 1, 1, 1])

np.random.seed(10)
pred, W, b = model(X, Y, word_to_vec_map, 0.0025, 110)

assert W.shape == (2, 2), “W must be of shape 2 x 2”
assert np.allclose(pred.transpose(), Y), “Model must give a perfect accuracy”
assert np.allclose(b[0], -1 * b[1]), “b should be symmetric in this example”

print("\033[92mAll tests passed!")

model_test(model)

I did not code this cell, it was already included in the assignment. Please suggest solution. Thanks

You have posted your code as Markup. That’s why you have a lot of lines with heading formatting.

Could you post your code using the “preformatted text” tool?

Did you complete the entire notebook before submitting it for grading?
If there is any exercise code you haven’t completed, the grader will crash and give you an error message like the one you posted.

To answer your questions :

  1. Did I complete the entire notebook before submitting ?:

Yes, I completed the assaignments completely, I checked again to ensure that all the cells are completed as required.

  1. Markup the code of Cell #12?

The script of Cel # 12 that I sent you is not coded by me. It is included in the assignment and I just pasted it verbatim in my previous mail to you. I did not include any markup. Here is the code again ( Your copy may have markup extranously included by Outlook):

UNIT TEST

def model_test(target):

Create a controlled word to vec map

word_to_vec_map = {‘a’: [3, 3], ‘synonym_of_a’: [3, 3], ‘a_nw’: [2, 4], ‘a_s’: [3, 2], ‘a_n’: [3, 4],
‘c’: [-2, 1], ‘c_n’: [-2, 2],‘c_ne’: [-1, 2], ‘c_e’: [-1, 1], ‘c_se’: [-1, 0],
‘c_s’: [-2, 0], ‘c_sw’: [-3, 0], ‘c_w’: [-3, 1], ‘c_nw’: [-3, 2]
}

Convert lists to np.arrays

for key in word_to_vec_map.keys():
word_to_vec_map[key] = np.array(word_to_vec_map[key])

Training set. Sentences composed of a_* words will be of class 0 and sentences composed of c_* words will be of class 1

X = np.asarray([‘a a_s synonym_of_a a_n c_sw’, ‘a a_s a_n c_sw’, ‘a_s a a_n’, ‘synonym_of_a a a_s a_n c_sw’, " a_s a_n",
" a a_s a_n c “, " a_n a c c c_e”,
‘c c_nw c_n c c_ne’, ‘c_e c c_se c_s’, ‘c_nw c a_s c_e c_e’, ‘c_e a_nw c_sw’, ‘c_sw c c_ne c_ne’])

Y = np.asarray([0, 0, 0, 0, 0, 0, 1, 1, 1, 1, 1, 1])

np.random.seed(10)
pred, W, b = model(X, Y, word_to_vec_map, 0.0025, 110)

assert W.shape == (2, 2), “W must be of shape 2 x 2”
assert np.allclose(pred.transpose(), Y), “Model must give a perfect accuracy”
assert np.allclose(b[0], -1 * b[1]), “b should be symmetric in this example”

print("\033[92mAll tests passed!")

model_test(model)

You’re still pasting the code as plain text, instead of using the “preformatted text” tag.

Did you save the notebook before you submitted it?

Yes, I have saved the document I submitted.

In case you want to see a copy or a part of submitted assignment, I can send it to you.

This time I will not paste it, I will attach the document.

Please let me know.

Thanks

Mentor note: edited this reply.

Ok. Here is the assignment attached that I submitted.

Please review so that I bring it to closure

Thanks

(Attachment Emojify_last_submitted_on_08162021.docx is missing)

There is no attachment to your message.

Also, you can’t send the assignment as a docx file. It should be the same ipynb file that you downloaded from the notebook file menu.

Also, do you understand how to use the private message feature?

I used my Outlook and attached the jupyter assignment file. I do not understand how it did not get to you. I have never used the private message feature before. I need to know the instruction.

Thanks

Do not use Outlook.

{edited}