C1_W2_Linear_Regression "Name Error"

I am getting a name error when defining variable ‘m’. Is anyone else getting the same issue ee
I am defining it as “m = x_train.shape[0]”
“NameError: name ‘m’ is not defined”

Hi @pansy.patel,

You meet with this error NameError: name ‘m’ is not defined when you access the value of it, not when you assign value to it.

Chance is that you put this assignment line m = x_train.shape[0] somewhere in your code, but it doesn’t get executed before you access its value; or it does get executed but in the scope of a function, and you are accessing its value outside the scope of the function.

Please make sure m is assigned before it is accessed, and both happen either in the same function, or both happen outside of any function.


thanks, solved it and implemented

1 Like