Skip to content

Instantly share code, notes, and snippets.

@sethbunke
Last active February 24, 2017 20:52
Show Gist options
  • Save sethbunke/196d247d308a88fce793865938ee521f to your computer and use it in GitHub Desktop.
Save sethbunke/196d247d308a88fce793865938ee521f to your computer and use it in GitHub Desktop.
Understanding Softmax Function
#Concise implementation
def softmax(inputs):
return np.exp(inputs) / np.sum(np.exp(inputs))
#Verbose implementation (for clarification/understanding)
def softmax_verbose(inputs):
results = [np.exp(x) for x in inputs]
summation = sum(results)
probabilities = [(x / summation) for x in results]
return probabilities
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment