Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

why to use our own softmax instead of inbuilt? #21

Open
ramtest55 opened this issue Apr 7, 2017 · 0 comments
Open

why to use our own softmax instead of inbuilt? #21

ramtest55 opened this issue Apr 7, 2017 · 0 comments

Comments

@ramtest55
Copy link

# out very own softmax
def output2probs(output):
    output = np.dot(output, weights[0]) + weights[1]
    output -= output.max()
    output = np.exp(output)
    output /= output.sum()
    return output

I tried example

x = np.array([0.5,.3,.2])
x -= x.max()    #array([ 0. , -0.2, -0.3])
x = np.exp(x)   #array([ 1.        ,  0.81873075,  0.74081822])
x /= x.sum()    #array([ 0.39069383,  0.31987306,  0.28943311])

It seems it smooths out probability big gaps? Why we want this? is it ahead we done sampling? why are we not simply taking top k most probable word provided by predict_proba function?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant