Skip to content

Instantly share code, notes, and snippets.

@motokiee
Created January 12, 2017 14:43
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save motokiee/9131f8768be0bf9c17d042cb0cf6952e to your computer and use it in GitHub Desktop.
Save motokiee/9131f8768be0bf9c17d042cb0cf6952e to your computer and use it in GitHub Desktop.
import numpy as np
def soft_max(a):
c = np.max(a)
exp_a = np.exp(a-c)
sum_exp_a = np.sum(exp_a)
y = exp_a / sum_exp_a
return y
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment