C5W1A2-Ex4-getting a wrong answer from the model

Hi, my model in Exercise 4 does the required number of iterations without any error, but gives wrong answers. Here is the debugging output:

j = 0 idx = 0
single_example = aachenosaurus
single_example_chars [‘a’, ‘a’, ‘c’, ‘h’, ‘e’, ‘n’, ‘o’, ‘s’, ‘a’, ‘u’, ‘r’, ‘u’, ‘s’]
single_example_ix [1, 1, 3, 8, 5, 14, 15, 19, 1, 21, 18, 21, 19]
X = [None, 1, 1, 3, 8, 5, 14, 15, 19, 1, 21, 18, 21, 19]
Y = [1, 1, 3, 8, 5, 14, 15, 19, 1, 21, 18, 21, 19, 0]

Here are my final answers:

Iteration: 22000, Loss: 20.578871

Hutusaurus
Euca
Eustrioppn
Hocamptopanceus
Xuspeodon
Elacropechus
Uspeodon

Here is the error message:


AssertionError Traceback (most recent call last)
in
1 parameters, last_name = model(data.split(“\n”), ix_to_char, char_to_ix, 22001, verbose = True)
2
----> 3 assert last_name == ‘Trodonosaurus\n’, “Wrong expected output”
4 print(“\033[92mAll tests passed!”)

The model does indeed generate better suggestions over time as expected, but not the ones given in the notebook. I haven’t meddled with any of the random seeds. I would appreciate any help or suggestions! Thanks!

1 Like

Typically this problem is caused by your code for setting the X and Y variables.

1 Like

I think that’s exactly the answer you get if you use the input data in the order in which it is given, instead of using the “shuffled” version of it that they create for you in the template code.

Here’s another recent thread about that. Notice that student saw Hutusaurus as the first answer in the last batch also. :nerd_face:

1 Like

Thanks @paulinpaloalto - that was it!