{"id":133,"date":"2026-04-08T00:37:20","date_gmt":"2026-04-07T16:37:20","guid":{"rendered":"https:\/\/kktljr.top\/?p=133"},"modified":"2026-06-07T04:18:27","modified_gmt":"2026-06-06T20:18:27","slug":"%e3%80%8a%e9%b1%bc%e4%b9%a6%e3%80%8b%e7%ac%94%e8%ae%b0","status":"publish","type":"post","link":"https:\/\/kktljr.top\/index.php\/2026\/04\/08\/%e3%80%8a%e9%b1%bc%e4%b9%a6%e3%80%8b%e7%ac%94%e8%ae%b0\/","title":{"rendered":"\u300a\u9c7c\u4e66\u300b\u7b14\u8bb0"},"content":{"rendered":"<h1>\u300a\u9c7c\u4e66\u300b\u7b14\u8bb0<\/h1>\n<h2>1. python\u57fa\u7840<\/h2>\n<h3>1.1 Numpy<\/h3>\n<p>\u200b   Np\u7684\u5e7f\u64ad: <\/p>\n<pre><code class=\"language-python\">&gt;&amp;gt;&amp;gt; x = np.array([1.0, 2.0, 3.0])\n&gt;&amp;gt;&amp;gt; x \/ 2.0\narray([ 0.5,  1. ,  1.5])<\/code><\/pre>\n<p>\u200b   \u591a\u7ef4\u6570\u7ec4: <\/p>\n<pre><code class=\"language-python\">&gt;&amp;gt;&amp;gt; A = np.array([[1, 2], [3, 4]])\n&gt;&amp;gt;&amp;gt; print(A)\n[[1 2]\n [3 4]]\n&gt;&amp;gt;&amp;gt; A.shape  #\u591a\u7ef4\u6570\u7ec4\u6bcf\u9879\u957f\u5ea6\u4e00\u6837\u5426\u5219\u62a5\u9519\n(2, 2)\n&gt;&amp;gt;&amp;gt; A.dtype  #\u77e9\u9635\u5143\u7d20\u7684\u6570\u636e\u7c7b\u578b\ndtype(&amp;#039;int64&amp;#039;)\n\n&gt;&amp;gt;&amp;gt; B = np.array([[3, 0],[0, 6]])\n&gt;&amp;gt;&amp;gt; A + B\narray([[ 4,  2],\n       [ 3, 10]])\n&gt;&amp;gt;&amp;gt; A * B     # *\u53f7\u4e3a\u76f4\u63a5\u6570\u7ec4\u5bf9\u5e94\u5143\u7d20\u4e58\u79ef\narray([[ 3,  0],\n       [ 0, 24]])<\/code><\/pre>\n<p>\u200b   \u8bbf\u95ee\u64cd\u4f5c:<\/p>\n<pre><code class=\"language-python\">&gt;&amp;gt;&amp;gt; X = np.array([[51, 55], [14, 19], [0, 4]])\n&gt;&amp;gt;&amp;gt; X = X.flatten()       # \u5c06X\u8f6c\u6362\u4e3a\u4e00\u7ef4\u6570\u7ec4, \u5373\u62c9\u5e73\n&gt;&amp;gt;&amp;gt; print(X)\n[51 55 14 19  0  4]\n&gt;&amp;gt;&amp;gt; X[np.array([0, 2, 4])] # \u83b7\u53d6\u7d22\u5f15\u4e3a0\u30012\u30014\u7684\u5143\u7d20\narray([51, 14,  0])<\/code><\/pre>\n<p>\u200b   \u77e9\u9635\u4e58\u79ef(\u70b9\u4e58): <\/p>\n<pre><code class=\"language-python\">&gt;&amp;gt;&amp;gt; A = np.array([[1,2], [3,4]])\n&gt;&amp;gt;&amp;gt; A.shape\n(2, 2)\n&gt;&amp;gt;&amp;gt; B = np.array([[5,6], [7,8]])\n&gt;&amp;gt;&amp;gt; B.shape\n(2, 2)\n&gt;&amp;gt;&amp;gt; np.dot(A, B)\narray([[19, 22],\n       [43, 50]])<\/code><\/pre>\n<h3>1.2 Matplotlib<\/h3>\n<pre><code class=\"language-python\">import numpy as np\nimport matplotlib.pyplot as plt\n# \u751f\u6210\u6570\u636e\nx = np.arange(0, 6, 0.1) # \u4ee50.1\u4e3a\u5355\u4f4d\uff0c\u751f\u62100\u52306\u7684\u6570\u636e\ny = np.sin(x)\n# \u7ed8\u56fe\nplt.plot(x, y)\nplt.show()<\/code><\/pre>\n<pre><code class=\"language-python\">x = np.arange(0, 6, 0.1) # \u4ee50.1\u4e3a\u5355\u4f4d\uff0c\u751f\u62100\u52306\u7684\u6570\u636e\ny1 = np.sin(x)\ny2 = np.cos(x)\n# \u7ed8\u5236\u56fe\u5f62\nplt.plot(x, y1, label=&amp;quot;sin&amp;quot;)\nplt.plot(x, y2, linestyle = &amp;quot;--&amp;quot;, label=&amp;quot;cos&amp;quot;) # \u7528\u865a\u7ebf\u7ed8\u5236\nplt.xlabel(&amp;quot;x&amp;quot;) # x\u8f74\u6807\u7b7e\nplt.ylabel(&amp;quot;y&amp;quot;) # y\u8f74\u6807\u7b7e\nplt.title(&amp;#039;sin &amp;amp; cos&amp;#039;) # \u6807\u9898\nplt.legend()    #\u56fe\u4f8b\u663e\u793a, \u6536\u96c6plot()\u4e2d\u7684label\nplt.show()<\/code><\/pre>\n<p>\u200b   \u663e\u793a\u56fe\u50cf: <\/p>\n<pre><code class=\"language-python\">import matplotlib.pyplot as plt\nfrom matplotlib.image import imread\nimg = imread(&amp;#039;lena.png&amp;#039;) # \u8bfb\u5165\u56fe\u50cf\uff08\u8bbe\u5b9a\u5408\u9002\u7684\u8def\u5f84\uff01\uff09\nplt.imshow(img)\nplt.show()<\/code><\/pre>\n<h1>2. \u611f\u77e5\u673a<\/h1>\n<h3>2.1 \u4ec0\u4e48\u662f\u611f\u77e5\u673a<\/h3>\n<p>\u200b   \u611f\u77e5\u673a\u7b97\u6cd5\u662f\u7f8e\u56fd\u5b66\u8005<strong>Frank Rosenblatt<\/strong>\u57281957\u5e74\u63d0\u51fa\u6765\u7684, \u662f\u795e\u7ecf\u7f51\u7edc\u7684\u8d77\u6e90\u7b97\u6cd5.<\/p>\n<p>\u200b   \u611f\u77e5\u673a\u63a5\u6536\u591a\u4e2a\u8f93\u5165\u4fe1\u53f7, \u8f93\u51fa\u4e00\u4e2a\u4fe1\u53f7. \u5728\u611f\u77e5\u673a\u4e2d, ==<strong><em>\u8f93\u51fa\u4fe1\u53f7<\/em><\/strong>==\u53ea\u6709 0\/1 \u4e24\u79cd\u53d6\u503c. \u4e3a\u65b9\u4fbf\u7406\u89e3, 0\u5bf9\u5e94&quot;\u4e0d\u4f20\u9012\u4fe1\u53f7&quot;, 1\u5bf9\u5e94&quot;\u4f20\u9012\u4fe1\u53f7&quot;.<\/p>\n<p><img decoding=\"async\" src=\"https:\/\/kktljr.top\/wp-content\/uploads\/2026\/06\/image-20260403042632610.png\" alt=\"image-20260403042632610.png\" \/><\/p>\n<p>\u200b   \u5176\u4e2dx~1~, x~2~\u4e3a\u8f93\u5165\u4fe1\u53f7, w~1~, w~2~\u4e3a\u6743\u91cd. \u56fe\u4e2d\u5706\u5708\u79f0\u4e3a&quot;\u795e\u7ecf\u5143&quot;\u6216\u8005&quot;\u8282\u70b9&quot;. \u8f93\u5165\u4fe1\u53f7\u88ab\u9001\u5f80\u795e\u7ecf\u5143\u65f6, \u4f1a\u5206\u522b\u4e58\u4ee5\u56fa\u5b9a\u7684\u6743\u91cd. \u8fd9\u4e9b\u4fe1\u53f7\u7684\u603b\u548c\u8d85\u8fc7\u9608\u503c <strong><em>\u03b8<\/em><\/strong> \u65f6, \u624d\u4f1a\u8f93\u51fa1, \u79f0\u4e4b\u4e3a&quot;\u795e\u7ecf\u5143\u88ab\u6fc0\u6d3b&quot;. \u5373:<\/p>\n<p><img decoding=\"async\" src=\"https:\/\/kktljr.top\/wp-content\/uploads\/2026\/06\/image-20260403043809335.png\" alt=\"image-20260403043809335.png\" \/><\/p>\n<p>\u200b   \u4ee4\u03b8 = -b, \u5219\u6709<img decoding=\"async\" src=\"https:\/\/kktljr.top\/wp-content\/uploads\/2026\/06\/image-20260407113837705.png\" alt=\"image-20260407113837705.png\" \/><\/p>\n<p>\u200b   \u628ab\u6210\u4e3a<strong>\u504f\u7f6e<\/strong>, \u628aw~1~, w~2~\u79f0\u4e3a\u6743\u91cd<\/p>\n<p>\u200b   w~1~, w~2~\u4e3a\u63a7\u5236\u8f93\u5165\u4fe1\u53f7\u91cd\u8981\u6027\u7684\u53c2\u6570, \u504f\u7f6e\u662f\u8c03\u6574\u795e\u7ecf\u5143\u88ab\u6fc0\u6d3b\u7684\u5bb9\u6613\u7a0b\u5ea6\u7684\u53c2\u6570.<\/p>\n<h3>2.2 \u611f\u77e5\u673a\u7684\u5c40\u9650\u6027<\/h3>\n<p>\u200b   \u7528\u4e0a\u6587\u4e2d\u7684\u611f\u77e5\u673a\u6a21\u578b\u65e0\u6cd5\u5b9e\u73b0\u5f02\u6216\u95e8, (w~1~, w~2~  + b&gt; 0, \u4e0ew~1~ + w~2~ + b&lt; 0\u77db\u76fe)<\/p>\n<h4>2.2.1 \u7ebf\u6027\u4e0e\u975e\u7ebf\u6027<\/h4>\n<p><img decoding=\"async\" src=\"https:\/\/kktljr.top\/wp-content\/uploads\/2026\/06\/image-20260407114941700.png\" alt=\"image-20260407114941700.png\" \/><\/p>\n<p><img decoding=\"async\" src=\"https:\/\/kktljr.top\/wp-content\/uploads\/2026\/06\/image-20260407115018388.png\" alt=\"image-20260407115018388.png\" \/><\/p>\n<h3>2.3 \u591a\u5c42\u611f\u77e5\u673a (\u5f02\u6216\u95e8\u5b9e\u73b0)<\/h3>\n<p>\u200b   \u611f\u77e5\u673a\u7684\u53e0\u52a0, \u4f7f\u5f97\u611f\u77e5\u673a\u80fd\u591f\u5b9e\u73b0\u66f4\u591a\u7684\u529f\u80fd, \u5982\u4e0b\u56fe: <img decoding=\"async\" src=\"https:\/\/kktljr.top\/wp-content\/uploads\/2026\/06\/image-20260407115930480.png\" alt=\"image-20260407115930480.png\" \/><\/p>\n<p>\u200b   <img decoding=\"async\" src=\"https:\/\/kktljr.top\/wp-content\/uploads\/2026\/06\/image-20260407120101998.png\" alt=\"image-20260407120101998.png\" \/><\/p>\n<h2>3.\u795e\u7ecf\u7f51\u7edc<\/h2>\n<p>\u200b   \u795e\u7ecf\u7f51\u7edc\u7684\u51fa\u7ebf, \u53ef\u4ee5\u81ea\u52a8\u5730\u4ece\u6570\u636e\u4e2d\u5b66\u4e60\u5230\u5408\u9002\u7684\u6743\u91cd\u53c2\u6570.<\/p>\n<h3>3.1 \u795e\u7ecf\u7f51\u7edc\u7684\u7ed3\u6784<\/h3>\n<p>\u200b   \u8f93\u5165\u5c42 ---- \u9690\u85cf\u5c42(\u4e2d\u95f4\u5c42) ---- \u8f93\u51fa\u5c42<\/p>\n<p><img decoding=\"async\" src=\"https:\/\/kktljr.top\/wp-content\/uploads\/2026\/06\/image-20260407121406959.png\" alt=\"image-20260407121406959.png\" \/><\/p>\n<h3>3.2 \u6fc0\u6d3b\u51fd\u6570<\/h3>\n<p>\u200b   <strong><em>\u6fc0\u6d3b\u51fd\u6570<\/em><\/strong>: \u5c06\u8f93\u5165\u4fe1\u53f7\u603b\u548c\u8f6c\u5316\u4e3a\u8f93\u51fa\u4fe1\u53f7\u7684\u51fd\u6570. \u5373\u4e0b\u56fe\u4e2dh(x): <\/p>\n<p><img decoding=\"async\" src=\"https:\/\/kktljr.top\/wp-content\/uploads\/2026\/06\/image-20260407121746697.png\" alt=\"image-20260407121746697.png\" \/><\/p>\n<h4>3.2.1 \u9636\u8dc3\u51fd\u6570<\/h4>\n<p>\u524d\u6587\u4e2d\u7684\u6fc0\u6d3b\u51fd\u6570\u79f0\u4e3a<strong>\u9636\u8dc3\u51fd\u6570<\/strong>, \u4e00\u65e6\u8f93\u5165\u8d85\u8fc7\u9608\u503c, \u5c31\u5207\u6362\u8f93\u51fa.<\/p>\n<h4>3.2.2 sigmoid\u51fd\u6570<\/h4>\n<p>\u200b   <img decoding=\"async\" src=\"https:\/\/kktljr.top\/wp-content\/uploads\/2026\/06\/image-20260407123309684.png\" alt=\"image-20260407123309684.png\" \/><\/p>\n<blockquote>\n<p>\u6fc0\u6d3b\u51fd\u6570\u5fc5\u987b\u4f7f\u7528\u975e\u7ebf\u6027\u51fd\u6570, \u56e0\u4e3a\u5982\u679c\u4f7f\u7528\u7ebf\u6027\u51fd\u6570\u7684\u8bdd, \u90a3\u4e48\u53e0\u52a0\u5c42\u5c31\u6ca1\u6709\u610f\u4e49\u4e86<\/p>\n<\/blockquote>\n<h4>3.2.3 ReLU(Rectified Linear Unit)\u51fd\u6570<\/h4>\n<p>\u200b   ReLU\u51fd\u6570, \u8f93\u5165\u5927\u4e8e0, \u76f4\u63a5\u8f93\u51fa\u8be5\u503c; \u8f93\u5165\u5c0f\u4e8e\u7b49\u4e8e0\u65f6, \u8f93\u51fa0.<img decoding=\"async\" src=\"https:\/\/kktljr.top\/wp-content\/uploads\/2026\/06\/image-20260407131826555.png\" alt=\"image-20260407131826555.png\" \/><\/p>\n<h3>3.3 3\u5c42\u795e\u7ecf\u7f51\u7edc\u7684\u5b9e\u73b0<\/h3>\n<p>\u200b   <img decoding=\"async\" src=\"https:\/\/kktljr.top\/wp-content\/uploads\/2026\/06\/image-20260407192502411.png\" alt=\"image-20260407192502411.png\" \/><\/p>\n<p><img decoding=\"async\" src=\"https:\/\/kktljr.top\/wp-content\/uploads\/2026\/06\/image-20260407192508426.png\" alt=\"image-20260407192508426.png\" \/><\/p>\n<p>\u200b   <\/p>\n<p>\u200b   \u7b2c\u4e00\u5c42\u7684\u52a0\u6743\u548c\u53ef\u4ee5\u8868\u793a\u4e3a:<img decoding=\"async\" src=\"https:\/\/kktljr.top\/wp-content\/uploads\/2026\/06\/image-20260407192519727.png\" alt=\"image-20260407192519727.png\" \/><\/p>\n<p>\u200b   \u4e0a\u8ff0\u64cd\u4f5c\u8ba1\u7b97\u51fa\u4e86\u52a0\u6743\u4fe1\u53f7\u4e0e\u504f\u7f6e\u4e4b\u548c, \u7136\u540e\u8fd8\u8981\u901a\u8fc7\u4e4b\u524d\u5b66\u4e60\u7684\u6fc0\u6d3b\u51fd\u6570\u8f6c\u6362\u4e3a\u8f93\u51fa\u4fe1\u53f7.<\/p>\n<p><strong>\u4ee3\u7801\u5b9e\u73b0\u5982\u4e0b<\/strong>:<\/p>\n<pre><code class=\"language-python\">def step_function(x):\n    return np.array(x &amp;gt; 0, dtype=int)\n\ndef sigmoid(x):\n    return 1 \/ (1 + np.exp(-x))\n\ndef relu(x):\n    return np.maximum(0, x)\n\ndef identity_function(x):   #\u6052\u7b49\u51fd\u6570\n    return x\n\ndef init_network():     #\u4e09\u5c42\u795e\u7ecf\u7f51\u7edc\n        network = {}\n        network[&amp;#039;W1&amp;#039;] = np.array([[0.1,0.3,0.5], [0.2, 0.4, 0.6]])\n        network[&amp;#039;b1&amp;#039;] = np.array([0.1, 0.2, 0.3])\n        network[&amp;#039;W2&amp;#039;] = np.array([[0.1,0.4], [0.2, 0.5], [0.3, 0.6]])\n        network[&amp;#039;b2&amp;#039;] = np.array([0.1, 0.2])\n        network[&amp;#039;W3&amp;#039;] = np.array([[0.1,0.3], [0.2, 0.4]])\n        network[&amp;#039;b3&amp;#039;] = np.array([0.1, 0.2])\n\n        return network\n\ndef forward(network, x):\n    W1, W2, W3 = network[&amp;#039;W1&amp;#039;], network[&amp;#039;W2&amp;#039;], network[&amp;#039;W3&amp;#039;]\n    b1, b2, b3 = network[&amp;#039;b1&amp;#039;], network[&amp;#039;b2&amp;#039;], network[&amp;#039;b3&amp;#039;]\n\n    a1 = np.dot(x, W1) + b1\n    z1 = sigmoid(a1)\n    a2 = np.dot(z1, W2) + b2\n    z2 = sigmoid(a2)\n    a3 = np.dot(z2, W3) + b3\n    y = identity_function(a3)\n    return y\n\nnetwork = init_network()\nx = np.array([1.0, 0.5])\ny = forward(network, x)\nprint(y)<\/code><\/pre>\n<h3>3.4 \u8f93\u51fa\u5c42\u8bbe\u8ba1<\/h3>\n<p>\u200b   \u4e00\u822c\u6765\u8bf4, \u56de\u5f52\u95ee\u9898\u7528\u6052\u7b49\u51fd\u6570, \u5206\u7c7b\u95ee\u9898\u7528softmax\u51fd\u6570<\/p>\n<h4>3.4.1 softmax\u51fd\u6570<\/h4>\n<p><img decoding=\"async\" src=\"https:\/\/kktljr.top\/wp-content\/uploads\/2026\/06\/image-20260407230328377.png\" alt=\"image-20260407230328377.png\" \/><\/p>\n<blockquote>\n<p>\u7531\u4e8e\u5728\u8ba1\u7b97\u673a\u4e2d, exp\u5bb9\u6613\u6ea2\u51fa, \u6240\u4ee5\u9700\u8981\u5bf9softmax\u51fd\u6570\u8fdb\u884c\u6539\u8fdb<\/p>\n<\/blockquote>\n<p><img decoding=\"async\" src=\"https:\/\/kktljr.top\/wp-content\/uploads\/2026\/06\/image-20260407230802351.png\" alt=\"image-20260407230802351.png\" \/><\/p>\n<p>\u200b   \u53ef\u4ee5\u89c2\u5bdf\u5230, y~k~\u7684\u548c\u4e3a1, \u6211\u4eec\u53ef\u4ee5\u628asoftmax\u7684\u8f93\u51fa\u89e3\u91ca\u4e3a\u6982\u7387, \u6240\u4ee5\u4e00\u822c\u7528\u4e8e\u5206\u7c7b\u6a21\u578b\u4e2d, \u4e00\u822c\u800c\u8a00, \u795e\u7ecf\u7f51\u7edc\u53ea\u628a\u8f93\u51fa\u503c\u6700\u5927\u7684\u795e\u7ecf\u5143\u5bf9\u5e94\u7684\u7c7b\u522b\u4f5c\u4e3a\u8bc6\u522b\u7ed3\u679c. \u4e14exp\u4e3a\u9012\u589e\u51fd\u6570, \u6545\u5728\u8fdb\u884c\u63a8\u7406\u9636\u6bb5\u65f6, softmax\u51fd\u6570\u53ef\u4ee5\u7701\u7565.<\/p>\n<h3>3.5 MNIST\u6570\u5b57\u8bc6\u522b<\/h3>\n<p>\u200b   \u7565<\/p>\n<h2>4. \u795e\u7ecf\u7f51\u7edc\u7684\u5b66\u4e60<\/h2>\n<p>\u200b   \u673a\u5668\u5b66\u4e60\u7684\u6700\u7ec8\u76ee\u6807\u662f\u83b7\u5f97<strong>\u6cdb\u5316\u80fd\u529b<\/strong>, \u6cdb\u5316\u80fd\u529b\u662f\u6307\u5904\u7406\u672a\u88ab\u89c2\u5bdf\u8fc7\u7684\u6570\u636e\u7684\u80fd\u529b.<\/p>\n<p>\u5982\u679c\u53ea\u5bf9\u7279\u5b9a\u6570\u636e\u96c6\u5904\u7406\u80fd\u529b\u597d, \u79f0\u4e3a\u8fc7\u62df\u5408<\/p>\n<h3>4.1 \u635f\u5931\u51fd\u6570<\/h3>\n<p>\u200b   \u795e\u7ecf\u7f51\u7edc\u4ee5\u67d0\u4e2a\u6307\u6807\u4e3a\u7ebf\u7d22\u5bfb\u627e\u6700\u4f18\u7684\u6743\u91cd\u53c2\u6570, \u795e\u7ecf\u7f51\u7edc\u7684\u5b66\u4e60\u4e2d\u8fd9\u4e2a\u6307\u6807\u79f0\u4e3a<strong>\u635f\u5931\u51fd\u6570<\/strong><\/p>\n<p>\u200b   <strong><em>\u635f\u5931\u51fd\u6570<\/em><\/strong> \u662f\u8868\u793a\u795e\u7ecf\u7f51\u7edc\u6027\u80fd\u7684&quot;\u6076\u52a3\u7a0b\u5ea6&quot;\u7684\u6307\u6807, \u5373\u5f53\u524d\u7684\u795e\u7ecf\u7f51\u7edc\u5bf9\u76d1\u7763\u6570\u636e\u5728\u591a\u5927\u7a0b\u5ea6\u4e0a\u4e0d\u62df\u5408, \u4e0d\u4e00\u81f4.<\/p>\n<h4>4.1.1 \u5747\u65b9\u8bef\u5dee<\/h4>\n<p><img decoding=\"async\" src=\"https:\/\/kktljr.top\/wp-content\/uploads\/2026\/06\/image-20260408182701400.png\" alt=\"image-20260408182701400.png\" \/><\/p>\n<h4>4.1.2 \u4ea4\u53c9\u71b5\u8bef\u5dee<\/h4>\n<p><img decoding=\"async\" src=\"https:\/\/kktljr.top\/wp-content\/uploads\/2026\/06\/image-20260408183302997.png\" alt=\"image-20260408183302997.png\" \/><\/p>\n<p>\u200b   \u5728<strong>one-hot<\/strong>\u8868\u793a\u4e2d, t~k~\u53ea\u6709\u6b63\u786e\u89e3\u7684\u6807\u7b7e\u4e3a1, \u6240\u4ee5\u5b9e\u9645\u4e0a\u4ea4\u53c9\u71b5\u8bef\u5dee\u7684\u503c\u7531\u6b63\u786e\u89e3\u6807\u7b7e\u6240\u5bf9\u5e94\u7684\u8f93\u51fa\u7ed3\u679c\u51b3\u5b9a.<\/p>\n<p>\u200b   \u5728\u4ee3\u7801\u5b9e\u73b0\u4e2d, \u4e3a\u4e86\u9632\u6b62 ln0 \u7206Inf, \u6240\u4ee5\u53ef\u4ee5\u6dfb\u52a0\u4e00\u4e2a\u5fae\u5c0f\u503c\u8fdb\u884c\u4fdd\u62a4:<\/p>\n<pre><code class=\"language-python\">def cross_entropy_error(y, t):\n    delta = 1e-7\n    return -np.sum(t * np.log(y + delta))<\/code><\/pre>\n<h4>4.1.3 mini-batch\u5b66\u4e60<\/h4>\n<p>\u200b   \u4e0a\u8ff0\u51fd\u6570\u5747\u4e3a\u9488\u5bf9\u5355\u4e2a\u6570\u636e\u7684\u635f\u5931\u51fd\u6570, \u5982\u679c\u8981\u6c42\u6240\u6709\u8bad\u7ec3\u6570\u636e\u7684\u635f\u5931\u51fd\u6570\u7684\u603b\u548c, \u4ee5\u4ea4\u53c9\u71b5\u8bef\u5dee\u4e3a\u4f8b, \u53ef\u4ee5\u5199\u6210\u4e0b\u5f0f.<\/p>\n<p><img decoding=\"async\" src=\"https:\/\/kktljr.top\/wp-content\/uploads\/2026\/06\/image-20260408184125519.png\" alt=\"image-20260408184125519.png\" \/><\/p>\n<p>\u200b   \u5982\u679c\u9047\u5230\u6570\u636e\u91cf\u5927\u7684\u60c5\u51b5, \u8ba1\u7b97\u5168\u90e8\u6570\u636e\u7684\u8bef\u5dee\u548c\u662f\u4e0d\u73b0\u5b9e\u7684. \u56e0\u6b64, \u6211\u4eec\u53ef\u4ee5\u4ece\u5168\u90e8\u6570\u636e\u4e2d\u9009\u51fa\u4e00\u90e8\u5206, \u4f5c\u4e3a\u5168\u90e8\u6570\u636e\u7684&quot;\u8fd1\u4f3c&quot;. \u795e\u7ecf\u7f51\u7edc\u7684\u5b66\u4e60\u4e5f\u662f\u4ece\u8bad\u7ec3\u6570\u636e\u4e2d\u9009\u51fa\u4e00\u6279\u6570\u636e(\u79f0\u4e3amini-batch, \u5c0f\u6279\u91cf), \u7136\u540e\u5bf9\u6bcf\u4e2amini-batch\u8fdb\u884c\u5b66\u4e60. \u8fd9\u79cd\u65b9\u5f0f\u79f0\u4e3amini-batch\u5b66\u4e60.<\/p>\n<p><img decoding=\"async\" src=\"https:\/\/kktljr.top\/wp-content\/uploads\/2026\/06\/image-20260408184939680.png\" alt=\"image-20260408184939680.png\" \/><\/p>\n<h3>4.2 \u68af\u5ea6<\/h3>\n<p>\u200b   \u673a\u5668\u5b66\u4e60\u4e2d\u4f18\u5316\u95ee\u9898\u6700\u5e38\u7528\u7684\u65b9\u6cd5\u5c31\u662f\u68af\u5ea6\u4e0b\u964d\u6cd5, \u7528\u4e8e\u51cf\u5c0f\u635f\u5931\u51fd\u6570\u7684\u503c.<\/p>\n<p><img decoding=\"async\" src=\"https:\/\/kktljr.top\/wp-content\/uploads\/2026\/06\/image-20260408192726909.png\" alt=\"image-20260408192726909.png\" \/><\/p>\n<h3>4.3 \u5b66\u4e60\u7b97\u6cd5\u7684\u5b9e\u73b0<\/h3>\n<p>\u200b   <\/p>\n<p><img decoding=\"async\" src=\"https:\/\/kktljr.top\/wp-content\/uploads\/2026\/06\/image-20260409042846462.png\" alt=\"image-20260409042846462.png\" \/><\/p>\n<p>\u200b   \u4e0a\u56fe\u4e3a\u4e66\u4e2d\u521d\u59cb\u5316\u6743\u91cd\u7684\u51fd\u6570, \u53ef\u4ee5\u53d1\u73b0\u5728\u751f\u6210\u6743\u91cdw\u65f6\u5728\u968f\u673a\u751f\u6210\u540e\u8fd8\u4e58\u4ee5\u4e86\u4e00\u4e2aweight_init_std, \u8fd9\u662f\u7531\u4e8esigmoid\u51fd\u6570\u7684\u7279\u6027, \u57280\u548c1\u5904\u65e0\u6cd5\u8bad\u7ec3\u7684\u95ee\u9898. <\/p>\n<blockquote>\n<p>\u8d85\u53c2\u6570: \u9700\u8981\u5148\u624b\u52a8\u8bbe\u5b9a\u7684\u53c2\u6570, \u5982\u6743\u91cd, lr, \u5faa\u73af\u6b21\u6570\u7b49<\/p>\n<\/blockquote>\n<h2>5. \u8bef\u5dee\u53cd\u5411\u4f20\u64ad\u6cd5<\/h2>\n<h3>5.1 \u53cd\u5411\u4f20\u64ad\u94fe\u5f0f\u6cd5\u5219<\/h3>\n<h4>5.1.1 \u8ba1\u7b97\u56fe<\/h4>\n<p><img decoding=\"async\" src=\"https:\/\/kktljr.top\/wp-content\/uploads\/2026\/06\/image-20260409052535111.png\" alt=\"image-20260409052535111.png\" \/><\/p>\n<p>\u200b   \u8ba1\u7b97\u56fe\u53ef\u4ee5\u96c6\u4e2d\u7cbe\u529b\u4e8e\u5c40\u90e8\u8ba1\u7b97, \u901a\u8fc7\u4f20\u9012\u5c40\u90e8\u8ba1\u7b97\u7684\u7ed3\u679c, \u53ef\u4ee5\u83b7\u5f97\u5168\u5c40\u7684\u590d\u6742\u8ba1\u7b97\u7ed3\u679c<\/p>\n<h4>5.1.2 \u53cd\u5411\u4f20\u64ad<\/h4>\n<p><img decoding=\"async\" src=\"https:\/\/kktljr.top\/wp-content\/uploads\/2026\/06\/image-20260409054030314.png\" alt=\"image-20260409054030314.png\" \/><\/p>\n<h4>5.1.3 Affine\u5c42\u5b9e\u73b0<\/h4>\n<p><img decoding=\"async\" src=\"https:\/\/kktljr.top\/wp-content\/uploads\/2026\/06\/image-20260409064355312.png\" alt=\"image-20260409064355312.png\" \/><\/p>\n<h4>5.1.4 Softmax-with-Loss\u5c42<\/h4>\n<p><img decoding=\"async\" src=\"https:\/\/kktljr.top\/wp-content\/uploads\/2026\/06\/image-20260409070713504.png\" alt=\"image-20260409070713504.png\" \/><\/p>\n<p><img decoding=\"async\" src=\"https:\/\/kktljr.top\/wp-content\/uploads\/2026\/06\/image-20260409070728877.png\" alt=\"image-20260409070728877.png\" \/><\/p>\n","protected":false},"excerpt":{"rendered":"<p>\u300a\u9c7c\u4e66\u300b\u7b14\u8bb0 1. python\u57fa\u7840 1.1 Numpy \u200b Np\u7684\u5e7f\u64ad: &gt;&amp;gt;&amp;gt; x = np &#8230;<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"emotion":"","emotion_color":"","title_style":"","license":"","footnotes":""},"categories":[7],"tags":[],"class_list":["post-133","post","type-post","status-publish","format-standard","hentry","category-7"],"_links":{"self":[{"href":"https:\/\/kktljr.top\/index.php\/wp-json\/wp\/v2\/posts\/133","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/kktljr.top\/index.php\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/kktljr.top\/index.php\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/kktljr.top\/index.php\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/kktljr.top\/index.php\/wp-json\/wp\/v2\/comments?post=133"}],"version-history":[{"count":8,"href":"https:\/\/kktljr.top\/index.php\/wp-json\/wp\/v2\/posts\/133\/revisions"}],"predecessor-version":[{"id":203,"href":"https:\/\/kktljr.top\/index.php\/wp-json\/wp\/v2\/posts\/133\/revisions\/203"}],"wp:attachment":[{"href":"https:\/\/kktljr.top\/index.php\/wp-json\/wp\/v2\/media?parent=133"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/kktljr.top\/index.php\/wp-json\/wp\/v2\/categories?post=133"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/kktljr.top\/index.php\/wp-json\/wp\/v2\/tags?post=133"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}