Skip to content

Instantly share code, notes, and snippets.

@Alescontrela
Last active June 15, 2018 23:08
Show Gist options
  • Save Alescontrela/0428c8ac33183b09fa483806268f32e6 to your computer and use it in GitHub Desktop.
Save Alescontrela/0428c8ac33183b09fa483806268f32e6 to your computer and use it in GitHub Desktop.
def softmax(raw_preds):
'''
pass raw predictions through softmax activation function
'''
out = np.exp(raw_preds) # exponentiate vector of raw predictions
return out/np.sum(out) # divide the exponentiated vector by its sum. All values in the output sum to 1.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment