In order to study ML, I’m making my own softmax () function. I created a softmax () function as follows:
function softmax(a)
c = maximum(a)
exp.(a .- c) / sum(exp.(a .- c))
end
The sum of the values in the output matrix of this function should be 1.
temp =[0.03599090056107662, -0.01742189223257631, 0.03347773422745233, 0.04595474713958682, 0.13597367330428853, -0.06639136007573368, -0.0034873745788529358, -0.029754161131846667, 0.056507619128728516, 0.04165990829472141]
sum(softmax(temp))
If you run the above function, you get:
1.0000000000000002
What is the problem?