Derivative

Gradient Descent

Softmax Function

softmax.png

\begin{align} {y_k} = \exp(a_k) / {\sum{^n}}_{i=1} {\exp(a_i)} \end{align}

1
2
3
4
5
6
7
8
# softmax function
def softmax(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
1
2
3
4
5
6
7
8
np.array([0.3, 2.9, 4.0])
# array([0.3, 2.9, 4. ])

softmax(a)
# array([0.01821127, 0.24519181, 0.73659691])

np.sum(res)
# 1.0
References

강의: CMU Introduction to Deep Learning
코드: 밑바닥부터 시작하는 딥러닝