Hello,
While computing the gradiant dw, I am getting the below error.
File “”, line 44
dw = (1 / m) * np.dot(X, (A - Y).T)
^
SyntaxError: invalid syntax
Please help!
Regards, Balram
Hello,
While computing the gradiant dw, I am getting the below error.
File “”, line 44
dw = (1 / m) * np.dot(X, (A - Y).T)
^
SyntaxError: invalid syntax
Please help!
Regards, Balram
Hi, at first glance I don’t see anything wrong with that line, could it be that the error is in the previous line where the cost
is calculated? Check carefully if all parenthesis match.
An easy check would be to comment the cost calculation line. Your function would fail but if there is no syntax error you know the error is in the commented line.
Exactly! When you get a syntax error right at the beginning of a line, what it means is that there is something incomplete about the previous line. Probably a missing close paren or close bracket or something like that.
Well, the one other possibility is that it’s an indentation problem, since indentation is part of the python syntax. But in my experience, the interpreter always explicitly says “indentation” in the error message if that is what it is unhappy about.
Thank you @albertovilla and @paulinpaloalto ! it worked. There was an error in my cost function only!