I’m working on W2_A2_E5

and I wrote this to compute the log loss and cost :

{moderator edit: code removed}

I get a syntax error can someone help me please I couldn’t understand the error cost = np.multiply(…)

^

SyntaxError: invalid syntax

I’m working on W2_A2_E5

and I wrote this to compute the log loss and cost :

{moderator edit: code removed}

I get a syntax error can someone help me please I couldn’t understand the error cost = np.multiply(…)

^

SyntaxError: invalid syntax

Count your sets of parenthesis.

Thank you. Parenthesis are OK. Now it won’t grade it. Items I had credit for show up as zero. How can I get help with the course material?

What exactly does “won’t grade it” mean?

Please post a screen capture image of your grader feedback or any error messages.

It grades now. Not sure what happened. Here is the error:

{moderator edit: code removed

The error message said there were not enough arguments for one of the functions.}

Your second call to np.multiply() has an extra set of parenthesis. Perhaps this is turning the results into a tuple, which np.multiply() doesn’t like.

Just guessing, I haven’t tested it myself.

Note that your print(logloss) might cause a whole lot of data to be displayed, because it’s an nparray the same size as the data set. This sort of thing can make the grader unhappy.

Thank you, I’ve updated the equation but still get an error:

logloss =np.matmul(Y,(np.log(A2.T))) + np.matmul(((1 - Y),np.log(1 - A2.T)))

19 cost = np.multiply((-1/m), np.sum(logloss))

20 ### END CODE HERE ###

ValueError: invalid number of arguments

It would help if you post a screen capture image that shows all of the error message. In your message, there’s no pointer that indicates which line had the error.

Text copy-and-paste isn’t the most effective method to use here.

Now it gives me a different error:

{moderator edit: code removed}

For those who find this thread later:

Check if there are any extra sets of parenthesis in any of the function calls.