Skip to content

Instantly share code, notes, and snippets.

@mdhasanai
Created September 28, 2018 04:43
Show Gist options
  • Save mdhasanai/2d3d9c3d0b6c416360a49dc9974c5564 to your computer and use it in GitHub Desktop.
Save mdhasanai/2d3d9c3d0b6c416360a49dc9974c5564 to your computer and use it in GitHub Desktop.
def softmax(x):
"""Compute softmax values for each sets of scores in x."""
e_x = np.exp(x - np.max(x))
s = e_x / e_x.sum()
return s
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment