{"id":647,"date":"2020-06-28T10:57:03","date_gmt":"2020-06-28T02:57:03","guid":{"rendered":"http:\/\/www.zyhcoding.club\/?p=647"},"modified":"2020-07-09T20:37:56","modified_gmt":"2020-07-09T12:37:56","slug":"%e7%ac%ac%e4%b8%80%e9%97%a8%e8%af%be","status":"publish","type":"post","link":"http:\/\/www.zyhcoding.club\/index.php\/2020\/06\/28\/%e7%ac%ac%e4%b8%80%e9%97%a8%e8%af%be\/","title":{"rendered":"\u7b2c\u4e00\u95e8\u8bfe"},"content":{"rendered":"<p>1.\u4e8c\u5143\u5206\u7c7b\u95ee\u9898\uff1a\u7ed9\u5b9a\u4e00\u4e2a\u8f93\u5165\u7279\u5f81\u5411\u91cf\ud835\udc4b\u6765\u5bf9\u5e94\u4e00\u5f20\u56fe\u7247\uff0c\u4f60\u60f3\u8bc6\u522b\u8fd9\u5f20\u56fe\u7247\u8bc6\u522b\u770b\u5b83\u662f\u5426\u662f\u4e00\u53ea\u732b\u6216\u8005\u4e0d\u662f\u4e00\u53ea\u732b\u7684\u56fe\u7247\uff0c\u4f60\u60f3\u8981\u4e00\u4e2a\u7b97\u6cd5\u80fd\u591f\u8f93\u51fa\u9884\u6d4b\uff0c\u4f60\u53ea\u80fd\u79f0\u4e4b\u4e3a\ud835\udc66^\uff0c\u4e5f\u5c31\u662f\u4f60\u5bf9\u5b9e\u9645\u503c \ud835\udc66 \u7684\u4f30\u8ba1\u3002\u66f4\u6b63\u5f0f\u5730\u6765\u8bf4\uff0c\u4f60\u60f3\u8ba9 \ud835\udc66^ \u8868\u793a \ud835\udc66 \u7b49\u4e8e 1 \u7684\u4e00\u79cd\u53ef\u80fd\u6027\u6216\u8005\u662f\u673a\u4f1a\uff0c\u524d\u63d0\u6761\u4ef6\u662f\u7ed9\u5b9a\u4e86\u8f93\u5165\u7279\u5f81\ud835\udc4b\u3002<\/p>\n<p>2.\u903b\u8f91\u56de\u5f52\u6a21\u578b\uff0c\u6a21\u578b\u9884\u6d4b\u503c\u8ba9\ud835\udc66^ = <code class=\"katex-inline\">\ud835\udc64\ud835\udc47<\/code>\ud835\udc65 + \ud835\udc4f\u3002y^\u662f\u4e00\u4e2a\u5173\u4e8e\u8f93\u5165x\u7684\u7ebf\u6027\u51fd\u6570\uff0c\u4f46y^\u7684\u503c\u4e0d\u57280\u548c1\u4e4b\u95f4\uff0c\u4e0d\u80fd\u8868\u793a\u6982\u7387\u3002\u6211\u4eec\u9700\u8981\u7684\u8f93\u51fa\u662f<strong>sigmoid<\/strong>\u51fd\u6570\u3002\u8bbez = y^.\u903b\u8f91\u56de\u5f52sigmoid = <code class=\"katex-inline\">\\sigma(z) = \\frac{1}{1+e^{-z}}<\/code>\u3002<\/p>\n<p>3.\u4e3a\u4e86\u8bad\u7ec3\u903b\u8f91\u56de\u5f52\u6a21\u578b\u7684\u53c2\u6570w\u548cb\uff0c\u6211\u4eec\u9700\u8981\u8bad\u7ec3\u4ee3\u4ef7\u51fd\u6570\u6765\u5f97\u5230\u53c2\u6570w\u548cb\uff0c\u635f\u5931\u51fd\u6570\u53c8\u53eb\u505a\u8bef\u5dee\u51fd\u6570\uff0c\u7528\u6765\u8861\u91cf\u7b97\u6cd5\u7684\u8fd0\u884c\u60c5\u51b5\uff0cLoss function:\ud835\udc3f(\ud835\udc66^ , \ud835\udc66).    \ud835\udc3f(\ud835\udc66^ , \ud835\udc66) = \u2212\ud835\udc66log(\ud835\udc66^) \u2212 (1 \u2212 \ud835\udc66)log(1 \u2212 \ud835\udc66^)<br \/>\n\u5f53\ud835\udc66 = 1\u65f6\u635f\u5931\u51fd\u6570\ud835\udc3f = \u2212log(\ud835\udc66^)\uff0c\u5982\u679c\u60f3\u8981\u635f\u5931\u51fd\u6570\ud835\udc3f\u5c3d\u53ef\u80fd\u5f97\u5c0f\uff0c\u90a3\u4e48\ud835\udc66^\u5c31\u8981\u5c3d\u53ef\u80fd\u5927\uff0c\u56e0\u4e3a sigmoid \u51fd\u6570\u53d6\u503c[0,1]\uff0c\u6240\u4ee5\ud835\udc66^\u4f1a\u65e0\u9650\u63a5\u8fd1\u4e8e 1\u3002 \u5f53\ud835\udc66 = 0\u65f6\u635f\u5931\u51fd\u6570\ud835\udc3f = \u2212log(1 \u2212 \ud835\udc66^)\uff0c\u5982\u679c\u60f3\u8981\u635f\u5931\u51fd\u6570\ud835\udc3f\u5c3d\u53ef\u80fd\u5f97\u5c0f\uff0c\u90a3\u4e48\ud835\udc66^\u5c31\u8981\u5c3d\u53ef\u80fd\u5c0f\uff0c\u56e0\u4e3a sigmoid \u51fd\u6570\u53d6\u503c[0,1]\uff0c\u6240\u4ee5\ud835\udc66^\u4f1a\u65e0\u9650\u63a5\u8fd1\u4e8e 0\u3002<br \/>\n\u5176\u5b9e\u5c31\u662fy^\u8d8a\u63a5\u8fd1\u4e8ey\u8d8a\u597d\u3002\u635f\u5931\u51fd\u6570\u8d8a\u5c0f\u8d8a\u597d\u3002<br \/>\n\u635f\u5931\u51fd\u6570\u662f\u9488\u5bf9\u4e00\u4e2a\u8bad\u7ec3\u6837\u672c\u800c\u8a00\u7684\uff0c\u6240\u6709\u8bad\u7ec3\u6837\u672c\u7684\u53c2\u6570\u7684\u603b\u4ee3\u4ef7\u53eb\u505a\u4ee3\u4ef7\u51fd\u6570J(w,b)\u3002<\/p>\n<p>4.\u68af\u5ea6\u4e0b\u964d\u6cd5\uff1a<code class=\"katex-inline\">\ud835\udc64 \u2254 \ud835\udc64 \u2212 \ud835\udc4e\\frac{dJ(\ud835\udc64)}{d\ud835\udc64}<\/code>\u3002a\u662f\u5b66\u4e60\u7387(learning rate)\uff0c\u7528\u6765\u63a7\u5236\u6b65\u957f(step)\uff0c\u5411\u4e0b\u8d70\u4e00\u6b65\u7684\u957f\u5ea6\u5176\u5b9e\u5c31\u662f\u5bfc\u6570\u7684\u503c\uff0c\u7528dw\u8868\u793a\u3002\u68af\u5ea6\u4e0b\u964d\u6cd5\u5c31\u662f\u5411\u6700\u4f18\u89e3\u4e0d\u65ad\u8fed\u4ee3\u7684\u8fc7\u7a0b\u3002<\/p>\n<p>5.\u8ba1\u7b97\u56fe\uff08Computation Graph\uff09\uff1a\u53ef\u4ee5\u8bf4\uff0c\u4e00\u4e2a\u795e\u7ecf\u7f51\u7edc\u7684\u8ba1\u7b97\uff0c\u90fd\u662f\u6309\u7167\u524d\u5411\u6216\u53cd\u5411\u4f20\u64ad\u8fc7\u7a0b\u7ec4\u7ec7\u7684\u3002\u9996\u5148\u6211\u4eec\u8ba1\u7b97\u51fa\u4e00\u4e2a\u65b0\u7684\u7f51\u7edc\u7684\u8f93\u51fa\uff08\u524d\u5411\u8fc7\u7a0b\uff09\uff0c\u7d27\u63a5\u7740\u8fdb\u884c\u4e00\u4e2a\u53cd\u5411\u4f20\u8f93\u64cd\u4f5c\u3002\u540e\u8005\u6211\u4eec\u7528\u6765\u8ba1\u7b97\u51fa\u5bf9\u5e94\u7684\u68af\u5ea6\u6216\u5bfc\u6570\u3002\u8ba1\u7b97\u56fe\u89e3\u91ca\u4e86\u4e3a\u4ec0\u4e48\u6211\u4eec\u7528\u8fd9\u79cd\u65b9\u5f0f\u7ec4\u7ec7\u8fd9\u4e9b\u8ba1\u7b97\u8fc7\u7a0b\u3002<\/p>\n<p>6.\u903b\u8f91\u56de\u5f52\u7528\u5230\u7684\u516c\u5f0f\uff1a<code class=\"katex-inline\">z = wT + b, y^\\ =\\ a = \\sigma(z) = \\frac{1}{1+e^{-z}},\\ L(a, y) = -(yloga + (1-y)log(1-a))<\/code><br \/>\n<code class=\"katex-inline\">da = \\frac{dL}{da} = -\\frac{y}{a}+\\frac{1-y}{1-a},\\ dz = \\frac{dL}{dz}=a-y<\/code><br \/>\n<img src=\"http:\/\/www.zyhcoding.club:80\/wp-content\/uploads\/2020\/06\/\u63a8\u5bfc1.png\" alt=\"\" \/><img src=\"http:\/\/www.zyhcoding.club:80\/wp-content\/uploads\/2020\/06\/\u63a8\u5bfc2.png\" alt=\"\" \/><br \/>\n<img src=\"http:\/\/www.zyhcoding.club:80\/wp-content\/uploads\/2020\/06\/\u63a8\u5bfc3.png\" alt=\"\" \/><br \/>\n<img src=\"http:\/\/www.zyhcoding.club:80\/wp-content\/uploads\/2020\/06\/\u63a8\u5bfc4.png\" alt=\"\" \/><\/p>\n<p>7.\u6bcf\u4e00\u4e2an\u5c42\u7684\u795e\u7ecf\u7f51\u7edc\u5305\u542bn-1\u5c42\u9690\u85cf\u5c42\u548c1\u5c42\u8f93\u51fa\u5c42\uff08\u8f93\u5165\u5c42\u4e0d\u5305\u542b\u5728\u5185\uff09\u3002\u6bcf\u4e00\u4e2a\u9690\u85cf\u5c42\u7684\u795e\u7ecf\u5355\u5143\u79f0\u4e3a\u4e00\u4e2a\u9690\u85cf\u5355\u5143\uff0c\u4e00\u4e2a\u5305\u542bm\u4e2a\u9690\u85cf\u5355\u5143\u7684\u9690\u85cf\u5c42\uff0c\u8f93\u51fa\u662f\u4e00\u4e2a(m, 1)\u7684\u77e9\u9635\u5411\u91cfy^\uff0c\u540c\u65f6\u8be5\u8f93\u51fa\u4e5f\u662f\u4e0b\u4e00\u5c42\u7684\u8f93\u5165a\u3002a\u4e5f\u79f0\u4e3a\u6fc0\u6d3b\u51fd\u6570\uff0cy^=a\u3002\u90a3\u4e48\u7b2ci\u5c42\u7684\u6fc0\u6d3b\u503c\uff0c\u79f0\u4e3a<code class=\"katex-inline\">a^{[i]}<\/code>\uff0c\u7b2ci\u5c42\u7684\u7b2cj\u4e2a\u795e\u7ecf\u5355\u5143\u7684\u8f93\u51fa\u503c\uff0c\u5728\u4e0a\u6807\u4e3ai\u7684\u57fa\u7840\u4e0a\uff0c\u8fd8\u5e94\u6709\u4e2a\u4e0b\u6807j\u3002<br \/>\n\u82e5\u4e0a\u4e00\u5c42\u7684\u6fc0\u6d3b\u503c\u4e3a\u4e00\u4e2a(x, 1)\u7684\u77e9\u9635\uff0c\u672c\u5c42\u6709m\u4e2a\u795e\u7ecf\u5355\u5143\uff0c\u90a3\u4e48\u672c\u5c42\u7684\u6bcf\u4e2a\u795e\u7ecf\u5355\u5143\u7684W(\u7279\u5f81\u6743\u91cd)\u4e5f\u662f\u4e00\u4e2a(x, 1)\u7684\u77e9\u9635\uff0cb\u662f\u4e00\u4e2a(1, 1)\u7684\u77e9\u9635\uff0c\u6700\u7ec8\u8ba1\u7b97\u5f97\u5230z\u662f\u4e00\u4e2a(1, 1)\u7684\u77e9\u9635\u3002\u90a3\u4e48\u628a\u8fd9\u4e9b\u795e\u7ecf\u5355\u5143\u5806\u53e0\u8d77\u6765\u4e00\u8d77\u8ba1\u7b97\uff0c\u672c\u5c42\u7684W\u5c31\u662f\u4e00\u4e2a(m, x)\u7684\u77e9\u9635(\u5148\u628a\u6bcf\u4e2a\u795e\u7ecf\u5355\u5143\u7684W\u5012\u7f6e\uff0c\u5728\u7eb5\u5411\u5806\u53e0)\uff0cb\u5c31\u662f\u4e00\u4e2a(m, 1)\u7684\u77e9\u9635\uff0c\u6700\u7ec8\u5f97\u5230(m, 1)\u7684\u77e9\u9635\u4e3a\u8f93\u51fa\u7ed3\u679c\u3002<img src=\"http:\/\/www.zyhcoding.club:80\/wp-content\/uploads\/2020\/06\/\u63a8\u5bfc5.png\" alt=\"\" \/><br \/>\n\u6700\u7ec8\u7684\u8f93\u51fa\u5c42\u53ea\u6709\u4e00\u4e2a\u795e\u7ecf\u5355\u5143\uff0c\u6574\u4e2a\u795e\u7ecf\u7f51\u7edc\u7684\u8f93\u51fa\u503c\u662f\u4e00\u4e2a\u5b9e\u6570\u3002<br \/>\n\u6bcf\u4e00\u4e2a\u795e\u7ecf\u5355\u5143\u7684W\u5e94\u8be5\u662f\u968f\u673a\u521d\u59cb\u5316\u7684\uff0c\u5c3d\u91cf\u4e0d\u540c\u3002<\/p>\n<p>8.\u7528\u5411\u91cf\u5316\u4ee3\u66fffor\u5faa\u73af\uff0c\u662f\u795e\u7ecf\u7f51\u7edc\u5229\u7528GPU\u52a0\u901f\u7684\u4e00\u4e2a\u91cd\u8981\u6b65\u9aa4\u3002<\/p>\n<p>9.\u4f7f\u7528\u4e00\u4e2a\u795e\u7ecf\u7f51\u7edc\u65f6\uff0c\u9700\u8981\u51b3\u5b9a\u4f7f\u7528\u54ea\u79cd\u6fc0\u6d3b\u51fd\u6570\u7528\u9690\u85cf\u5c42\u4e0a\uff0c\u54ea\u79cd\u7528\u5728\u8f93\u51fa\u8282\u70b9\u4e0a\u3002<br \/>\nsigmoid\u51fd\u6570\uff1a <code class=\"katex-inline\">a = sigma(z) = \\frac{1}{1+e^{-z}}<\/code><br \/>\ntanh\u51fd\u6570\uff1a <code class=\"katex-inline\">a = tanh(z) = \\frac{e^{z}-e^{-z}}{e^{z}+e^{-z}}<\/code><br \/>\ntanh\u51fd\u6570\u5728\u6240\u6709\u573a\u5408\u90fd\u4f18\u4e8esigmoid\u51fd\u6570\u3002tanh\u51fd\u6570\u7684\u503c\u5206\u5e03\u5728-1\u5230+1\u4e2d\u95f4\u3002\u5728\u8bad\u7ec3\u4e00\u4e2a\u7b97\u6cd5\u6a21\u578b\u65f6\uff0c\u5982\u679c\u4f7f\u7528 tanh \u51fd\u6570\u4ee3\u66ff<br \/>\nsigmoid \u51fd\u6570\u4e2d\u5fc3\u5316\u6570\u636e\uff0c\u4f7f\u5f97\u6570\u636e\u7684\u5e73\u5747\u503c\u66f4\u63a5\u8fd1 0 \u800c\u4e0d\u662f 0.5\u3002<br \/>\n\u5728\u4e8c\u5206\u7c7b\u7684\u95ee\u9898\u4e2d\uff0c\u5bf9\u4e8e\u8f93\u51fa\u5c42\uff0c\u56e0\u4e3a\ud835\udc66\u7684\u503c\u662f 0 \u6216 1\uff0c\u6240\u4ee5\u60f3\u8ba9\ud835\udc66^\u7684\u6570\u503c\u4ecb\u4e8e 0 \u548c 1 \u4e4b\u95f4\uff0c\u800c\u4e0d\u662f\u5728-1 \u548c+1 \u4e4b\u95f4\u3002\u6240\u4ee5\u9700\u8981\u4f7f\u7528 sigmoid \u6fc0\u6d3b\u51fd\u6570\u3002\u9690\u85cf\u5c42\u53ef\u4ee5\u4f7f\u7528g\u51fd\u6570\u3002<br \/>\nsigmoid \u51fd\u6570\u548c tanh \u51fd\u6570\u4e24\u8005\u5171\u540c\u7684\u7f3a\u70b9\u662f\uff0c\u5728\ud835\udc67\u7279\u522b\u5927\u6216\u8005\u7279\u522b\u5c0f\u7684\u60c5\u51b5\u4e0b\uff0c\u5bfc\u6570\u7684\u68af\u5ea6\u6216\u8005\u51fd\u6570\u7684\u659c\u7387\u4f1a\u53d8\u5f97\u7279\u522b\u5c0f\uff0c\u6700\u540e\u5c31\u4f1a\u63a5\u8fd1\u4e8e 0\uff0c\u5bfc\u81f4\u964d\u4f4e\u68af\u5ea6\u4e0b\u964d\u7684\u901f\u5ea6\u3002<\/p>\n<p>10.\u8fd9\u662f\u5f88\u591a\u6fc0\u6d3b\u51fd\u6570\u7684\u9ed8\u8ba4\u9009\u62e9\uff0c\u5982\u679c\u5728\u9690\u85cf\u5c42\u4e0a\u4e0d\u786e\u5b9a\u4f7f\u7528\u54ea\u4e2a\u6fc0\u6d3b\u51fd\u6570\uff0c\u90a3\u4e48\u901a\u5e38\u4f1a\u4f7f\u7528 Relu \u6fc0\u6d3b\u51fd\u6570\u3002\u6709\u65f6\uff0c\u4e5f\u4f1a\u4f7f\u7528 tanh \u6fc0\u6d3b\u51fd\u6570\uff0c\u4f46 Relu \u7684\u4e00\u4e2a\u4f18\u70b9\u662f\uff1a\u5f53\ud835\udc67\u662f\u8d1f\u503c\u7684\u65f6\u5019\uff0c\u5bfc\u6570\u7b49\u4e8e 0\u3002<br \/>\n<img src=\"http:\/\/www.zyhcoding.club:80\/wp-content\/uploads\/2020\/06\/\u5e38\u89c1\u7684\u6fc0\u6d3b\u51fd\u6570.png\" alt=\"\" \/><br \/>\n<img src=\"http:\/\/www.zyhcoding.club:80\/wp-content\/uploads\/2020\/06\/ReLu\u51fd\u6570.png\" alt=\"\" \/><\/p>\n","protected":false},"excerpt":{"rendered":"<p>1.\u4e8c\u5143\u5206\u7c7b\u95ee\u9898\uff1a\u7ed9\u5b9a\u4e00\u4e2a\u8f93\u5165\u7279\u5f81\u5411\u91cf\ud835\udc4b\u6765\u5bf9\u5e94\u4e00\u5f20\u56fe\u7247\uff0c\u4f60\u60f3\u8bc6\u522b\u8fd9\u5f20\u56fe\u7247\u8bc6\u522b\u770b\u5b83\u662f\u5426\u662f\u4e00\u53ea\u732b\u6216\u8005\u4e0d\u662f [&hellip;]<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":[],"categories":[50],"tags":[],"_links":{"self":[{"href":"http:\/\/www.zyhcoding.club\/index.php\/wp-json\/wp\/v2\/posts\/647"}],"collection":[{"href":"http:\/\/www.zyhcoding.club\/index.php\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"http:\/\/www.zyhcoding.club\/index.php\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"http:\/\/www.zyhcoding.club\/index.php\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"http:\/\/www.zyhcoding.club\/index.php\/wp-json\/wp\/v2\/comments?post=647"}],"version-history":[{"count":21,"href":"http:\/\/www.zyhcoding.club\/index.php\/wp-json\/wp\/v2\/posts\/647\/revisions"}],"predecessor-version":[{"id":653,"href":"http:\/\/www.zyhcoding.club\/index.php\/wp-json\/wp\/v2\/posts\/647\/revisions\/653"}],"wp:attachment":[{"href":"http:\/\/www.zyhcoding.club\/index.php\/wp-json\/wp\/v2\/media?parent=647"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"http:\/\/www.zyhcoding.club\/index.php\/wp-json\/wp\/v2\/categories?post=647"},{"taxonomy":"post_tag","embeddable":true,"href":"http:\/\/www.zyhcoding.club\/index.php\/wp-json\/wp\/v2\/tags?post=647"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}