This error means

NameError Traceback (most recent call last)
in
23 for i in range(m):
24 # f_wb for the ith example
25 f_wb = w * x[i] + b

NameError: name ‘m’ is not defined

Run all of the cells in sequence every time you open the notebook

Hello!
I am having the same error as well. I have tried completely restarting the kernel and clearing all outputs. I have run the code in the order the cells are written. Nothing I am attempting is working. If you have any other ideas, I would greatly appreciate the help!

is it resolved? If not, not defined usually means…you forgot to assign some number value to a variable which is m here.

Hi!
Apologies for such a delayed response! I still have not been able to resolve this issue, unfortunately. In the code already given in the assignment, m has a value of m = x.shape[0]. However, I do not know where x.shape[0] comes into play, as that is the only time you see ‘m’ or ‘x.shape[0]’ in the code provided. I have tried everything I can think of, including restarting the kernel, I have tried fixing any potential indentation errors, nothing works

Thanks for all your help. i got it fixed

How were you able to fix the error? I have been trying for days and can’t figure it out. If you have any suggestions, I would greatly appreciate it!

The indentation for each line of the code you write must be rectified. Also check that the letter u are using are consistent( capitalization or not).

then run the code from start to end

@Dejah_Reed As suggested by @T_Goldson
indentation is possible cause of error.
So it should be:
Screenshot from 2022-09-18 12-32-19

Run after restarting the kernel.
update status of the error

Now about your another question of relevance of this: m=x.shape(0);
first check what print(x.shape(0); gives as output. then that should be your m which ‘may’ be your data sample size., because we want to produce that many predictions or outputs.

1 Like

Apologies for the late response!

I was able to figure out the cause for my errors, I wrote a line of code that I didn’t need and it was throwing everything else off. Thank you so much for helping!