This time, I will briefly summarize the softmax function.
Converts the output of the neural network to a total probability of 1.
If the output $ y_1 $ ~ $ y_3 $ is as follows,
The result through the softmax function is
import numpy as np
def softmax(z):
y = np.exp(z) / np.sum(np.exp(z))
return y
z = np.array([1.2, 0.8, 0.3])
answer = softmax(z)
print(answer)
#output
# [0.48148922 0.32275187 0.19575891]
Recommended Posts