Last active
June 15, 2018 23:12
-
-
Save Alescontrela/2bd8f8696f2617e33b2f0a32d888a456 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
def categoricalCrossEntropy(probs, label): | |
''' | |
calculate the categorical cross-entropy loss of the predictions | |
''' | |
return -np.sum(label * np.log(probs)) # Multiply the desired output label by the log of the prediction, then sum all values in the vector |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment