Created
December 22, 2018 18:27
-
-
Save jainakshansh/e6d2f222d8597ffa83c5fadf5c71cbe9 to your computer and use it in GitHub Desktop.
The Softmax Algorithm for Multi-class Classification - Facebook Udacity PyTorch Challenge
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
import numpy as np | |
def softmax(L): | |
expL = np.exp(L) | |
sumExpL = sum(expL) | |
result = [] | |
for i in expL: | |
result.append(i * 1.0 / sumExpL) | |
return result | |
L = [5, 6, 7] | |
print(softmax(L)) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment