cs224n-naive-softmax-的推导与实现

This blog covers the derivation and implementation of naive softmax in the context of CS224n (2019). It starts with an introduction, followed by a detailed explanation of the formula derivation using chain rule and the gradient of the softmax function. The post concludes with a brief mention of the provided code for the implementation." 88195562,5040019,在线编译器推荐:从调试到汇编查看,"['编译器', '工具', '在线开发', '调试工具', '代码编辑']

摘要生成于 C知道 ,由 DeepSeek-R1 满血版支持, 前往体验 >

cs224n-naive-softmax-的推导与实现

文章目录

0、简介

在cs224n(2019)第二次课后作业Assignment 2的手写作业b(推导梯度公式)和编程作业a中对naive softmax的实现。首先手写作业的推导公式,编程作业则是对这些公式的简单实现

1、公式推出

首先看下背景和问题

image-20190909170321836

image-20190909170250701

首先问题a中已经证明了 损失函数 J = C r o s s E n t r o p y ( y , y ^ ) J = CrossEntropy(y, \hat{y}) J=CrossEntropy(y,y^),而且有 y ^ = s o f t m a x ( U T v c ) \hat{y}=softmax(U^Tv_c) y^=softmax(UTvc), 不妨用 θ = U t v c \theta=U^tv_c θ=Utvc,现在有 y ^ = s o f t m a x ( θ ) \hat{y}=softmax(\theta) y^=softmax(θ), 然后用chain rule推导J关于vc的偏导数。

关 于 的 求 导 如 下 : 由 以 上 的 导 数 可 推 : 由 链 式 法 则 : J = − y log ⁡ y ^ ;   ∂ J ∂ y ^ = − y y ^ y

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值