Skip to content

Instantly share code, notes, and snippets.

@bringhurst
Created January 25, 2016 00:35
Show Gist options
  • Save bringhurst/765408519912837dc711 to your computer and use it in GitHub Desktop.
Save bringhurst/765408519912837dc711 to your computer and use it in GitHub Desktop.
my first attempt at softmax
def softmax(x):
"""Compute softmax values for each sets of scores in x."""
exps = np.exp(x)
total_exp = reduce(operator.add, exps, 0)
return np.array([(i / total_exp) for i in exps])
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment