http://deeplearning.stanford.edu/wiki/index.php/Backpropagation_Algorithm
UFLDL Tutorial 中没有给出推导公式,这里简单记录一下记法和简单推导过程
文章中用到的记法:
这个是单个sample的cost function.
这个是最终的损失函数,其中是hypothesis,是regularizationparameter或 weight decay parameter.
是第层第个节点,连接到第个节点的权值,是第层第个节点的输入,也就是,当时,就是,是第层第个节点的输出
利用梯度下降,我们要求解
然后做权值更新
而
其中
令
那么就可以得到
问题就在于求解,分成两种情况,第一种是,即处于输出层,第二种是其他的层,利用求导的链式法则有.
对于第一种情况
对于第二种情况
由此得到算法:
- Perform a feedforward pass, computing the activations for layers, and so on up to the output layer .
- For each output unit i in layer (the output layer), set
- For :For each node i in layer l, set:
- Compute the desired partial derivatives, which are given as: