Week 2 assignment cost function calculation

Hi everyone, I hope everyone is doing well.
I am writing because I have an issue with the result that may code produces for the cost function.
I am not sure what I am doing wrong.
This is the code for the cost:

{moderator edit - solution code removed}

The problem is that the result is cost = 7.410349464564118 while the expected value is cost = 0.15900537707692405

You have to be careful with the dot products and transposes there. Here’s a thread which discusses the difference between y^T \cdot x and y \cdot x^T for row vectors.

A hint is that if you do the dot product correctly, there is no need for the np.sum call there. See that other thread for a more detailed explanation.