Hi,
Your loop seems to start from 0 and not 1. So, it cannot find the parameter giving you the error.
Try:
range(1,L)
I don’t know the entire code, so it might also be:
range(1,L+1)
Please use the “pencil” icon in the thread title, to move your post to the correct forum area for your class.
You’ve posed in “AI Discussions”, which isn’t useful for questions about specific assignments.
@Atrox, I think it is likely your advice for this question is not correct, if I am right in my guess as to which course this assignment is from.
If this is the Step by Step assignment from DLS C1 W4, then it looks like you have made some unnecessary changes to the template code that they gave you. And also erased and ignored some of the comments in the code they gave you. Here’s what the core of that function looks like in the template:
# Update rule for each parameter. Use a for loop.
#(≈ 2 lines of code)
for l in range(L):
# parameters["W" + str(l+1)] = ...
# parameters["b" + str(l+1)] = ...
# YOUR CODE STARTS HERE
# YOUR CODE ENDS HERE
The loop logic is just given to you and they tell you in the comments how to manage the index values given that indexing is “0 based” in python.
It also looks like you modified the definition of the function. It’s possible to do that and still have things work, but it is unnecessary and is generally not a good idea. If you feel that you need to modify things outside the “YOUR CODE HERE” segments, you need to think carefully and make sure that you understand what is going on before you “go there”.