C1_W3 Assignment - Error grading

Passed all the tests for week 3 coding but encountered grading error saying:
Cell #6. Can’t compile the student’s code. Error: UnboundLocalError(“local variable ‘learner_func_answer’ referenced before assignment”,)

How can I fix this?

Hello Yosilia,

can you share screenshot of the error.

Check if you have any of codes in wrong format. your codes are correct but there can be a spelling error, upper case error for cell #6

If you are not able to find. send the cell#6 codes via personal DM. Click on my name and then message.


Hi @Yosilia_Nursakina,

In your Ex 1, for one-hot-encoding of the categories, you are using to_categorical.

The notebook doesn’t know what to_categorical is.

If you pay attention to the hints, it is asking you to use the entire reference path, keras.utils.to_categorical.


Wow thank you very much. I noticed you put a note and changed the code. Thank you very much! It’s been a pleasant learning through DeepLearning.AI…

1 Like