# 深度学习 – 梯度下降法 ## 用梯度下降法求取损失函数最小值的步骤

w := w + \Delta w

\Delta w = -η \nabla J(w)

\frac{\partial{J}}{\partial{w_j}} = – \sum _i(y^{(i)} – φ(z^{(i)}))x_j^{(i)}

\Delta w_j = -η \frac{\partial{J}}{\partial{w_j}} = η \sum _i(y^{(i)} – φ(z^{(i)}))x_j^{(i)}

[w_0, w_1, w_2, …, w_n] := [w0, w_1, w_2, …, w_n] + [\Delta w_0, \Delta w_1, \Delta w_2, …, \Delta w_n]

### 损失函数的偏导数计算

\begin{aligned} J(w)=\frac{1}{2}\sum _i (y^{(i)} – φ(z^{(i)}))^2\\ \end{aligned}

\begin{aligned} \frac{\partial{J}}{\partial{w_j}} &= \frac{\partial}{\partial{w_j}} \frac{1}{2} \sum _i (y^{(i)} – φ(z^{(i)}))^2\\ &= \frac{1}{2} \frac{\partial}{\partial{w_j}} \sum _i (y^{(i)} – φ(z^{(i)}))^2\\ &= \frac{1}{2} \sum _i 2 (y^{(i)} – φ(z^{(i)})) \frac{\partial}{\partial{w_j}} (y^{(i)} – φ(z^{(i)}))\\ &= \sum _i (y^{(i)} – φ(z^{(i)})) \frac{\partial}{\partial{w_j}} (y^{(i)} – \sum _i (w_jx_j^{(i)}) )\\ &= \sum _i (y^{(i)} – φ(z^{(i)})) ( – x_j^{(i)} )\\ &= -\sum _i (y^{(i)} – φ(z^{(i)})) x_j^{(i)} \\ \end{aligned}
{"ft_lang_label":"__label__zh","ft_lang_prob":0.836617,"math_prob":1.0000099,"size":2384,"snap":"2020-45-2020-50","text_gpt3_token_len":1931,"char_repetition_ratio":0.1777311,"word_repetition_ratio":0.08805031,"special_character_ratio":0.30369127,"punctuation_ratio":0.05901639,"nsfw_num_words":0,"has_unicode_error":false,"math_prob_llama3":1.0000098,"pos_list":[0,1,2],"im_url_duplicate_count":[null,5,null],"WARC_HEADER":"{\"WARC-Type\":\"response\",\"WARC-Date\":\"2020-12-04T15:03:12Z\",\"WARC-Record-ID\":\"<urn:uuid:c005b3f2-355d-428a-8c44-d9b9c7363e31>\",\"Content-Length\":\"29728\",\"Content-Type\":\"application/http; msgtype=response\",\"WARC-Warcinfo-ID\":\"<urn:uuid:c14f42de-02f4-404a-ae53-be7a5ed7cd09>\",\"WARC-Concurrent-To\":\"<urn:uuid:c4c8aa73-6013-4d19-bd49-29f7232e8da1>\",\"WARC-IP-Address\":\"121.199.13.249\",\"WARC-Target-URI\":\"https://www.qikegu.com/docs/3766\",\"WARC-Payload-Digest\":\"sha1:LD7MDP2SFZL32YD6XSRHBE7H7VITT74I\",\"WARC-Block-Digest\":\"sha1:LCOZXE36BQ6VOW5Z6QNPI325ALCJGRUA\",\"WARC-Identified-Payload-Type\":\"text/html\",\"warc_filename\":\"/cc_download/warc_2020/CC-MAIN-2020-50/CC-MAIN-2020-50_segments_1606141737946.86_warc_CC-MAIN-20201204131750-20201204161750-00243.warc.gz\"}"}