> AI Gravity :: SoftMax Function
본문으로 바로가기

SoftMax Function

category Math/Activation Function 2021. 11. 19. 10:48

SoftMax Function is

make 100% ratio from elements.

For example,

input datas = { 1,2,3,4 }  

output datas =

why we use e?

1. more clacification

2. easy to use differential

 

import numpy as np
import matplotlib.pyplot as plt
 
def softmax(x):
    e_x = np.exp(x)
    return e_x / e_x.sum()
 
x = np.array([1,2,3])
y = softmax(x)
 
print(np.sum(y))
 

ratio = y
labels = y

print(y)
print(ratio)
print(labels)

plt.pie(ratio, labels=labels, shadow=True, startangle=90)
plt.show()