cs231n - assignment1 - softmax 梯度推导

这篇博客介绍了如何实现和优化Softmax分类器,包括完全向量化损失函数、梯度推导、数值梯度检查、学习率和正则化参数的调整,以及权重可视化。通过softmax的链式法则,详细解释了在网络复杂时如何求导。
摘要由CSDN通过智能技术生成

Softmax exercise

Complete and hand in this completed worksheet (including its outputs and any supporting code outside of the worksheet) with your assignment submission. For more details see the assignments page on the course website.


This exercise is analogous to the SVM exercise. You will:


- implement a fully-vectorized loss function for the Softmax classifier
- implement the fully-vectorized expression for its analytic gradient
- check your implementation with numerical gradient
- use a validation set to tune the learning rate and regularization strength
- optimize the loss function with SGD
- visualize the final learned weights

和linear_svm一样,主要难点是求导操作,不过softmax的求导更简单一些。
首先还是给出 Loss 的公式:

L=1NiLi+λR(W)1

其中共有 N 个样本,每个样本带来的 Loss 是 Li :
Li=logpyi=logefyijefj=fyi+logjefj2

对于每一个样本 Xi , 由于 softmax 的分母对所有的 fj 进行了累积求和, 所以 Li W 的导数对 W 的每一列都又贡献, 即 LiWj 对所有的 j 都不为 0:
j=y

评论 23
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值