Created
January 25, 2016 00:35
-
-
Save bringhurst/765408519912837dc711 to your computer and use it in GitHub Desktop.
my first attempt at softmax
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 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