Skip to content

Instantly share code, notes, and snippets.

@vamc-stash
Last active May 15, 2020 10:14
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save vamc-stash/7a9864c0b73ffdb2a99160c792373d04 to your computer and use it in GitHub Desktop.
Save vamc-stash/7a9864c0b73ffdb2a99160c792373d04 to your computer and use it in GitHub Desktop.
Error Estimation
def compute_loss(loss_func, A, Y,i):
m = Y.shape[0]
A = A.flatten()
if loss_func == "binary_crossentropy":
cost = (-(Y*np.log(A))-((1-Y)*np.log(1-A)))
cost = np.sum(cost,axis=0,keepdims = 1)/m
cost = np.squeeze(cost)
return cost
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment