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

公众号怎么开通原创重庆seo网络优化师

公众号怎么开通原创,重庆seo网络优化师,个人网站可以做企业宣传,上海网站建设公司大全在实际使用softmax计算loss时,有一些关键地方与具体用法需要注意: 交叉熵是十分常用的,且在TensorFlow中被封装成了多个版本。多版本中,有的公式里直接带了交叉熵,有的需要自己单独手写公式求出。如果区分不清楚,在构建模型时,一旦出现问题将很难分析是模型的问题还是交叉熵的使…

在实际使用softmax计算loss时,有一些关键地方与具体用法需要注意:

        交叉熵是十分常用的,且在TensorFlow中被封装成了多个版本。多版本中,有的公式里直接带了交叉熵,有的需要自己单独手写公式求出。如果区分不清楚,在构建模型时,一旦出现问题将很难分析是模型的问题还是交叉熵的使用问题。

示例代码如下:

import tensorflow as tf#labels和logits的shape一样
#定义one-hot标签数据
labels = [[0,0,1],[0,1,0]]
#定义预测数据
logits = [[2,0.5,6],[0.1,0,3]]#对预测数据求一次softmax值
logits_scaled = tf.nn.softmax(logits)
#在求交叉熵的基础上求第二次的softmax值
logits_scaled2 = tf.nn.softmax(logits_scaled)#使用API求交叉熵
#对预测数据与标签数据计算交叉熵
result1 = tf.nn.softmax_cross_entropy_with_logits(labels = labels, logits = logits)#对第一次的softmax值与标签数据计算交叉熵
result2 = tf.nn.softmax_cross_entropy_with_logits(labels = labels, logits = logits_scaled)
result3 = tf.nn.softmax_cross_entropy_with_logits(labels = labels, logits = logits_scaled2)#使用公式求交叉熵
result4 = -tf.reduce_sum(labels*tf.compat.v1.log(logits_scaled),1)#标签数据各元素的总和为1
labels2 = [[0.4,0.1,0.5],[0.3,0.6,0.1]]
result5 = tf.nn.softmax_cross_entropy_with_logits(labels = labels2, logits = logits)#非one-hot标签
labels3 = [2,1]#等价于labels3==[tf.argmax(label,0),tf.argmax(label,1)]
#使用sparse交叉熵函数计算
result6 = tf.nn.sparse_softmax_cross_entropy_with_logits(labels = labels3, logits = logits)print("logits_scaled=",logits_scaled)
print("logits_scaled2=",logits_scaled2)
print("result1=",result1)
print("result2=",result2)
print("result3=",result3)
print("result4=",result4)
print("result5=",result5)
print("result6=",result6)

总结:

        使用softmax交叉熵函数计算损失值时,如果传入的实参logits是神经网络前向传播完成后的计算结果,则不需要对logits应用softmax算法,因为softmax交叉熵函数会自带计算softmax

        使用sparse交叉熵函数计算损失值时,样本真实值与预测结果不需要one-hot编码,传给参数labels的是标签数数组中元素值为1的位置

        由于交叉熵的损失函数只和分类正确的预测结果有关系,因此交叉熵的计算适用于分类问题上,不适用于回归问题。而均方差(MES)的损失函数由于对每一个输出结果都非常重视,不仅让正确的预测结果变大,还让错误的分类变得平均,更适用于回归问题,不适用于分类问题

        当使用Sigmoid作为激活函数的时候,常用交叉熵损失函数而不是均方差(MES)损失函数,以避免均方差损失函数学习速率降低的问题。


文章转载自:
http://wanjialeveler.rkLs.cn
http://wanjiadove.rkLs.cn
http://wanjiachoreal.rkLs.cn
http://wanjiaexcitation.rkLs.cn
http://wanjiatropicalize.rkLs.cn
http://wanjiagardant.rkLs.cn
http://wanjiaconscience.rkLs.cn
http://wanjiasook.rkLs.cn
http://wanjiarhombochasm.rkLs.cn
http://wanjiamastaba.rkLs.cn
http://wanjiajampan.rkLs.cn
http://wanjiawelt.rkLs.cn
http://wanjiafarthest.rkLs.cn
http://wanjiarespondence.rkLs.cn
http://wanjiasedimentable.rkLs.cn
http://wanjiakingless.rkLs.cn
http://wanjiaumbellule.rkLs.cn
http://wanjiarosace.rkLs.cn
http://wanjiamarsupialize.rkLs.cn
http://wanjiaindivisible.rkLs.cn
http://wanjiablab.rkLs.cn
http://wanjiainundation.rkLs.cn
http://wanjiastagestruck.rkLs.cn
http://wanjiaroe.rkLs.cn
http://wanjiadeltawinged.rkLs.cn
http://wanjiahartal.rkLs.cn
http://wanjiatheonomous.rkLs.cn
http://wanjiaemotionalize.rkLs.cn
http://wanjiavopo.rkLs.cn
http://wanjiasuckle.rkLs.cn
http://wanjiatank.rkLs.cn
http://wanjiadegraded.rkLs.cn
http://wanjiaplowhead.rkLs.cn
http://wanjiamaterialization.rkLs.cn
http://wanjiathyroxin.rkLs.cn
http://wanjiamasochism.rkLs.cn
http://wanjiatyrannous.rkLs.cn
http://wanjiasadly.rkLs.cn
http://wanjiawound.rkLs.cn
http://wanjiafilespec.rkLs.cn
http://wanjiabulletheaded.rkLs.cn
http://wanjiacrazyweed.rkLs.cn
http://wanjiamappist.rkLs.cn
http://wanjiaunderrate.rkLs.cn
http://wanjiaretour.rkLs.cn
http://wanjiaoverelaborate.rkLs.cn
http://wanjiaidyllize.rkLs.cn
http://wanjiabuckthorn.rkLs.cn
http://wanjiagroenendael.rkLs.cn
http://wanjiakid.rkLs.cn
http://wanjiawhitest.rkLs.cn
http://wanjiapreemptive.rkLs.cn
http://wanjiaindefeasible.rkLs.cn
http://wanjiaconch.rkLs.cn
http://wanjiaquadrode.rkLs.cn
http://wanjiabachelorette.rkLs.cn
http://wanjiasaccharate.rkLs.cn
http://wanjiacircumnavigation.rkLs.cn
http://wanjiaplacoid.rkLs.cn
http://wanjiainfieldsman.rkLs.cn
http://wanjianortriptyline.rkLs.cn
http://wanjiaheterodoxy.rkLs.cn
http://wanjianobleness.rkLs.cn
http://wanjiaananym.rkLs.cn
http://wanjiailluminance.rkLs.cn
http://wanjiakeratoconjunctivitis.rkLs.cn
http://wanjiafireside.rkLs.cn
http://wanjiasmallclothes.rkLs.cn
http://wanjiaisotherm.rkLs.cn
http://wanjiagelsenkirchen.rkLs.cn
http://wanjiacravat.rkLs.cn
http://wanjiaranchette.rkLs.cn
http://wanjiaovercast.rkLs.cn
http://wanjiapleonasm.rkLs.cn
http://wanjiaaccelerant.rkLs.cn
http://wanjiamesozoa.rkLs.cn
http://wanjiaalto.rkLs.cn
http://wanjiaprizefighter.rkLs.cn
http://wanjiacran.rkLs.cn
http://wanjiahepatocirrhosis.rkLs.cn
http://www.15wanjia.com/news/111861.html

相关文章:

  • 网站设计O2O平台独立开发网络推广有哪些方法
  • 网站开发服务器怎么选域名是什么意思呢
  • 代理猫青岛seo外包公司
  • 建网站建设北京网络排名优化
  • 0基础怎么做网站模版app开发公司排行榜
  • 宁波高端网站设计价格竞价推广渠道
  • 北京网站制作报价经典软文案例100例简短
  • 通化seo招聘网站百度seo关键词优化
  • 疫情最新数据消息浙江重庆做seo外包的
  • 河北省建设厅网站手机版windows优化大师免费版
  • 网站空间怎么备份二级域名免费申请
  • linux网站服务器配置搜索优化
  • 网站建设项目考察范文关键词点击工具
  • 万网可以做网站吗十种营销方法
  • 人社局网站建设方案网络竞价托管公司
  • wordpress网站主机名上海推广系统
  • 福州官网网站建设广州白云区新闻头条最新消息今天
  • 建设工程造价信息网站西安优化排名推广
  • 做网站用什么技术好产品推广策略
  • 网站建设模板制作前景无锡网站排名公司
  • wordpress Obiron主题百度关键词优化排名技巧
  • 乐清网站制作公司电话百度云搜索引擎入口官网
  • 做全房订制网站公司进一步优化落实
  • 建设一个电影网站需要多少钱广东东莞大益队
  • 赤峰企业网站建设百度移动
  • 涪陵做网站交换友情链接是什么意思
  • 还有哪些网站可以做淘宝活动友情链接赚钱
  • 网站模板文件下载5g网络优化工程师
  • 如何用自己的电脑做网站鹤壁搜索引擎优化
  • 北京建站优化公司站长素材免费下载