Hello all.
I am a new comer here.
For MLS C1_W2_Linear_Regression: Exercise 1, the first programing exercise, I keep getting these error messages. Can anyone help on explaining where i am doing wrong?
NameError Traceback (most recent call last)
in
26
27 # Loop over training examples
—> 28 for i in range(m):
29 # Your code here to get the prediction f_wb for the ith example
30 f_wb = w * x[i] + b
I’m also having trouble with this assignment for MLS C1_W2_Linear_Regression Exercise 2, I’m being asked to compute the gradient but keep on getting errors that says I need to define the X_train.
Whenever this happens, I would first use Chrome’s (or any browser’s) search feature to find where the prompted variable name (x_train here) is defined. That led me to this:
Then, if I run the cell, x_train should be defined - as required.
However, @Samson_O, the best practice is, whenever we start the lab, or restart the lab, we always run from the very first code cell to make sure all variables are defined and are defined in the order the lab expects. If we always keep to this practice, it will become very unlikely to get into error message like that. Give it a try
Btw, as I can see this is your very first post here. While your current post is informative enough, next time, please consider to share a screenshot of the error message (not your code, but just the whole message). It would also be nice if you open a new topic for your own question so that others know they won’t need to go over the whole topic which could be long sometimes. (Again, this one is not long )
I have just encountered a similar issue and tried the search function on Google chrome. This time around my code has been run but the error message is that "prediction has not been defined. I don’t think my code is wrong
I don’t see prediction being used as a variable anywhere in the lab either.
If we are still on exercise 2, then if you go to right beneath the exercise’s code cell, there is this “Click for hints” button that you can click to expand out an answer template provided by this course. There you will see no prediction variable, you won’t need to create new variable names, instead only some lines for you to fill in with variable names already there.
The lecture videos give you the concept. There is an optional lab in Course 1 Week 1 that is related to Gradient descent. We also have the exercise’s description and the “Click for hints” button for a bit more description.
You are welcome, Samson @Samson_O! Btw, I will be away for some time (hours or maybe even days), so if your next reply does not get any response soon enough, opening a new topic will be a good option. That will only increase the exposure of your question. If I am around, I wouldn’t mind to discuss with you here or in a new topic.