Week 1 Assignment 2 Ex. 4

Need help – I am on Exercise 4 (model). The code works, the results are not right. The debug info printed out for the first iteration is here – do they look right? If not, what’s wrong? And is my Y correct?

===
j = 0 idx = 1
single_example = pandoravenator
single_example_chars [‘p’, ‘a’, ‘n’, ‘d’, ‘o’, ‘r’, ‘a’, ‘v’, ‘e’, ‘n’, ‘a’, ‘t’, ‘o’, ‘r’]
single_example_ix [16, 1, 14, 4, 15, 18, 1, 22, 5, 14, 1, 20, 15, 18]
X = [None, 16, 1, 14, 4, 15, 18, 1, 22, 5, 14, 1, 20, 15, 18]
Y = [16, 1, 14, 4, 15, 18, 1, 22, 5, 14, 1, 20, 15, 18, 0]

0

Iteration: 0, Loss: 23.097224

Nkzxwtdmfqoeyhsqwasjkjvu
Kneb
Kzxwtdmfqoeyhsqwasjkjvu
Neb
Zxwtdmfqoeyhsqwasjkjvu
Eb
Xwtdmfqoeyhsqwasjkjvu

==

Are you sure that you used the “scrambled” version of the input list that they created for you, as opposed to just using the sorted list that is input to the function?

Actually that output is unexpected. I’m not sure how that could happen, but I think it suggests that there is something fundamentally wrong with how you compute idx. It is supposed to be j modulo the number of entries in the dataset. So if j = 0, then idx = 0 as well.

Please have a careful look at the instructions and that part of your loop logic and see if what I said above sheds any light.

Yeah – I’ve got idx wrong; I thought idx=j+1 , thining it should not start with 0 – but of course that’s wrong. Thansk, paulinpaloalto for your quick response and guidance. Now I get the expected results!!!

2 Likes