Softmax
wiki: softmax function
softmax function in python: https://gist.github.com/stober/1946926
http://stackoverflow.com/questions/34968722/softmax-function-python
*numpy.sum: http://docs.scipy.org/doc/numpy-1.10.1/reference/generated/numpy.sum.html
*numpy.sum: http://docs.scipy.org/doc/numpy-1.10.1/reference/generated/numpy.sum.html
def softmax(x):
"""Compute softmax values for each sets of scores in x."""
e = np.exp(x)
dist = e / np.sum(e, axis=0) """Don't forget to specify axis=0"""
return dist
没有评论:
发表评论