Week1 - assignment - Loss function error

I implemented gradientDescent function, but getting this error:

Wrong output for the loss function. Check how you are implementing the matrix multiplications.
Expected: 0.6709497038162118.
Got: 6.783954452541828.
Wrong output for the loss function. Check how you are implementing the matrix multiplications.
Expected: 6.5044107216556135.
Got: 162.83776189572313.

This is my sigmoid implementation:
if np.isscalar(z):
h = 1 / (1 + np.exp(-z))
else:
h = np.exp(-z)
for i in range(len(h)):
h[i] = 1 / (1 + h[i])

Hi bijaya_kumar_eyunni,

numpy.exp calculates the exponential of all elements in the input array, so you don’t have to use a separate loop that may cause bugs.

Hello vijaya_kumar_eyunni
You mustn’t do this with np.exp() as It can handle with
scalars or matrix
I understand your idea but this can’t be here
if you want to use this idea you can write it with math.exp() as it handles only with scalars not matrix and you

I wish If I could help
Dear Atef,