Skip to content

Instantly share code, notes, and snippets.

@marcopeix
Created February 26, 2019 18:03
Show Gist options
  • Save marcopeix/1b89bc704b4abef279500c5c7f7c3724 to your computer and use it in GitHub Desktop.
Save marcopeix/1b89bc704b4abef279500c5c7f7c3724 to your computer and use it in GitHub Desktop.
def compute_cost(AL, Y):
m = Y.shape[1]
cost = (-1/m) * np.sum(np.multiply(Y, np.log(AL)) + np.multiply((1 - Y), np.log(1 - AL)))
cost = np.squeeze(cost)
assert(cost.shape == ())
return cost
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment