[Intro to Deep Learning with PyTorch -- L2 -- N15] Softmax function

The Softmax Function

In the next video, we'll learn about the softmax function, which is the equivalent of the sigmoid activation function, but when the problem has 3 or more classes.

 
 
 
import numpy as np

def softmax(L):
    expL = np.exp(L)
    sumExpL = sum(expL)
    result = []
    for i in expL:
      result.append(i*1.0/sumExpL)

    return result

 

posted @ 2020-06-11 02:55  Zhentiw  阅读(130)  评论(0编辑  收藏  举报