码迷,mamicode.com
首页 > 其他好文 > 详细

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

时间:2020-06-11 09:15:58      阅读:62      评论:0      收藏:0      [点我收藏+]

标签:sum   style   xpl   import   classes   pytorch   png   技术   class   

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

 

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

标签:sum   style   xpl   import   classes   pytorch   png   技术   class   

原文地址:https://www.cnblogs.com/Answer1215/p/13090754.html

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!