Created
April 25, 2018 01:09
-
-
Save stfuchs/eb8d50accfce332fba1ac70dca938e32 to your computer and use it in GitHub Desktop.
This file contains hidden or 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
f1 = lambda x: 1./np.exp(0.1*(x + 80.)) | |
f2 = lambda x: -.26*(x+58) | |
def weight(i, fs): | |
return lambda x: np.exp(fs[i](x)) / np.sum([np.exp(f(x)) for f in fs]) | |
def softmax(fs): | |
return lambda x: np.sum([f(x)*weight(i,fs)(x) for i,f in enumerate(fs)]) | |
softmax([f1,f2])(np.linspace(-80,0)) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment