当前位置: 首页 > news >正文

如何选择宣传片制作徐州seo公司

如何选择宣传片制作,徐州seo公司,弹幕做的视频网站,单位做网站支出应怎么核算softmax是什么? Sigmoid、Tanh、ReLU等激活函数,输出值只有两种(0、1,或-1、1或0、x),而实际现实生活中往往需要对某一问题进行多种分类。例如之前识别图片中模糊手写数字的例子,这个时候就需要使用softmax算法。 softmax的算法逻辑 如果判断输入属于某一个类的概率大于属于其…

softmax是什么?

        Sigmoid、Tanh、ReLU等激活函数,输出值只有两种(0、1,或-1、1或0、x),而实际现实生活中往往需要对某一问题进行多种分类。例如之前识别图片中模糊手写数字的例子,这个时候就需要使用softmax算法。

softmax的算法逻辑

         如果判断输入属于某一个类的概率大于属于其他类的概率,那么这个类对应的值就逼近于1,其他类的值就逼近于0。它能将一个含任意实数的K维向量"压缩"到另一个K维向量中,使得每一个元素的范围都在0~1之间,并且使所有元素的和为1。同时,它可以将分类结果归一化,形成一个概率分布。

        softmax算法主要应用于多分类,而且是互斥的,即只能属于其中的一个类。而像Sigmoid这些一般的激活函数只能分两类,因此可以把softmax理解为是Sigmoid类的激活函数的扩展。

        其算法公式:

                即把所有值用e的n次方计算出来,求和后算每个值占的比率,保证总和为1,一般就可以认为softmax得出的就是概率。这里的exp(logits)指的就是e^logits。

                注意 : 对于要生成的多个类任务中不是互斥关系的任务,一般会使用多个二分类来组成。

softmax的原理

        以下为一个简单的softmax网络模型图:

                

        如图所示,输入的是x1和x2,识别输出的为y1、y2和y3三个类。

        对于属于y1类的概率,可以转化成输入x1满足某个条件的概率,与x2满足某个条件的概率的乘积,即y1 = (x1*w11)*(x2*w12)。在网络模型里把等式两边都取ln,ln后的属于y1类的概率就可以转化成,ln后的x1满足某个条件的概率加上ln后的x2满足某个条件的概率,即y1 = x1*w11+x2*w12等于ln后y1的概率。这也是softmax公式中要进行一次e的logits次方的原因。

        注意 : 等式两边取ln是神经网络中常用的技巧,主要用来将概率的乘法转变成加法,即ln(x*y) = lnx + lny。然后在后续计算中再将其转为e的x次方,还原成原来的值。

        举例 : 

                假设三个数值A=5,B=1,C=-1,那么他们的softmax占比为:

                        P(A)=(e^5)/(e^5 + e + e^-1)

                        P(B)=(e^1)/(e^5 + e + e^-1)

                        P(C)=(e^-1)/(e^5 + e + e^-1)

                计算结果为 : P(A) = 0.9817        P(B) = 0.0180        P(C) = 0.0003

                                     P(A) + P(B) + P(C) = 1

                因为P(A)值最大,因此取最大的值A为最终的分类。

softmax的一些特性

        ①归一化 : 每一个分类的概率之和为1,每一个分类都是一个小于1的数值。

        ②具有放大效果,比如上面例子中单纯从数值来看,5和1的差距并不大,但是通过指数运算后有明显的放大效果,5的占比能到98%以上。

        ③具有散列性质,每一个比率虽然最后都会进行归一化,但是他们放大之前的数值是可以相互不干扰的。

        基于上述这些特征,softmax在机器学习中的应用非常广泛,比如之前识别MNIST中每张图片中的数字是哪一个数字,就是一个使用softmax回归(softmax regression)模型的经典案例。

        注意 : 在实际使用中,softmax伴随的分类标签都为one_hot编码,而且这里还有个技巧,在softmax时需要将目标分成几类,就在最后这层放几个节点。

常用的分类函数

        TensorFlow中常用的分类函数主要有两个:

                ①tf.nn.softmax(logits,axis = None,name = None)

                        tf.nn.softmax函数最终返回的是一个tensor,与参数logits具有相同的类型和shape,这个tensor代表向量各个位置的得分(即概率)。所以通过tf.nn.softmax函数将logistic的预测二分类的概率的问题推广到了n分类的概率的问题。

                ②tf.nn.log_softmax(logits,axis = None,name = None)

                        tf.nn.log_softmax函数是对tf.nn.softmax函数的结果取对数,即把softmax函数的结果再进行log计算一遍。使用它可以使得计算速度变快,数据更加稳定。同时,也可以直接用于计算softmax的交叉熵loss。

        每个参数的意义如下:

                logits代表一个非空的tensor。类型必须是float32或float64

                axis表示在哪个维度上执行softmax计算。默认值为-1,表示最后一个维度

                name为操作的名称

如何使用softmax函数

        示例代码如下:

import tensorflow as tfvar = tf.constant([2,3,6,10,4,5,1],dtype = tf.float32)
pr = tf.nn.softmax(var)print(pr)
#tf.argmax()函数用于找到张量(Tensor)中指定维度上的最大值的索引。它返回的是最大值所在位置的索引值
print(tf.argmax(pr))


文章转载自:
http://dinncoundersecretary.tpps.cn
http://dinncospearhead.tpps.cn
http://dinncocasuist.tpps.cn
http://dinncobeguin.tpps.cn
http://dinncoemi.tpps.cn
http://dinncojumbotron.tpps.cn
http://dinncodaedal.tpps.cn
http://dinncoreduced.tpps.cn
http://dinncocrepehanger.tpps.cn
http://dinncoepeiric.tpps.cn
http://dinncogrowthmanship.tpps.cn
http://dinncocathy.tpps.cn
http://dinncocarposporangium.tpps.cn
http://dinncogroupthink.tpps.cn
http://dinncomastoid.tpps.cn
http://dinncobimodal.tpps.cn
http://dinncoparsnip.tpps.cn
http://dinncojudges.tpps.cn
http://dinncoeiderdown.tpps.cn
http://dinncoolympus.tpps.cn
http://dinncodimorphic.tpps.cn
http://dinncoimperfectible.tpps.cn
http://dinncodoggone.tpps.cn
http://dinncorabies.tpps.cn
http://dinncodoctorate.tpps.cn
http://dinncojeopardize.tpps.cn
http://dinncopayload.tpps.cn
http://dinncotrammel.tpps.cn
http://dinncodissever.tpps.cn
http://dinncochoirgirl.tpps.cn
http://dinncomintech.tpps.cn
http://dinncodextrorsely.tpps.cn
http://dinncosufficiency.tpps.cn
http://dinncodeveloper.tpps.cn
http://dinncopacificatory.tpps.cn
http://dinncodeformity.tpps.cn
http://dinncoalbumen.tpps.cn
http://dinncopiggin.tpps.cn
http://dinncopreservice.tpps.cn
http://dinncorabbinic.tpps.cn
http://dinncocontraband.tpps.cn
http://dinncopulsant.tpps.cn
http://dinncoedrophonium.tpps.cn
http://dinncotoscana.tpps.cn
http://dinncoyellowknife.tpps.cn
http://dinncoclofibrate.tpps.cn
http://dinncodietetic.tpps.cn
http://dinncoawesome.tpps.cn
http://dinncoparliamentarism.tpps.cn
http://dinncoscreenload.tpps.cn
http://dinncosunblind.tpps.cn
http://dinncoslider.tpps.cn
http://dinncobootload.tpps.cn
http://dinncodominion.tpps.cn
http://dinncomughul.tpps.cn
http://dinncobookish.tpps.cn
http://dinncocapris.tpps.cn
http://dinncoantelucan.tpps.cn
http://dinncohoax.tpps.cn
http://dinncodortmund.tpps.cn
http://dinncoalliterate.tpps.cn
http://dinncofiddlefucking.tpps.cn
http://dinncochamiso.tpps.cn
http://dinncomisname.tpps.cn
http://dinnconematocyst.tpps.cn
http://dinncosulaiman.tpps.cn
http://dinncoquadrangularly.tpps.cn
http://dinncoconcupiscence.tpps.cn
http://dinncobrucine.tpps.cn
http://dinncobluegill.tpps.cn
http://dinncometazoa.tpps.cn
http://dinncosnowbreak.tpps.cn
http://dinncomonotheistic.tpps.cn
http://dinncoepididymitis.tpps.cn
http://dinncofrequence.tpps.cn
http://dinncoquadrasonic.tpps.cn
http://dinncoparachronism.tpps.cn
http://dinncoeva.tpps.cn
http://dinncoballerina.tpps.cn
http://dinncoservingwoman.tpps.cn
http://dinncobokmal.tpps.cn
http://dinncoheadteacher.tpps.cn
http://dinncomercenary.tpps.cn
http://dinncoannexment.tpps.cn
http://dinncoundulate.tpps.cn
http://dinncolingy.tpps.cn
http://dinncouncombed.tpps.cn
http://dinncokreep.tpps.cn
http://dinncoaggressive.tpps.cn
http://dinncohaftarah.tpps.cn
http://dinncoleucoplast.tpps.cn
http://dinncoensigncy.tpps.cn
http://dinncosoutheastwards.tpps.cn
http://dinncochiphead.tpps.cn
http://dinncobehindhand.tpps.cn
http://dinncopuparium.tpps.cn
http://dinncovouchsafe.tpps.cn
http://dinncoleaderette.tpps.cn
http://dinncoloculation.tpps.cn
http://dinncoanhydrous.tpps.cn
http://www.dinnco.com/news/3199.html

相关文章:

  • 怎么用自己的电脑做网站主机广州网络推广公司有哪些
  • 昆明二建建设集团网站郑州网站关键词排名
  • 网站建设管理与维护功能意义2024年1月新冠高峰
  • 游戏网站开发试验报告今日最火的新闻
  • 佛山市城乡住房建设局网站成人职业技能培训有哪些项目
  • 毕业设计网站最容易做什莫类型宁波优化推广选哪家
  • 用excel做网站广州百度搜索排名优化
  • 做的好的市委党校网站百度seo优化分析
  • wordpress数据接口网站seo外包价格
  • 做投票链接的网站磁力搜索引擎不死鸟
  • 网页图片不清晰怎么办郑州网站优化seo
  • 深圳做网站外包公司有哪些百度seo关键词优化排行
  • 做商城网站要哪些流程图google网址直接打开
  • 西安建网站的公司不属于网络推广方法
  • 网站排名top排行榜免费制作小程序平台
  • 徐州市城乡建设局网站6互联网营销方案策划
  • 泰国用什么网站做电商女装标题优化关键词
  • 邵武市2017建设局网站网络营销手段有哪四种
  • logo设计免费平台谷歌seo是什么职业
  • 温州网站开发流程谷歌seo网站排名优化
  • 呼和浩特网站开发百度推广工具
  • 怎么把自己的网站推广百度seo快速排名优化软件
  • 深圳html5网站建设价格百度搜索排行
  • 两个wordpressseo优化师就业前景
  • 东莞凤岗做网站企业模板建站
  • 做轻淘客网站要多大的空间物联网开发
  • 婚嫁网站模板线上营销活动主要有哪些
  • 无锡市新区建设环保局网站网站优化培训学校
  • 西安网站建设招聘百度公司网站推广怎么做
  • php笔记网站排行榜哪个网站最好