Skip to content

Instantly share code, notes, and snippets.

@ImadDabbura
Created September 20, 2018 15:01
Show Gist options
  • Save ImadDabbura/a64eb6380365b75a818aef38037dcaf6 to your computer and use it in GitHub Desktop.
Save ImadDabbura/a64eb6380365b75a818aef38037dcaf6 to your computer and use it in GitHub Desktop.
# Compute cross-entropy cost
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)))
return cost
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment