Numerically stable softmax function
Examples
softmax(1:3)
#> [1] 0.09003057 0.24472847 0.66524096
softmax(1:3 + 9999999)
#> [1] 0.09003057 0.24472847 0.66524096
softmax(c(12345, 67890, 99999999))
#> [1] 0 0 1
Numerically stable softmax function
softmax(1:3)
#> [1] 0.09003057 0.24472847 0.66524096
softmax(1:3 + 9999999)
#> [1] 0.09003057 0.24472847 0.66524096
softmax(c(12345, 67890, 99999999))
#> [1] 0 0 1