{"id":122989,"date":"2026-11-06T05:24:45","date_gmt":"2026-11-05T21:24:45","guid":{"rendered":"https:\/\/www.wsisp.com\/helps\/122989.html"},"modified":"2026-11-06T05:24:45","modified_gmt":"2026-11-05T21:24:45","slug":"%e7%ac%ac%e5%8d%81%e4%ba%94%e7%ab%a0-%e4%ba%ba%e5%b7%a5%e6%99%ba%e8%83%bd%e5%9f%ba%e7%a1%80","status":"publish","type":"post","link":"https:\/\/www.wsisp.com\/helps\/122989.html","title":{"rendered":"\u7b2c\u5341\u4e94\u7ae0 \u4eba\u5de5\u667a\u80fd\u57fa\u7840"},"content":{"rendered":"<h2>\u7b2c\u5341\u4e94\u7ae0 \u4eba\u5de5\u667a\u80fd\u57fa\u7840<\/h2>\n<p>\u7b2c\u5341\u56db\u7ae0\u8bb2\u5b8c STL&#xff0c;C&#043;&#043; \u7684\u5e38\u7528\u62db\u5f0f\u57fa\u672c\u9f50\u4e86\u3002\u672c\u7ae0\u4e0d\u5b66\u65b0\u8bed\u6cd5&#xff0c;\u62ff\u524d\u5341\u56db\u7ae0\u7684\u4e1c\u897f\u62fc\u4e2a\u4f1a\u81ea\u5df1\u957f\u672c\u4e8b\u7684\u7a0b\u5e8f\u3002\u4e0a\u7ae0\u7ed3\u5c3e\u6392\u7684\u662f\u5f02\u5e38\u5904\u7406&#xff0c;\u90a3\u7ae0\u5f80\u540e\u653e\u4e00\u7ad9&#xff0c;\u5148\u4e86\u4e86\u5b66\u59d4\u8fd9\u6869\u4e8b\u3002<\/p>\n<h3>1. \u4ece\u751f\u7269\u795e\u7ecf\u5143\u5230\u611f\u77e5\u5668<\/h3>\n<h4>1.1 \u751f\u7269\u795e\u7ecf\u5143\u90a3\u70b9\u4e8b<\/h4>\n<p>\u5927\u8111\u91cc\u7ba1\u601d\u8003\u7684\u7ec6\u80de\u53eb\u795e\u7ecf\u5143&#xff0c;\u4e00\u4e2a\u795e\u7ecf\u5143\u957f\u8fd9\u4e48\u526f\u6a21\u6837\u3002\u4e00\u5806\u6811\u7a81\u4f38\u51fa\u53bb\u6536\u4fe1\u53f7&#xff0c;\u50cf\u6811\u679d\u5206\u53c9\u3002\u4fe1\u53f7\u6c47\u5230\u7ec6\u80de\u4f53&#xff0c;\u6512\u591f\u5206\u91cf\u5c31\u5174\u594b\u3002\u8f74\u7a81\u628a\u5174\u594b\u4f20\u51fa\u53bb&#xff0c;\u4ea4\u7ed9\u4e0b\u4e00\u4e2a\u795e\u7ecf\u5143\u7684\u6811\u7a81\u3002\u6811\u7a81\u548c\u8f74\u7a81\u63a5\u5934\u7684\u5730\u65b9&#xff0c;\u53eb\u7a81\u89e6\u3002<\/p>\n<p>\u250c\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2510<br \/>\n\u2502 \u5148\u770b\u771f\u7684\u795e\u7ecf\u5143                                    \u2502<br \/>\n\u251c\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2524<br \/>\n\u2502 \u6811\u7a81\u6536\u4fe1\u53f7&#xff0c;\u8f74\u7a81\u4f20\u4fe1\u53f7                            \u2502<br \/>\n\u2502                                                   \u2502<br \/>\n\u2502   \u6811\u7a81 x1 \u2500\u2500\u2510                                     \u2502<br \/>\n\u2502   \u6811\u7a81 x2 \u2500\u2500\u253c\u2500\u2500&gt; \u7ec6\u80de\u4f53 \u2500\u2500&gt; \u8f74\u7a81 \u2500\u2500&gt; \u4e0b\u6e38\u795e\u7ecf\u5143   \u2502<br \/>\n\u2502   \u6811\u7a81 xn \u2500\u2500\u2518   \u6512\u591f\u9608\u503c        \u628a\u4fe1\u53f7\u4f20\u51fa\u53bb      \u2502<br \/>\n\u2502                  \u5c31\u5174\u594b                           \u2502<br \/>\n\u2502                                                   \u2502<br \/>\n\u2502   \u7a81\u89e6\u662f\u8fde\u63a5\u70b9&#xff0c;\u5f3a\u5ea6\u53ef\u5927\u53ef\u5c0f                      \u2502<br \/>\n\u2502   \u5b66\u4e60\u4e0d\u6539\u7ebf\u8def&#xff0c;\u6539\u7684\u662f\u7a81\u89e6\u5f3a\u5ea6                    \u2502<br \/>\n\u2514\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2518<\/p>\n<p>\u5173\u952e\u5728\u7a81\u89e6\u3002\u4e24\u4e2a\u795e\u7ecf\u5143\u4e4b\u95f4\u7684\u8fde\u63a5\u5f3a\u5ea6\u662f\u53ef\u53d8\u7684&#xff0c;\u6709\u7684\u7a81\u89e6\u4e00\u78b0\u5c31\u71c3&#xff0c;\u6709\u7684\u4f7f\u52b2\u634f\u4e5f\u4e0d\u51fa\u58f0\u3002\u5927\u8111\u5b66\u65b0\u4e1c\u897f&#xff0c;\u9760\u7684\u4e0d\u662f\u91cd\u65b0\u63a5\u7ebf&#xff0c;\u662f\u52a0\u5f3a\u8be5\u52a0\u5f3a\u7684\u7a81\u89e6&#xff0c;\u51cf\u5f31\u8be5\u51cf\u5f31\u7684\u3002\u5a74\u513f\u5b66\u8d70\u8def\u662f\u8fd9\u4e48\u5b66\u7684&#xff0c;\u4eba\u5b66 C&#043;&#043; \u4e5f\u662f\u8fd9\u4e48\u5b66\u7684&#xff0c;\u7ec3\u8fc7\u7684\u62db\u5fd8\u4e0d\u6389&#xff0c;\u6ca1\u78b0\u8fc7\u7684\u62db\u751f\u758f\u30021943 \u5e74&#xff0c;McCulloch \u548c Pitts \u628a\u8fd9\u5957\u673a\u5236\u5199\u6210\u4e86\u6570\u5b66\u5f0f\u5b50&#xff0c;\u672c\u7ae0\u8981\u7528\u7684\u5c31\u662f\u5b83\u3002<\/p>\n<h4>1.2 \u6570\u5b66\u6a21\u578b\u3001\u52a0\u6743\u6c42\u548c\u52a0\u6fc0\u6d3b<\/h4>\n<p>\u6570\u5b66\u7248\u957f\u8fd9\u6837\u3002\u6811\u7a81\u6536\u5230\u7684\u4fe1\u53f7\u53eb\u8f93\u5165&#xff0c;\u4e00\u4e2a\u795e\u7ecf\u5143\u6709\u591a\u4e2a\u8f93\u5165&#xff0c;\u8bb0\u4f5c x1 \u5230 xn\u3002\u7a81\u89e6\u5f3a\u5ea6\u53eb\u6743\u91cd&#xff0c;\u8bb0\u4f5c w1 \u5230 wn&#xff0c;\u8f93\u5165\u8d8a\u8981\u7d27&#xff0c;\u6743\u91cd\u8d8a\u5927\u3002\u7ec6\u80de\u4f53\u6512\u5206\u91cf\u8fd9\u4ef6\u4e8b&#xff0c;\u5c31\u662f\u52a0\u6743\u6c42\u548c&#xff0c;\u6bcf\u4e2a\u8f93\u5165\u4e58\u81ea\u5df1\u7684\u6743\u91cd&#xff0c;\u518d\u52a0\u8d77\u6765\u3002\u8f74\u7a81\u90a3\u4e00\u5200\u5207&#xff0c;\u53eb\u6fc0\u6d3b\u51fd\u6570&#xff0c;\u603b\u548c\u8fc7\u4e86\u5173\u53e3\u8f93\u51fa 1&#xff0c;\u6ca1\u8fc7\u8f93\u51fa 0\u3002<\/p>\n<p>\u250c\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2510<br \/>\n\u2502 \u795e\u7ecf\u5143\u7684\u6570\u5b66\u6a21\u578b                         \u2502<br \/>\n\u251c\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2524<br \/>\n\u2502 \u751f\u7269\u90a3\u5957&#xff0c;\u7ffb\u8bd1\u6210\u6570\u5b66                     \u2502<br \/>\n\u2502                                          \u2502<br \/>\n\u2502   \u8f93\u5165 x1 x2 &#8230; xn     \u6811\u7a81\u6536\u5230\u7684\u4fe1\u53f7   \u2502<br \/>\n\u2502   \u6743\u91cd w1 w2 &#8230; wn     \u7a81\u89e6\u5f3a\u5ea6         \u2502<br \/>\n\u2502   \u504f\u7f6e b                \u9608\u503c\u642c\u4e2a\u5bb6       \u2502<br \/>\n\u2502                                          \u2502<br \/>\n\u2502   z &#061; w1*x1 &#043; w2*x2 &#043; &#8230; &#043; wn*xn &#043; b    \u2502<br \/>\n\u2502                                          \u2502<br \/>\n\u2502   z &gt;&#061; 0 \u8f93\u51fa 1&#xff0c;\u5426\u5219\u8f93\u51fa 0              \u2502<br \/>\n\u2502   \u8fd9\u4e00\u6b65\u53eb\u6fc0\u6d3b\u51fd\u6570&#xff0c;\u611f\u77e5\u5668\u7528\u9636\u8dc3         \u2502<br \/>\n\u2514\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2518<\/p>\n<p>\u6fc0\u6d3b\u51fd\u6570\u7528\u9636\u8dc3&#xff0c;\u56fe\u957f\u8fd9\u6837\u3002\u8d1f\u534a\u8f74\u4e00\u5f8b 0&#xff0c;0 \u8fd9\u4e00\u70b9\u7ffb\u4e0a\u53bb&#xff0c;\u6b63\u534a\u8f74\u4e00\u5f8b 1\u3002\u7c97\u7cd9&#xff0c;\u4f46\u611f\u77e5\u5668\u5c31\u9760\u5b83\u3002<\/p>\n<p>\u250c\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2510<br \/>\n\u2502 \u6fc0\u6d3b\u51fd\u6570\u7528\u9636\u8dc3                  \u2502<br \/>\n\u251c\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2524<br \/>\n\u2502 \u9636\u8dc3\u51fd\u6570&#xff0c;\u4e00\u5200\u5207                \u2502<br \/>\n\u2502                                 \u2502<br \/>\n\u2502   y                             \u2502<br \/>\n\u2502   1 \u2524         \u250c\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500      \u2502<br \/>\n\u2502     \u2502         \u2502                 \u2502<br \/>\n\u2502   0 \u253c\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2518                 \u2502<br \/>\n\u2502     \u2514\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2534\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500&gt; z   \u2502<br \/>\n\u2502     \u8d1f         0                \u2502<br \/>\n\u2514\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2518<\/p>\n<p>\u504f\u7f6e b \u662f\u6c42\u548c\u4e4b\u540e\u52a0\u7684\u4e00\u4e2a\u5e38\u6570&#xff0c;\u6b63\u8d1f\u53ef\u8c03\u3002\u6743\u91cd\u7ba1\u5404\u8f93\u5165\u7684\u5206\u91cf&#xff0c;\u504f\u7f6e\u7ba1\u603b\u95e8\u69db&#xff0c;\u4e24\u6837\u51d1\u4e00\u8d77&#xff0c;\u624d\u6446\u5f97\u51c6\u4e00\u5200\u5207\u7684\u4f4d\u7f6e\u3002<\/p>\n<p>\u7528 C&#043;&#043; \u5199\u8fd9\u4e2a\u795e\u7ecf\u5143&#xff0c;\u4e00\u4e2a struct \u5c31\u591f\u3002\u4e24\u4e2a\u6743\u91cd\u4e00\u4e2a\u504f\u7f6e\u662f\u6570\u636e&#xff0c;feedforward \u662f\u51fd\u6570&#xff0c;\u7b2c\u4e5d\u7ae0 struct \u7684\u8001\u7528\u6cd5\u3002<\/p>\n<p>#include &lt;iostream&gt;<br \/>\nusing namespace std;<\/p>\n<p>struct Neuron {<br \/>\n    double w[2];<br \/>\n    double b;<\/p>\n<p>    int feedforward(double x1, double x2) {<br \/>\n        double z &#061; w[0] * x1 &#043; w[1] * x2 &#043; b;<br \/>\n        return z &gt;&#061; 0 ? 1 : 0;<br \/>\n    }<br \/>\n};<\/p>\n<p>int main() {<br \/>\n    double x[4][2] &#061; { {0, 0}, {0, 1}, {1, 0}, {1, 1} };<br \/>\n    Neuron andGate;<br \/>\n    andGate.w[0] &#061; 1.0;<br \/>\n    andGate.w[1] &#061; 1.0;<br \/>\n    andGate.b &#061; -1.5;<br \/>\n    cout &lt;&lt; &#034;AND \u95e8&#034; &lt;&lt; endl;<br \/>\n    for (int i &#061; 0; i &lt; 4; i&#043;&#043;) {<br \/>\n        cout &lt;&lt; &#034;  (&#034; &lt;&lt; x[i][0] &lt;&lt; &#034;, &#034; &lt;&lt; x[i][1] &lt;&lt; &#034;) \u5f97 &#034;<br \/>\n             &lt;&lt; andGate.feedforward(x[i][0], x[i][1]) &lt;&lt; endl;<br \/>\n    }<br \/>\n    Neuron orGate;<br \/>\n    orGate.w[0] &#061; 1.0;<br \/>\n    orGate.w[1] &#061; 1.0;<br \/>\n    orGate.b &#061; -0.5;<br \/>\n    cout &lt;&lt; &#034;OR \u95e8&#034; &lt;&lt; endl;<br \/>\n    for (int i &#061; 0; i &lt; 4; i&#043;&#043;) {<br \/>\n        cout &lt;&lt; &#034;  (&#034; &lt;&lt; x[i][0] &lt;&lt; &#034;, &#034; &lt;&lt; x[i][1] &lt;&lt; &#034;) \u5f97 &#034;<br \/>\n             &lt;&lt; orGate.feedforward(x[i][0], x[i][1]) &lt;&lt; endl;<br \/>\n    }<br \/>\n    return 0;<br \/>\n}<\/p>\n<p>AND \u95e8\u8f93\u51fa 0 0 0 1&#xff0c;\u4e24\u4e2a\u90fd\u71c3\u624d\u71c3\u3002\u504f\u7f6e\u4ece -1.5 \u632a\u5230 -0.5&#xff0c;\u6743\u91cd\u4e0d\u52a8&#xff0c;\u8f93\u51fa\u53d8\u6210 0 1 1 1&#xff0c;OR \u95e8\u3002\u4e00\u4e2a\u795e\u7ecf\u5143&#xff0c;\u6446\u5bf9\u6743\u91cd\u548c\u504f\u7f6e&#xff0c;\u5c31\u80fd\u8868\u793a\u903b\u8f91\u95e8\u3002\u8fd9\u4e5f\u662f\u7b2c\u5341\u7ae0\u90a3\u53e5\u8001\u8bdd&#xff0c;\u5bf9\u8c61\u91cc\u653e\u6570\u636e\u653e\u51fd\u6570&#xff0c;\u6570\u636e\u548c\u51fd\u6570\u51d1\u4e00\u5bf9&#xff0c;\u4e8b\u5c31\u6210\u4e86\u3002<\/p>\n<h4>1.3 \u611f\u77e5\u5668\u3001\u4e00\u5c42\u6743\u91cd\u76f4\u901a\u8f93\u51fa<\/h4>\n<p>1957 \u5e74&#xff0c;Rosenblatt \u628a\u795e\u7ecf\u5143\u62fc\u6210\u4e86\u4e00\u53f0\u673a\u5668&#xff0c;\u53eb\u611f\u77e5\u5668\u3002\u8f93\u5165\u76f4\u8fde\u8f93\u51fa&#xff0c;\u4e2d\u95f4\u6ca1\u6709\u5c42&#xff0c;\u6240\u4ee5\u53eb\u5355\u5c42\u611f\u77e5\u5668\u3002<\/p>\n<p>\u250c\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2510<br \/>\n\u2502 \u611f\u77e5\u5668\u957f\u8fd9\u6837                                \u2502<br \/>\n\u251c\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2524<br \/>\n\u2502 \u4e0a\u4e16\u7eaa\u7684\u8001\u8bbe\u8ba1&#xff0c;\u7528\u5230\u73b0\u5728                    \u2502<br \/>\n\u2502                                             \u2502<br \/>\n\u2502   x1 \u2500\u2500w1\u2500\u2500\u2510                                \u2502<br \/>\n\u2502   x2 \u2500\u2500w2\u2500\u2500\u253c\u2500\u2500&gt; \u52a0\u6743\u6c42\u548c z \u2500\u2500&gt; \u9636\u8dc3 \u2500\u2500&gt; y   \u2502<br \/>\n\u2502   1  \u2500\u2500b\u2500\u2500\u2500\u2518                                \u2502<br \/>\n\u2502                                             \u2502<br \/>\n\u2502   \u6743\u91cd\u4e00\u5c42&#xff0c;\u76f4\u901a\u8f93\u51fa                        \u2502<br \/>\n\u2514\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2518<\/p>\n<p>\u73b0\u5728\u7684\u611f\u77e5\u5668\u65e9\u4e0d\u662f\u4e00\u53f0\u673a\u5668\u4e86&#xff0c;\u5c31\u662f\u4e0a\u9762\u90a3\u4e2a Neuron \u52a0\u4e00\u6bb5\u8bad\u7ec3\u4ee3\u7801\u3002\u9aa8\u67b6\u6ca1\u53d8&#xff0c;\u8f93\u5165\u6a2a\u6392&#xff0c;\u6bcf\u4e2a\u8f93\u5165\u914d\u4e00\u4e2a\u6743\u91cd&#xff0c;\u6c47\u603b&#xff0c;\u8fc7\u6fc0\u6d3b&#xff0c;\u51fa\u4e00\u4e2a\u6570\u3002<\/p>\n<p>\u611f\u77e5\u5668\u7684\u672c\u4e8b&#xff0c;\u8bf4\u5230\u5e95\u662f\u753b\u4e00\u6761\u76f4\u7ebf\u3002\u4e24\u4e2a\u8f93\u5165\u65f6&#xff0c;\u5224\u5b9a\u8fb9\u754c\u662f\u5e73\u9762\u4e0a\u4e00\u6761\u7ebf\u3002\u4e09\u4e2a\u8f93\u5165\u65f6&#xff0c;\u662f\u7a7a\u95f4\u91cc\u4e00\u5f20\u5e73\u9762\u3002\u7ebf\u7684\u4e00\u8fb9\u5224 1&#xff0c;\u53e6\u4e00\u8fb9\u5224 0\u3002<\/p>\n<p>\u250c\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2510<br \/>\n\u2502 \u7ebf\u6027\u53ef\u5206                               \u2502<br \/>\n\u251c\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2524<br \/>\n\u2502 \u4e00\u6761\u76f4\u7ebf&#xff0c;\u628a\u4e24\u7c7b\u6837\u672c\u5206\u5f00               \u2502<br \/>\n\u2502                                        \u2502<br \/>\n\u2502    o (0, 3)        \u2502    &#043; (3, 3)       \u2502<br \/>\n\u2502    o (0, 1)        \u2502    &#043; (3, 1)       \u2502<br \/>\n\u2502   \u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u253c\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500&gt; x1   \u2502<br \/>\n\u2502      \u6807\u7b7e 0        \u2502    \u6807\u7b7e 1         \u2502<br \/>\n\u2502                                        \u2502<br \/>\n\u2502   \u76f4\u7ebf\u5de6\u8fb9\u4e00\u5f8b 0&#xff0c;\u53f3\u8fb9\u4e00\u5f8b 1           \u2502<br \/>\n\u2514\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2518<\/p>\n<p>\u50cf\u8fd9\u6837\u4e00\u6761\u7ebf\u80fd\u628a\u4e24\u7c7b\u6837\u672c\u5206\u5f00\u7684&#xff0c;\u53eb\u7ebf\u6027\u53ef\u5206\u3002AND \u95e8\u7ebf\u6027\u53ef\u5206&#xff0c;OR \u95e8\u4e5f\u7ebf\u6027\u53ef\u5206&#xff0c;1.2 \u8282\u90a3\u4e24\u5957\u624b\u6446\u6743\u91cd\u5c31\u662f\u8bc1\u636e\u3002\u5f02\u6216\u4e0d\u884c&#xff0c;\u8fd9\u4e2a\u5751 2.5 \u8282\u4e13\u95e8\u649e\u3002<\/p>\n<h4>1.4 \u6743\u91cd\u80fd\u624b\u6446&#xff0c;\u7136\u540e\u5462<\/h4>\n<p>\u56de\u5934\u770b AND \u95e8\u90a3\u5957\u6743\u91cd&#xff0c;w1 \u548c w2 \u90fd\u53d6 1&#xff0c;\u504f\u7f6e -1.5&#xff0c;\u56db\u4e2a\u6837\u672c\u5168\u5224\u5bf9\u3002<\/p>\n<p>\u250c\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2510<br \/>\n\u2502 \u5148\u6446\u4e00\u5957\u770b\u770b                    \u2502<br \/>\n\u251c\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2524<br \/>\n\u2502 AND \u95e8&#xff0c;\u5148\u624b\u6446\u4e00\u5957\u6743\u91cd          \u2502<br \/>\n\u2502                                 \u2502<br \/>\n\u2502 &#043;&#8212;&#8212;&#8211;&#043;&#8212;&#8212;&#8211;&#043;&#8212;&#8212;&#8211;&#043;    \u2502<br \/>\n\u2502 |x1      |x2      |t       |    \u2502<br \/>\n\u2502 &#043;&#8212;&#8212;&#8211;&#043;&#8212;&#8212;&#8211;&#043;&#8212;&#8212;&#8211;&#043;    \u2502<br \/>\n\u2502 |0       |0       |0       |    \u2502<br \/>\n\u2502 |0       |1       |0       |    \u2502<br \/>\n\u2502 |1       |0       |0       |    \u2502<br \/>\n\u2502 |1       |1       |1       |    \u2502<br \/>\n\u2502 &#043;&#8212;&#8212;&#8211;&#043;&#8212;&#8212;&#8211;&#043;&#8212;&#8212;&#8211;&#043;    \u2502<br \/>\n\u2502                                 \u2502<br \/>\n\u2502   \u53d6 w1 &#061; 1&#xff0c;w2 &#061; 1&#xff0c;b &#061; -1.5   \u2502<br \/>\n\u2502   \u56db\u4e2a\u6837\u672c\u5168\u5224\u5bf9                \u2502<br \/>\n\u2514\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2518<\/p>\n<p>\u6362\u4e2a OR \u95e8&#xff0c;\u504f\u7f6e\u5f97\u632a\u5230 -0.5\u3002\u8981\u662f\u5341\u4e2a\u8f93\u5165&#xff0c;\u6743\u91cd\u6709\u5341\u4e2a\u6570\u8981\u6446&#xff0c;\u6446\u6cd5\u8fd8\u8bf4\u4e0d\u6e05\u6709\u4ec0\u4e48\u89c4\u5f8b\u3002\u6570\u636e\u53d8\u6210\u4e09\u5343\u4efd\u6210\u7ee9\u5355&#xff0c;\u624b\u6446\u5230\u7334\u5e74\u9a6c\u6708\u3002<\/p>\n<p>\u95ee\u9898\u8fd9\u5c31\u9732\u5934\u4e86\u3002\u611f\u77e5\u5668\u80fd\u8868\u793a AND&#xff0c;\u53ef\u8c01\u6765\u8868\u793a\u611f\u77e5\u5668\u3002\u7b54\u6848\u662f\u8ba9\u6570\u636e\u6765\u8868\u793a\u3002\u6743\u91cd\u4e0d\u8be5\u624b\u6446&#xff0c;\u8be5\u4ece\u6837\u672c\u91cc\u5b66\u51fa\u6765\u3002\u7b2c 2 \u8282\u8bb2\u600e\u4e48\u5b66\u3002<\/p>\n<h3>2. \u6a21\u578b\u8bad\u7ec3\u7b97\u6cd5<\/h3>\n<h4>2.1 \u76d1\u7763\u5b66\u4e60\u4e09\u4ef6\u5957<\/h4>\n<p>\u8ba9\u673a\u5668\u5b66\u672c\u4e8b&#xff0c;\u5f97\u5148\u51d1\u9f50\u4e09\u6837\u4e1c\u897f\u3002<\/p>\n<p>\u5934\u4e00\u6837\u662f\u6837\u672c\u3002\u6bcf\u4e2a\u6837\u672c\u5206\u4e24\u534a&#xff0c;\u7279\u5f81\u548c\u6807\u7b7e\u3002\u7279\u5f81\u662f\u8f93\u5165&#xff0c;\u6302\u79d1\u9884\u6d4b\u91cc\u5c31\u662f\u4f5c\u4e1a\u5206\u548c\u6708\u8003\u5206\u3002\u6807\u7b7e\u662f\u6807\u51c6\u7b54\u6848&#xff0c;\u6302\u662f 1&#xff0c;\u4e0d\u6302\u662f 0\u3002\u4e09\u5341\u4efd\u6210\u7ee9\u5355\u914d\u4e09\u5341\u4e2a\u7b54\u6848&#xff0c;\u5c31\u662f\u6837\u672c\u96c6\u3002<\/p>\n<p>\u7b2c\u4e8c\u6837\u662f\u6a21\u578b\u3002\u672c\u4f8b\u5b50\u7684\u6a21\u578b\u5c31\u662f\u611f\u77e5\u5668&#xff0c;y \u662f\u5b83\u7167\u7740\u7279\u5f81\u7b97\u51fa\u6765\u7684\u5224\u65ad\u3002\u6a21\u578b\u91cc\u5e26\u53c2\u6570&#xff0c;\u6743\u91cd\u548c\u504f\u7f6e&#xff0c;\u5b66\u4e1c\u897f\u5b66\u7684\u5c31\u662f\u5b83\u4eec\u3002<\/p>\n<p>\u7b2c\u4e09\u6837\u662f\u635f\u5931\u3002\u635f\u5931\u8861\u91cf\u6a21\u578b\u73b0\u5728\u6709\u591a\u9519\u3002\u611f\u77e5\u5668\u7684\u635f\u5931\u5f88\u6734\u7d20&#xff0c;\u6570\u4e00\u6570\u5206\u9519\u7684\u6837\u672c\u6709\u51e0\u4e2a&#xff0c;\u9519\u5f97\u8d8a\u591a\u635f\u5931\u8d8a\u5927\u3002<\/p>\n<p>\u8bad\u7ec3\u5c31\u662f\u628a\u635f\u5931\u5f80 0 \u8d76\u3002\u8d76\u7684\u6cd5\u5b50\u662f\u5f80\u9519\u8bef\u7684\u53cd\u65b9\u5411\u8fc8\u4e00\u5c0f\u6b65&#xff0c;\u54ea\u9519\u4e86\u6539\u54ea\u3002\u611f\u77e5\u5668\u7528\u7684\u6b65\u6cd5&#xff0c;\u53eb\u611f\u77e5\u5668\u5b66\u4e60\u89c4\u5219&#xff0c;2.2 \u8282\u5c55\u5f00\u3002<\/p>\n<p>\u771f\u8981\u6269\u5c55&#xff0c;\u628a Perceptron \u4f9b\u5728\u57fa\u7c7b\u91cc&#xff0c;SVM\u3001\u51b3\u7b56\u6811\u5404\u6d3e\u751f\u4e00\u4efd&#xff0c;\u57fa\u7c7b\u6307\u9488\u6570\u7ec4\u4e00\u5faa\u73af&#xff0c;\u7b2c\u5341\u4e8c\u7ae0\u90a3\u5957\u591a\u6001\u76f4\u63a5\u80fd\u7528\u3002\u672c\u7ae0\u5355\u7ebf\u4f5c\u6218&#xff0c;\u4e0d\u94fa\u5f00\u3002<\/p>\n<h4>2.2 \u611f\u77e5\u5668\u5b66\u4e60\u89c4\u5219<\/h4>\n<p>\u89c4\u5219\u4e00\u884c\u3002\u5bf9\u6bcf\u4e2a\u6837\u672c&#xff0c;\u5148\u7b97 y&#xff0c;\u62ff y \u548c\u6807\u7b7e t \u5bf9\u7b54\u6848\u3002\u731c\u5bf9\u4e86&#xff0c;\u6743\u91cd\u539f\u6837\u4e0d\u52a8\u3002\u731c\u9519\u4e86&#xff0c;\u5f80\u6b63\u786e\u65b9\u5411\u63a8\u4e00\u628a&#xff0c;w \u53d8\u6210 w \u52a0\u4e0a \u5b66\u4e60\u7387\u3001\u8bef\u5dee\u3001\u8f93\u5165 \u4e09\u8005\u7684\u4e58\u79ef&#xff0c;\u5176\u4e2d\u8bef\u5dee\u662f t \u51cf y\u3002\u504f\u7f6e\u540c\u7406&#xff0c;\u52a0\u5b66\u4e60\u7387\u4e58\u8bef\u5dee\u3002<\/p>\n<p>\u250c\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2510<br \/>\n\u2502 \u731c\u9519\u624d\u52a8\u624b                                          \u2502<br \/>\n\u251c\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2524<br \/>\n\u2502 \u66f4\u65b0\u89c4\u5219\u7684\u4e09\u5f20\u9762\u5b54                                  \u2502<br \/>\n\u2502                                                     \u2502<br \/>\n\u2502 &#043;&#8212;&#8212;&#8212;-&#043;&#8212;&#8212;&#8211;&#043;&#8212;&#8212;&#8212;&#8212;&#8211;&#043;&#8212;&#8212;&#8212;&#8212;&#043;   \u2502<br \/>\n\u2502 |\u60c5\u51b5      |t \u5bf9 y  |\u6743\u91cd\u600e\u4e48\u52a8    |\u4eba\u8bdd        |   \u2502<br \/>\n\u2502 &#043;&#8212;&#8212;&#8212;-&#043;&#8212;&#8212;&#8211;&#043;&#8212;&#8212;&#8212;&#8212;&#8211;&#043;&#8212;&#8212;&#8212;&#8212;&#043;   \u2502<br \/>\n\u2502 |\u731c\u5c0f\u4e86    |1 \u5bf9 0  |\u5f80\u8f93\u5165\u65b9\u5411\u52a0  |\u8be5\u71c3\u6ca1\u71c3    |   \u2502<br \/>\n\u2502 |\u731c\u5927\u4e86    |0 \u5bf9 1  |\u5f80\u53cd\u65b9\u5411\u51cf    |\u4e0d\u8be5\u71c3\u778e\u71c3  |   \u2502<br \/>\n\u2502 |\u731c\u5bf9\u4e86    |\u4e00\u6837    |\u539f\u5730\u4e0d\u52a8      |\u4e0d\u6539\u5377\u5b50    |   \u2502<br \/>\n\u2502 &#043;&#8212;&#8212;&#8212;-&#043;&#8212;&#8212;&#8211;&#043;&#8212;&#8212;&#8212;&#8212;&#8211;&#043;&#8212;&#8212;&#8212;&#8212;&#043;   \u2502<br \/>\n\u2502                                                     \u2502<br \/>\n\u2502   \u516c\u5f0f\u4e00\u884c&#xff0c;w \u5f80 t \u51cf y \u7684\u65b9\u5411\u8d70                    \u2502<br \/>\n\u2514\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2518<\/p>\n<p>\u4e09\u79cd\u9762\u5b54\u3002\u731c\u5c0f\u4e86&#xff0c;\u6807\u7b7e 1 \u8f93\u51fa 0&#xff0c;\u6743\u91cd\u5f80\u8f93\u5165\u65b9\u5411\u52a0&#xff0c;\u7ed9\u8fd9\u6761\u8bc1\u636e\u52a0\u7801\u3002\u731c\u5927\u4e86&#xff0c;\u6807\u7b7e 0 \u8f93\u51fa 1&#xff0c;\u5f80\u53cd\u65b9\u5411\u51cf&#xff0c;\u7ed9\u8fd9\u6761\u8bc1\u636e\u964d\u6e29\u3002\u731c\u5bf9\u4e86\u4e0d\u52a8&#xff0c;\u5bf9\u7b54\u6848\u4e0d\u6539\u5377\u5b50\u3002\u504f\u7f6e\u7684\u8f93\u5165\u6052\u7b49\u4e8e 1&#xff0c;\u6240\u4ee5\u5b83\u6bcf\u6b21\u90fd\u8ddf\u7740\u8bef\u5dee\u8d70&#xff0c;\u4e0d\u504f\u98df\u3002<\/p>\n<p>\u5b66\u4e60\u7387\u662f\u6b65\u5b50\u5927\u5c0f\u3002\u6b65\u5b50\u5927\u5b66\u5f97\u5feb&#xff0c;\u5bb9\u6613\u51b2\u8fc7\u5934\u3002\u6b65\u5b50\u5c0f\u5b66\u5f97\u7a33&#xff0c;\u5c31\u662f\u632a\u5f97\u6162\u3002\u5148\u53d6 0.1&#xff0c;\u5e38\u89c1\u8d77\u70b9\u3002<\/p>\n<p>\u5355\u624b\u63a8\u4e00\u4e2a\u6837\u672c\u3002\u6743\u91cd\u548c\u504f\u7f6e\u90fd\u662f 0&#xff0c;\u5b66\u4e60\u7387 0.1&#xff0c;\u6837\u672c (1, 1)&#xff0c;\u6807\u7b7e 1\u3002<\/p>\n<p>#include &lt;iostream&gt;<br \/>\nusing namespace std;<\/p>\n<p>int main() {<br \/>\n    double w1 &#061; 0.0, w2 &#061; 0.0, b &#061; 0.0;<br \/>\n    double lr &#061; 0.1;<br \/>\n    double x1 &#061; 1.0, x2 &#061; 1.0;<br \/>\n    int t &#061; 1;<br \/>\n    double z &#061; w1 * x1 &#043; w2 * x2 &#043; b;<br \/>\n    int y &#061; z &gt; 0 ? 1 : 0;<br \/>\n    double err &#061; t &#8211; y;<br \/>\n    cout &lt;&lt; &#034;\u66f4\u65b0\u524d\u6743\u91cd (&#034; &lt;&lt; w1 &lt;&lt; &#034;, &#034; &lt;&lt; w2 &lt;&lt; &#034;) \u504f\u7f6e &#034; &lt;&lt; b &lt;&lt; endl;<br \/>\n    cout &lt;&lt; &#034;z &#061; &#034; &lt;&lt; z &lt;&lt; &#034;&#xff0c;y &#061; &#034; &lt;&lt; y &lt;&lt; &#034;&#xff0c;t &#061; &#034; &lt;&lt; t &lt;&lt; endl;<br \/>\n    cout &lt;&lt; &#034;err &#061; t &#8211; y &#061; &#034; &lt;&lt; err &lt;&lt; endl;<br \/>\n    w1 &#043;&#061; lr * err * x1;<br \/>\n    w2 &#043;&#061; lr * err * x2;<br \/>\n    b &#043;&#061; lr * err;<br \/>\n    cout &lt;&lt; &#034;\u66f4\u65b0\u540e\u6743\u91cd (&#034; &lt;&lt; w1 &lt;&lt; &#034;, &#034; &lt;&lt; w2 &lt;&lt; &#034;) \u504f\u7f6e &#034; &lt;&lt; b &lt;&lt; endl;<br \/>\n    return 0;<br \/>\n}<\/p>\n<p>\u52a0\u6743\u548c\u662f 0&#xff0c;\u9636\u8dc3\u5224 0&#xff0c;\u731c\u5c0f\u4e86\u3002\u8bef\u5dee t \u51cf y \u7b49\u4e8e 1\u3002\u4e09\u4e2a\u53c2\u6570\u5404\u52a0 0.1 \u4e58 1 \u4e58\u5bf9\u5e94\u8f93\u5165&#xff0c;\u6743\u91cd\u53d8 (0.1, 0.1)&#xff0c;\u504f\u7f6e\u53d8 0.1\u3002\u5c31\u8fd9\u4e48\u6734\u7d20&#xff0c;\u6ca1\u6709\u9b54\u6cd5\u3002<\/p>\n<p>\u8bad\u7ec3\u7684\u5927\u5faa\u73af&#xff0c;\u4e94\u6b65\u4e00\u4e2a\u5708\u3002<\/p>\n<p>\u250c\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2510<br \/>\n\u2502 \u8bad\u7ec3\u5c31\u8fd9\u4e94\u6b65                        \u2502<br \/>\n\u251c\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2524<br \/>\n\u2502 \u8bad\u7ec3\u7684\u5faa\u73af&#xff0c;\u4e94\u6b65\u4e00\u4e2a\u5708              \u2502<br \/>\n\u2502                                     \u2502<br \/>\n\u2502   1  \u6743\u91cd\u5168 0&#xff0c;\u5f00\u5c40                 \u2502<br \/>\n\u2502   2  \u53d6\u4e00\u4e2a\u6837\u672c&#xff0c;\u7b97 y               \u2502<br \/>\n\u2502   3  y \u548c\u6807\u7b7e t \u5bf9\u7b54\u6848              \u2502<br \/>\n\u2502   4  \u731c\u9519\u4e86&#xff0c;\u6743\u91cd\u5f80\u6b63\u786e\u65b9\u5411\u63a8\u4e00\u628a   \u2502<br \/>\n\u2502   5  \u4e00\u8f6e\u5168\u5bf9&#xff0c;\u6536\u5de5                 \u2502<br \/>\n\u2502                                     \u2502<br \/>\n\u2502   \u7b2c 4 \u6b65\u63a8\u591a\u5c11&#xff0c;\u5b66\u4e60\u7387\u8bf4\u4e86\u7b97       \u2502<br \/>\n\u2514\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2518<\/p>\n<h4>2.3 \u5b8c\u6574\u8bad\u7ec3\u3001AND \u95e8\u4e94\u8f6e\u6536\u5de5<\/h4>\n<p>\u628a\u96f6\u4ef6\u62fc\u6210\u5b8c\u6574\u7a0b\u5e8f\u3002Perceptron \u7c7b\u6536\u6743\u91cd\u3001\u504f\u7f6e\u3001\u5b66\u4e60\u7387\u4e09\u6837\u53c2\u6570&#xff0c;predict \u7ba1\u524d\u5411&#xff0c;trainOne \u7ba1\u5355\u6837\u672c\u66f4\u65b0&#xff0c;main \u91cc\u56db\u4efd\u6837\u672c\u5faa\u73af\u8dd1&#xff0c;\u6bcf\u8f6e\u6570\u4e00\u904d\u9519\u51e0\u4e2a&#xff0c;\u5168\u5bf9\u4e86\u6536\u5de5\u3002<\/p>\n<p>#include &lt;iostream&gt;<br \/>\nusing namespace std;<\/p>\n<p>const int SAMPLES &#061; 4;<\/p>\n<p>class Perceptron {<br \/>\npublic:<br \/>\n    Perceptron(double lr) : learnRate(lr) {<br \/>\n        w[0] &#061; 0.0;<br \/>\n        w[1] &#061; 0.0;<br \/>\n        b &#061; 0.0;<br \/>\n    }<br \/>\n    int predict(double x1, double x2) const {<br \/>\n        double z &#061; b &#043; w[0] * x1 &#043; w[1] * x2;<br \/>\n        return z &gt; 0 ? 1 : 0;<br \/>\n    }<br \/>\n    void trainOne(double x1, double x2, int t) {<br \/>\n        int y &#061; predict(x1, x2);<br \/>\n        if (y !&#061; t) {<br \/>\n            double err &#061; t &#8211; y;<br \/>\n            w[0] &#043;&#061; learnRate * err * x1;<br \/>\n            w[1] &#043;&#061; learnRate * err * x2;<br \/>\n            b &#043;&#061; learnRate * err;<br \/>\n        }<br \/>\n    }<br \/>\n    void show() const {<br \/>\n        cout &lt;&lt; &#034;\u6743\u91cd (&#034; &lt;&lt; w[0] &lt;&lt; &#034;, &#034; &lt;&lt; w[1] &lt;&lt; &#034;) \u504f\u7f6e &#034; &lt;&lt; b;<br \/>\n    }<br \/>\nprivate:<br \/>\n    double w[2];<br \/>\n    double b;<br \/>\n    double learnRate;<br \/>\n};<\/p>\n<p>int main() {<br \/>\n    double x[SAMPLES][2] &#061; { {0, 0}, {0, 1}, {1, 0}, {1, 1} };<br \/>\n    int t[SAMPLES] &#061; {0, 0, 0, 1};<br \/>\n    Perceptron p(0.1);<br \/>\n    for (int epoch &#061; 1; epoch &lt;&#061; 50; epoch&#043;&#043;) {<br \/>\n        int wrong &#061; 0;<br \/>\n        for (int i &#061; 0; i &lt; SAMPLES; i&#043;&#043;) {<br \/>\n            if (p.predict(x[i][0], x[i][1]) !&#061; t[i]) {<br \/>\n                wrong&#043;&#043;;<br \/>\n            }<br \/>\n            p.trainOne(x[i][0], x[i][1], t[i]);<br \/>\n        }<br \/>\n        cout &lt;&lt; &#034;\u7b2c &#034; &lt;&lt; epoch &lt;&lt; &#034; \u8f6e\u9519 &#034; &lt;&lt; wrong &lt;&lt; &#034; \u4e2a&#xff0c;\u5b66\u5b8c&#034;;<br \/>\n        p.show();<br \/>\n        cout &lt;&lt; endl;<br \/>\n        int left &#061; 0;<br \/>\n        for (int i &#061; 0; i &lt; SAMPLES; i&#043;&#043;) {<br \/>\n            if (p.predict(x[i][0], x[i][1]) !&#061; t[i]) {<br \/>\n                left&#043;&#043;;<br \/>\n            }<br \/>\n        }<br \/>\n        if (left &#061;&#061; 0) {<br \/>\n            cout &lt;&lt; &#034;\u56db\u4e2a\u5168\u5bf9&#xff0c;\u6536\u5de5&#034; &lt;&lt; endl;<br \/>\n            break;<br \/>\n        }<br \/>\n    }<br \/>\n    return 0;<br \/>\n}<\/p>\n<p>\u8f93\u51fa\u5728\u8fd9\u91cc\u3002<\/p>\n<p>\u7b2c 1 \u8f6e\u9519 1 \u4e2a&#xff0c;\u5b66\u5b8c\u6743\u91cd (0.1, 0.1) \u504f\u7f6e 0.1<br \/>\n\u7b2c 2 \u8f6e\u9519 3 \u4e2a&#xff0c;\u5b66\u5b8c\u6743\u91cd (0.2, 0.1) \u504f\u7f6e 0<br \/>\n\u7b2c 3 \u8f6e\u9519 3 \u4e2a&#xff0c;\u5b66\u5b8c\u6743\u91cd (0.2, 0.1) \u504f\u7f6e -0.1<br \/>\n\u7b2c 4 \u8f6e\u9519 2 \u4e2a&#xff0c;\u5b66\u5b8c\u6743\u91cd (0.2, 0.2) \u504f\u7f6e -0.1<br \/>\n\u7b2c 5 \u8f6e\u9519 1 \u4e2a&#xff0c;\u5b66\u5b8c\u6743\u91cd (0.2, 0.1) \u504f\u7f6e -0.2<br \/>\n\u56db\u4e2a\u5168\u5bf9&#xff0c;\u6536\u5de5<\/p>\n<p>\u4e94\u8f6e\u6536\u5de5\u3002<\/p>\n<p>\u250c\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2510<br \/>\n\u2502 \u4e94\u8f6e\u6536\u5de5                                 \u2502<br \/>\n\u251c\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2524<br \/>\n\u2502 AND \u95e8\u8bad\u7ec3\u5b9e\u5f55&#xff0c;\u5b66\u4e60\u7387 0.1               \u2502<br \/>\n\u2502                                          \u2502<br \/>\n\u2502   \u8f6e\u6b21     1    2    3    4    5         \u2502<br \/>\n\u2502   \u9519\u51e0\u4e2a   1    3    3    2    1         \u2502<br \/>\n\u2502                                          \u2502<br \/>\n\u2502   \u4e94\u8f6e\u5b66\u5b8c&#xff0c;\u6743\u91cd (0.2, 0.1)&#xff0c;\u504f\u7f6e -0.2   \u2502<br \/>\n\u2502   \u5224\u5b9a\u7ebf  0.2&#215;1 &#043; 0.1&#215;2 \u5927\u4e8e 0.2         \u2502<br \/>\n\u2502   \u56db\u4e2a\u6837\u672c\u70b9&#xff0c;\u53ea\u6709 (1, 1) \u8fc7\u7ebf           \u2502<br \/>\n\u2514\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2518<\/p>\n<p>\u76ef\u4e24\u4e2a\u5730\u65b9\u3002\u4e00\u4e2a\u662f\u9519\u8bef\u6570&#xff0c;1\u30013\u30013\u30012\u30011&#xff0c;\u5148\u5347\u540e\u964d\u3002\u7b2c 2 \u8f6e\u9519\u4e86 3 \u4e2a&#xff0c;\u6bd4\u7b2c 1 \u8f6e\u8fd8\u591a&#xff0c;\u8fd9\u4e0d\u5947\u602a&#xff0c;\u6743\u91cd\u5728\u627e\u4f4d\u7f6e&#xff0c;\u4e2d\u9014\u591a\u9519\u51e0\u4e2a\u6b63\u5e38&#xff0c;\u770b\u7684\u662f\u8d8b\u52bf\u5f80\u4e0b\u3002\u53e6\u4e00\u4e2a\u662f\u5b66\u51fa\u6765\u7684\u5224\u5b9a\u7ebf&#xff0c;0.2 \u4e58 x1 \u52a0 0.1 \u4e58 x2 \u51cf 0.2&#xff0c;\u56db\u4e2a\u70b9\u91cc\u53ea\u6709 (1, 1) \u5728\u7ebf\u8fd9\u8fb9\u3002\u987a\u5e26\u4e00\u63d0&#xff0c;(1, 0) \u7684\u52a0\u6743\u548c\u6b63\u597d\u662f 0&#xff0c;\u9636\u8dc3\u5728 0 \u4e0a\u53d6 0&#xff0c;\u624d\u628a\u5b83\u5224\u6210 0\u3002\u8fb9\u754c\u6837\u672c\u5c31\u8fd9\u5904\u5883&#xff0c;\u9669\u80dc\u3002<\/p>\n<h4>2.4 \u5b66\u4e60\u7387\u8981\u914d\u7740\u5c3a\u5ea6\u7528<\/h4>\n<p>AND \u95e8\u592a\u7b80\u5355&#xff0c;\u4e09\u79cd\u5b66\u4e60\u7387\u90fd\u662f\u4e94\u8f6e\u6536\u655b&#xff0c;\u770b\u4e0d\u51fa\u5dee\u8ddd\u3002\u5b66\u4e60\u7387 2.0 \u5b66\u51fa\u7684\u6743\u91cd\u662f (4, 2) \u504f\u7f6e -4&#xff0c;\u5b66\u4e60\u7387 0.01 \u5b66\u51fa\u7684\u662f (0.02, 0.01) \u504f\u7f6e -0.02\u3002\u7b80\u5355\u9898&#xff0c;\u5feb\u6162\u770b\u4e0d\u51fa\u6765&#xff0c;\u6743\u91cd\u865a\u80d6\u770b\u5f97\u89c1\u3002<\/p>\n<p>\u771f\u6b63\u7684\u5751\u5728\u7279\u5f81\u5c3a\u5ea6\u3002\u62ff\u516d\u4efd\u6210\u7ee9\u5355\u76f4\u63a5\u5582&#xff0c;\u5206\u6570\u662f 40 \u5230 100 \u7684\u91cf\u7ea7&#xff0c;\u5b66\u4e60\u7387 0.1\u3002<\/p>\n<p>#include &lt;iostream&gt;<br \/>\nusing namespace std;<\/p>\n<p>const int N &#061; 6;<\/p>\n<p>class Perceptron {<br \/>\npublic:<br \/>\n    Perceptron(double lr) : learnRate(lr) {<br \/>\n        w[0] &#061; 0.0;<br \/>\n        w[1] &#061; 0.0;<br \/>\n        b &#061; 0.0;<br \/>\n    }<br \/>\n    int predict(double x1, double x2) const {<br \/>\n        double z &#061; b &#043; w[0] * x1 &#043; w[1] * x2;<br \/>\n        return z &gt; 0 ? 1 : 0;<br \/>\n    }<br \/>\n    void trainOne(double x1, double x2, int t) {<br \/>\n        int y &#061; predict(x1, x2);<br \/>\n        if (y !&#061; t) {<br \/>\n            double err &#061; t &#8211; y;<br \/>\n            w[0] &#043;&#061; learnRate * err * x1;<br \/>\n            w[1] &#043;&#061; learnRate * err * x2;<br \/>\n            b &#043;&#061; learnRate * err;<br \/>\n        }<br \/>\n    }<br \/>\nprivate:<br \/>\n    double w[2];<br \/>\n    double b;<br \/>\n    double learnRate;<br \/>\n};<\/p>\n<p>int trainScores(double data[][2], int t[], double lr, bool noisy) {<br \/>\n    Perceptron p(lr);<br \/>\n    for (int epoch &#061; 1; epoch &lt;&#061; 300; epoch&#043;&#043;) {<br \/>\n        int wrong &#061; 0;<br \/>\n        for (int i &#061; 0; i &lt; N; i&#043;&#043;) {<br \/>\n            if (p.predict(data[i][0], data[i][1]) !&#061; t[i]) {<br \/>\n                wrong&#043;&#043;;<br \/>\n            }<br \/>\n            p.trainOne(data[i][0], data[i][1], t[i]);<br \/>\n        }<br \/>\n        if (noisy &amp;&amp; epoch &lt;&#061; 8) {<br \/>\n            cout &lt;&lt; &#034;  \u7b2c &#034; &lt;&lt; epoch &lt;&lt; &#034; \u8f6e\u9519 &#034; &lt;&lt; wrong &lt;&lt; &#034; \u4e2a&#034; &lt;&lt; endl;<br \/>\n        }<br \/>\n        int left &#061; 0;<br \/>\n        for (int i &#061; 0; i &lt; N; i&#043;&#043;) {<br \/>\n            if (p.predict(data[i][0], data[i][1]) !&#061; t[i]) {<br \/>\n                left&#043;&#043;;<br \/>\n            }<br \/>\n        }<br \/>\n        if (left &#061;&#061; 0) {<br \/>\n            return epoch;<br \/>\n        }<br \/>\n    }<br \/>\n    return -1;<br \/>\n}<\/p>\n<p>int main() {<br \/>\n    double raw[N][2] &#061; {<br \/>\n        {85, 78}, {92, 88}, {55, 61}, {100, 95}, {88, 82}, {40, 35}<br \/>\n    };<br \/>\n    int t[N] &#061; {0, 0, 1, 0, 0, 1};<br \/>\n    cout &lt;&lt; &#034;\u539f\u59cb\u5c3a\u5ea6&#xff0c;\u5b66\u4e60\u7387 0.1&#034; &lt;&lt; endl;<br \/>\n    int epochs &#061; trainScores(raw, t, 0.1, true);<br \/>\n    if (epochs &gt; 0) {<br \/>\n        cout &lt;&lt; epochs &lt;&lt; &#034; \u8f6e\u6536\u655b&#034; &lt;&lt; endl;<br \/>\n    } else {<br \/>\n        cout &lt;&lt; &#034;300 \u8f6e\u6ca1\u6536\u655b&#034; &lt;&lt; endl;<br \/>\n    }<br \/>\n    double norm[N][2];<br \/>\n    for (int i &#061; 0; i &lt; N; i&#043;&#043;) {<br \/>\n        norm[i][0] &#061; raw[i][0] \/ 100.0;<br \/>\n        norm[i][1] &#061; raw[i][1] \/ 100.0;<br \/>\n    }<br \/>\n    cout &lt;&lt; &#034;\u5f52\u4e00\u5316\u4e4b\u540e&#xff0c;\u5b66\u4e60\u7387 0.1&#034; &lt;&lt; endl;<br \/>\n    epochs &#061; trainScores(norm, t, 0.1, true);<br \/>\n    cout &lt;&lt; epochs &lt;&lt; &#034; \u8f6e\u6536\u655b&#034; &lt;&lt; endl;<br \/>\n    return 0;<br \/>\n}<\/p>\n<p>\u539f\u59cb\u5c3a\u5ea6\u8dd1 300 \u8f6e\u6ca1\u6536\u655b&#xff0c;\u524d\u516b\u8f6e\u6bcf\u8f6e\u7a33\u5b9a\u9519 3 \u4e2a\u3002\u6743\u91cd\u5728\u51e0\u4e2a\u4f4d\u7f6e\u4e4b\u95f4\u6765\u56de\u649e&#xff0c;\u4e00\u6b65\u8de8\u592a\u5927&#xff0c;\u6c38\u8fdc\u843d\u4e0d\u7a33\u3002\u540c\u4e00\u4efd\u6570\u636e\u9664\u4ee5 100&#xff0c;\u5b66\u4e60\u7387\u4e00\u4e2a\u6570\u4e0d\u6539&#xff0c;2 \u8f6e\u6536\u655b\u3002<\/p>\n<p>\u250c\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2510<br \/>\n\u2502 \u5148\u7f29\u653e&#xff0c;\u518d\u8bad\u7ec3                                         \u2502<br \/>\n\u251c\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2524<br \/>\n\u2502 \u540c\u4e00\u4efd\u6570\u636e&#xff0c;\u4e24\u79cd\u5c3a\u5ea6                                   \u2502<br \/>\n\u2502                                                        \u2502<br \/>\n\u2502 &#043;&#8212;&#8212;&#8212;&#8212;&#8212;-&#043;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#043;&#8212;&#8212;&#8212;&#8212;&#8211;&#043;   \u2502<br \/>\n\u2502 |\u6570\u636e            |\u5b66\u4e60\u7387 0.1        |\u51e0\u8f6e\u6536\u655b      |   \u2502<br \/>\n\u2502 &#043;&#8212;&#8212;&#8212;&#8212;&#8212;-&#043;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#043;&#8212;&#8212;&#8212;&#8212;&#8211;&#043;   \u2502<br \/>\n\u2502 |\u539f\u59cb\u5206\u6570        |\u6743\u91cd\u6765\u56de\u649e        |300 \u8f6e\u6ca1\u6536\u655b  |   \u2502<br \/>\n\u2502 |\u5f52\u4e00\u5316\u5206\u6570      |\u7a33\u7a33\u843d\u5730          |2 \u8f6e          |   \u2502<br \/>\n\u2502 &#043;&#8212;&#8212;&#8212;&#8212;&#8212;-&#043;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#043;&#8212;&#8212;&#8212;&#8212;&#8211;&#043;   \u2502<br \/>\n\u2502                                                        \u2502<br \/>\n\u2502   AND \u95e8\u4e0a\u8bd5 2.0 \/ 0.1 \/ 0.01                          \u2502<br \/>\n\u2502   \u90fd\u80fd 5 \u8f6e\u6536\u655b&#xff0c;\u7b80\u5355\u9898\u770b\u4e0d\u51fa\u5feb\u6162                      \u2502<br \/>\n\u2502   \u5b66\u51fa\u7684\u6743\u91cd\u5374\u5dee 100 \u500d                                \u2502<br \/>\n\u2502   \u4e00\u4e2a (4, 2)&#xff0c;\u4e00\u4e2a (0.02, 0.01)                       \u2502<br \/>\n\u2514\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2518<\/p>\n<p>\u4e24\u6761\u7ecf\u9a8c\u3002\u7279\u5f81\u5148\u7f29\u5230 0 \u5230 1 \u9644\u8fd1&#xff0c;\u9664\u4ee5\u6700\u5927\u503c\u662f\u7cd9\u5feb\u731b\u7684\u505a\u6cd5\u3002\u5b66\u4e60\u7387\u4ece 0.1 \u8d77\u6b65&#xff0c;\u4e0d\u6536\u655b\u5f80\u4e0b\u8c03\u5341\u500d&#xff0c;\u522b\u4e00\u4e0a\u6765\u5c31 1.0\u3002\u8fd9\u4e24\u6761\u4e0d\u662f\u611f\u77e5\u5668\u7684\u5bb6\u89c4&#xff0c;\u662f\u540e\u9762\u6240\u6709\u68af\u5ea6\u7c7b\u8bad\u7ec3\u7684\u901a\u7528\u5f00\u5c40\u3002<\/p>\n<h4>2.5 \u5f02\u6216\u3001\u611f\u77e5\u5668\u7684\u5357\u5899<\/h4>\n<p>\u611f\u77e5\u5668\u6709\u5835\u786c\u8fb9\u754c\u3002\u5f02\u6216&#xff0c;\u4e24\u4e2a\u8f93\u5165\u4e0d\u4e00\u6837\u624d\u8f93\u51fa 1\u3002\u56db\u4e2a\u70b9\u644a\u5728\u5e73\u9762\u4e0a&#xff0c;(0, 1) \u548c (1, 0) \u662f 1&#xff0c;(0, 0) \u548c (1, 1) \u662f 0\u3002<\/p>\n<p>\u250c\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2510<br \/>\n\u2502 \u7ebf\u6027\u4e0d\u53ef\u5206                                     \u2502<br \/>\n\u251c\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2524<br \/>\n\u2502 \u5f02\u6216\u7684\u56db\u4e2a\u70b9&#xff0c;\u4e00\u6761\u76f4\u7ebf\u5207\u4e0d\u5f00                   \u2502<br \/>\n\u2502                                                \u2502<br \/>\n\u2502    \u5de6\u4e0a (0, 1) \u6807\u7b7e 1     \u53f3\u4e0a (1, 1) \u6807\u7b7e 0   \u2502<br \/>\n\u2502                                                \u2502<br \/>\n\u2502    \u5de6\u4e0b (0, 0) \u6807\u7b7e 0     \u53f3\u4e0b (1, 0) \u6807\u7b7e 1   \u2502<br \/>\n\u2502                                                \u2502<br \/>\n\u2502   \u4e00\u6761\u76f4\u7ebf&#xff0c;\u4e00\u8fb9\u5168 1 \u4e00\u8fb9\u5168 0                  \u2502<br \/>\n\u2502   \u8fd9\u6837\u7684\u7ebf\u4e0d\u5b58\u5728                               \u2502<br \/>\n\u2514\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2518<\/p>\n<p>\u4e00\u6761\u76f4\u7ebf&#xff0c;\u60f3\u4e00\u8fb9\u5168\u662f 1 \u4e00\u8fb9\u5168\u662f 0&#xff0c;\u4e0d\u5b58\u5728\u3002\u8dd1\u7ed9\u5b83\u770b\u3002<\/p>\n<p>#include &lt;iostream&gt;<br \/>\nusing namespace std;<\/p>\n<p>const int SAMPLES &#061; 4;<\/p>\n<p>class Perceptron {<br \/>\npublic:<br \/>\n    Perceptron(double lr) : learnRate(lr) {<br \/>\n        w[0] &#061; 0.0;<br \/>\n        w[1] &#061; 0.0;<br \/>\n        b &#061; 0.0;<br \/>\n    }<br \/>\n    int predict(double x1, double x2) const {<br \/>\n        double z &#061; b &#043; w[0] * x1 &#043; w[1] * x2;<br \/>\n        return z &gt; 0 ? 1 : 0;<br \/>\n    }<br \/>\n    void trainOne(double x1, double x2, int t) {<br \/>\n        int y &#061; predict(x1, x2);<br \/>\n        if (y !&#061; t) {<br \/>\n            double err &#061; t &#8211; y;<br \/>\n            w[0] &#043;&#061; learnRate * err * x1;<br \/>\n            w[1] &#043;&#061; learnRate * err * x2;<br \/>\n            b &#043;&#061; learnRate * err;<br \/>\n        }<br \/>\n    }<br \/>\n    void show() const {<br \/>\n        cout &lt;&lt; &#034;\u6743\u91cd (&#034; &lt;&lt; w[0] &lt;&lt; &#034;, &#034; &lt;&lt; w[1] &lt;&lt; &#034;)&#xff0c;\u504f\u7f6e &#034; &lt;&lt; b;<br \/>\n    }<br \/>\nprivate:<br \/>\n    double w[2];<br \/>\n    double b;<br \/>\n    double learnRate;<br \/>\n};<\/p>\n<p>int main() {<br \/>\n    double x[SAMPLES][2] &#061; { {0, 0}, {0, 1}, {1, 0}, {1, 1} };<br \/>\n    int t[SAMPLES] &#061; {0, 1, 1, 0};<br \/>\n    Perceptron p(0.1);<br \/>\n    for (int epoch &#061; 1; epoch &lt;&#061; 100; epoch&#043;&#043;) {<br \/>\n        for (int i &#061; 0; i &lt; SAMPLES; i&#043;&#043;) {<br \/>\n            p.trainOne(x[i][0], x[i][1], t[i]);<br \/>\n        }<br \/>\n    }<br \/>\n    int wrong &#061; 0;<br \/>\n    for (int i &#061; 0; i &lt; SAMPLES; i&#043;&#043;) {<br \/>\n        if (p.predict(x[i][0], x[i][1]) !&#061; t[i]) {<br \/>\n            wrong&#043;&#043;;<br \/>\n        }<br \/>\n    }<br \/>\n    cout &lt;&lt; &#034;100 \u8f6e\u540e\u8fd8\u9519 &#034; &lt;&lt; wrong &lt;&lt; &#034; \u4e2a&#xff0c;\u5b66\u5b8c&#034;;<br \/>\n    p.show();<br \/>\n    cout &lt;&lt; endl;<br \/>\n    return 0;<br \/>\n}<\/p>\n<p>\u8f93\u51fa\u662f 100 \u8f6e\u540e\u8fd8\u9519 2 \u4e2a&#xff0c;\u5b66\u5b8c\u6743\u91cd (-0.1, 0)&#xff0c;\u504f\u7f6e 0.1\u3002\u8fd9\u8ddf\u5b66\u4e60\u7387\u6ca1\u5173\u7cfb&#xff0c;\u8ddf\u8f6e\u6570\u4e5f\u6ca1\u5173\u7cfb&#xff0c;\u5355\u5c42\u611f\u77e5\u5668\u538b\u6839\u8868\u793a\u4e0d\u4e86\u5f02\u6216\u30021969 \u5e74 Minsky \u548c Papert \u5728 Perceptrons \u8fd9\u672c\u4e66\u91cc\u628a\u8fd9\u70b9\u8bb2\u900f\u4e86&#xff0c;\u611f\u77e5\u5668\u7684\u51ac\u5929\u5c31\u662f\u8fd9\u4e48\u6765\u7684\u3002\u540e\u6765\u8fd9\u5835\u5899\u9760\u591a\u5c42\u7f51\u7edc\u52a0\u53cd\u5411\u4f20\u64ad\u7ffb\u8fc7\u53bb&#xff0c;\u6545\u4e8b\u5f88\u957f&#xff0c;\u672c\u4e66\u4e0d\u5c55\u5f00\u3002\u8bb0\u4f4f\u8fb9\u754c\u753b\u5728\u54ea&#xff0c;\u6bd4\u5fd9\u7740\u7ffb\u8fc7\u53bb\u8981\u7d27\u3002<\/p>\n<h4>2.6 \u5b9e\u6218\u3001\u6302\u79d1\u9884\u6d4b<\/h4>\n<p>\u56de\u5230\u5b66\u59d4\u90a3\u6869\u6d3b\u3002\u516d\u4efd\u6210\u7ee9\u5355&#xff0c;\u7b2c\u4e94\u7ae0\u90a3\u4e94\u4f4d&#xff0c;\u5f20\u4e09\u674e\u56db\u738b\u4e94\u8d75\u516d\u5b59\u4e03&#xff0c;\u5916\u52a0\u8f6c\u73ed\u6765\u7684\u5468\u516b\u3002\u738b\u4e94\u7684\u4f5c\u4e1a\u5206\u8fd8\u662f 55&#xff0c;\u7b2c\u4e94\u7ae0\u8003 55 \u7684\u90a3\u4f4d\u8001\u719f\u4eba&#xff0c;\u8fd9\u56de\u4e24\u95e8\u90fd\u60ac\u3002\u539f\u59cb\u5206\u6570\u9664\u4ee5 100&#xff0c;\u4e24\u4e2a\u7279\u5f81\u90fd\u843d\u5230 0 \u5230 1\u3002\u6837\u672c\u7528\u6570\u7ec4\u6446\u7740&#xff0c;\u56fe\u4e2a\u6e05\u695a&#xff0c;\u60f3\u6362\u7b2c\u5341\u56db\u7ae0\u7684 vector \u88c5&#xff0c;\u968f\u4f60\u3002<\/p>\n<p>\u250c\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2510<br \/>\n\u2502 \u4ece\u624b\u6446\u5230\u81ea\u5b66                              \u2502<br \/>\n\u251c\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2524<br \/>\n\u2502 \u6302\u79d1\u9884\u6d4b&#xff0c;\u516d\u4efd\u6210\u7ee9\u5355                      \u2502<br \/>\n\u2502                                           \u2502<br \/>\n\u2502 &#043;&#8212;&#8212;&#8212;-&#043;&#8212;&#8212;&#8212;&#8212;&#8212;-&#043;&#8212;&#8212;&#8211;&#043;    \u2502<br \/>\n\u2502 |\u5b66\u751f      |\u5f52\u4e00\u5316\u7279\u5f81      |\u6807\u7b7e    |    \u2502<br \/>\n\u2502 &#043;&#8212;&#8212;&#8212;-&#043;&#8212;&#8212;&#8212;&#8212;&#8212;-&#043;&#8212;&#8212;&#8211;&#043;    \u2502<br \/>\n\u2502 |\u5f20\u4e09      |0.85 0.78       |0       |    \u2502<br \/>\n\u2502 |\u674e\u56db      |0.92 0.88       |0       |    \u2502<br \/>\n\u2502 |\u738b\u4e94      |0.55 0.61       |1       |    \u2502<br \/>\n\u2502 |\u8d75\u516d      |1.00 0.95       |0       |    \u2502<br \/>\n\u2502 |\u5b59\u4e03      |0.88 0.82       |0       |    \u2502<br \/>\n\u2502 |\u5468\u516b      |0.40 0.35       |1       |    \u2502<br \/>\n\u2502 &#043;&#8212;&#8212;&#8212;-&#043;&#8212;&#8212;&#8212;&#8212;&#8212;-&#043;&#8212;&#8212;&#8211;&#043;    \u2502<br \/>\n\u2502                                           \u2502<br \/>\n\u2502   \u5b66\u51fa\u6765\u6743\u91cd (-0.095, -0.076)&#xff0c;\u504f\u7f6e 0.1   \u2502<br \/>\n\u2502   \u516d\u4e2a\u6837\u672c\u5168\u5224\u5bf9                          \u2502<br \/>\n\u2514\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2518<\/p>\n<p>\u8bad\u7ec3\u8dd1\u8d77\u6765\u3002<\/p>\n<p>#include &lt;iostream&gt;<br \/>\nusing namespace std;<\/p>\n<p>const int N &#061; 6;<\/p>\n<p>class Perceptron {<br \/>\npublic:<br \/>\n    Perceptron(double lr) : learnRate(lr) {<br \/>\n        w[0] &#061; 0.0;<br \/>\n        w[1] &#061; 0.0;<br \/>\n        b &#061; 0.0;<br \/>\n    }<br \/>\n    int predict(double x1, double x2) const {<br \/>\n        double z &#061; b &#043; w[0] * x1 &#043; w[1] * x2;<br \/>\n        return z &gt; 0 ? 1 : 0;<br \/>\n    }<br \/>\n    void trainOne(double x1, double x2, int t) {<br \/>\n        int y &#061; predict(x1, x2);<br \/>\n        if (y !&#061; t) {<br \/>\n            double err &#061; t &#8211; y;<br \/>\n            w[0] &#043;&#061; learnRate * err * x1;<br \/>\n            w[1] &#043;&#061; learnRate * err * x2;<br \/>\n            b &#043;&#061; learnRate * err;<br \/>\n        }<br \/>\n    }<br \/>\n    void show() const {<br \/>\n        cout &lt;&lt; &#034;\u6743\u91cd (&#034; &lt;&lt; w[0] &lt;&lt; &#034;, &#034; &lt;&lt; w[1] &lt;&lt; &#034;)&#xff0c;\u504f\u7f6e &#034; &lt;&lt; b;<br \/>\n    }<br \/>\nprivate:<br \/>\n    double w[2];<br \/>\n    double b;<br \/>\n    double learnRate;<br \/>\n};<\/p>\n<p>int main() {<br \/>\n    double x[N][2] &#061; {<br \/>\n        {0.85, 0.78}, {0.92, 0.88}, {0.55, 0.61},<br \/>\n        {1.00, 0.95}, {0.88, 0.82}, {0.40, 0.35}<br \/>\n    };<br \/>\n    int t[N] &#061; {0, 0, 1, 0, 0, 1};<br \/>\n    const char *names[N] &#061; { &#034;\u5f20\u4e09&#034;, &#034;\u674e\u56db&#034;, &#034;\u738b\u4e94&#034;, &#034;\u8d75\u516d&#034;, &#034;\u5b59\u4e03&#034;, &#034;\u5468\u516b&#034; };<br \/>\n    Perceptron p(0.1);<br \/>\n    for (int epoch &#061; 1; epoch &lt;&#061; 50; epoch&#043;&#043;) {<br \/>\n        int wrong &#061; 0;<br \/>\n        for (int i &#061; 0; i &lt; N; i&#043;&#043;) {<br \/>\n            if (p.predict(x[i][0], x[i][1]) !&#061; t[i]) {<br \/>\n                wrong&#043;&#043;;<br \/>\n            }<br \/>\n            p.trainOne(x[i][0], x[i][1], t[i]);<br \/>\n        }<br \/>\n        cout &lt;&lt; &#034;\u7b2c &#034; &lt;&lt; epoch &lt;&lt; &#034; \u8f6e\u9519 &#034; &lt;&lt; wrong &lt;&lt; &#034; \u4e2a&#034; &lt;&lt; endl;<br \/>\n        int left &#061; 0;<br \/>\n        for (int i &#061; 0; i &lt; N; i&#043;&#043;) {<br \/>\n            if (p.predict(x[i][0], x[i][1]) !&#061; t[i]) {<br \/>\n                left&#043;&#043;;<br \/>\n            }<br \/>\n        }<br \/>\n        if (left &#061;&#061; 0) {<br \/>\n            break;<br \/>\n        }<br \/>\n    }<br \/>\n    p.show();<br \/>\n    cout &lt;&lt; endl;<br \/>\n    for (int i &#061; 0; i &lt; N; i&#043;&#043;) {<br \/>\n        cout &lt;&lt; names[i] &lt;&lt; &#034; \u6807\u7b7e &#034; &lt;&lt; t[i] &lt;&lt; &#034; \u9884\u6d4b &#034;<br \/>\n             &lt;&lt; p.predict(x[i][0], x[i][1]) &lt;&lt; endl;<br \/>\n    }<br \/>\n    return 0;<br \/>\n}<\/p>\n<p>\u7b2c 1 \u8f6e\u9519 3 \u4e2a&#xff0c;\u7b2c 2 \u8f6e\u9519 4 \u4e2a&#xff0c;\u5b66\u5b8c\u516d\u4e2a\u5168\u5bf9\u3002\u7b2c 2 \u8f6e\u9519\u7684\u6bd4\u7b2c 1 \u8f6e\u8fd8\u591a&#xff0c;\u548c AND \u95e8\u4e00\u4e2a\u9053\u7406&#xff0c;\u6536\u655b\u524d\u53cd\u5f39\u4e00\u4e0b\u6b63\u5e38\u3002\u5b66\u51fa\u6765\u7684\u5224\u5b9a\u5f0f\u662f 0.1 \u51cf 0.095 \u4e58\u4f5c\u4e1a\u5206&#xff0c;\u518d\u51cf 0.076 \u4e58\u6708\u8003\u5206&#xff0c;\u5927\u4e8e 0 \u5224\u6302\u79d1\u3002\u4e24\u95e8\u5206\u8d8a\u9ad8&#xff0c;\u5f0f\u5b50\u8d8a\u8d1f&#xff0c;\u8d8a\u5224\u4e0d\u6302&#xff0c;\u65b9\u5411\u7b26\u5408\u76f4\u89c9\u3002\u53ef\u8fd9\u4e2a\u65b9\u5411\u4e0d\u662f\u6211\u6559\u7684&#xff0c;\u662f\u516d\u4efd\u6210\u7ee9\u5355\u81ea\u5df1\u8bf4\u7684\u3002<\/p>\n<p>\u5468\u4e5d\u90a3\u79cd\u6837\u672c&#xff0c;\u89c4\u5219\u6253\u67b6\u7684\u6839\u6e90\u662f\u89c4\u5219\u5199\u6b7b\u4e86\u3002\u611f\u77e5\u5668\u4e0d\u95ee\u89c4\u5219&#xff0c;\u53ea\u95ee\u6570\u636e&#xff0c;\u6743\u91cd\u4ece\u516d\u4efd\u6210\u7ee9\u5355\u91cc\u957f\u51fa\u6765&#xff0c;\u6765\u4e09\u5341\u4efd\u4e09\u767e\u4efd\u4e00\u4e2a\u8dd1\u6cd5\u3002\u5f53\u7136\u5b83\u4e5f\u6709\u5357\u5899&#xff0c;2.5 \u8282\u521a\u649e\u8fc7\u3002\u5de5\u5177\u5404\u6709\u8fb9\u754c&#xff0c;\u77e5\u9053\u8fb9\u754c\u6bd4\u5d07\u62dc\u5de5\u5177\u8981\u7d27\u3002<\/p>\n<p>\u5b66\u59d4\u540e\u6765\u628a\u4e09\u5341\u4efd\u5168\u8dd1\u4e86\u4e00\u904d&#xff0c;\u8bf4\u6bd4\u5979\u90a3\u5957\u89c4\u5219\u5f3a\u3002\u6211\u6ca1\u597d\u610f\u601d\u8bf4\u8fd9\u5957\u4e1c\u897f\u4e0a\u4e16\u7eaa\u4e94\u5341\u5e74\u4ee3\u5c31\u6709\u4e86&#xff0c;\u53ea\u8bf4\u4e86\u53e5&#xff0c;\u6743\u91cd\u662f\u81ea\u5df1\u5b66\u7684&#xff0c;\u4e0d\u662f\u6211\u6446\u7684\u3002<\/p>\n<h3>\u672c\u7ae0\u5c0f\u7ed3<\/h3>\n<p>\u672c\u7ae0\u4ece\u751f\u7269\u795e\u7ecf\u5143\u51fa\u53d1\u3002\u6811\u7a81\u8f74\u7a81\u7ffb\u8bd1\u6210\u8f93\u5165\u8f93\u51fa&#xff0c;\u7a81\u89e6\u5f3a\u5ea6\u7ffb\u8bd1\u6210\u6743\u91cd&#xff0c;\u5174\u594b\u9608\u503c\u7ffb\u8bd1\u6210\u504f\u7f6e&#xff0c;\u4e00\u4e2a\u795e\u7ecf\u5143\u62fc\u51fa\u611f\u77e5\u5668\u3002\u8bad\u7ec3\u4e09\u4ef6\u5957&#xff0c;\u6837\u672c\u3001\u6a21\u578b\u3001\u635f\u5931&#xff0c;\u52a0\u4e00\u6761\u731c\u9519\u624d\u52a8\u624b\u7684\u66f4\u65b0\u89c4\u5219&#xff0c;\u6743\u91cd\u5c31\u80fd\u4ece\u6570\u636e\u91cc\u957f\u51fa\u6765\u3002\u4e24\u6761\u7ecf\u9a8c&#xff0c;\u7279\u5f81\u5148\u7f29\u653e&#xff0c;\u5b66\u4e60\u7387\u4ece 0.1 \u8d77\u6b65\u3002\u4e00\u6761\u786c\u8fb9\u754c&#xff0c;\u5355\u5c42\u611f\u77e5\u5668\u53ea\u73a9\u7ebf\u6027\u53ef\u5206\u3002<\/p>\n<p>\u250c\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2510<br \/>\n\u2502 \u672c\u7ae0\u6536\u53e3                         \u2502<br \/>\n\u251c\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2524<br \/>\n\u2502 \u4e00\u6761\u7ebf&#xff0c;\u4ece\u795e\u7ecf\u5143\u8d70\u5230\u611f\u77e5\u5668       \u2502<br \/>\n\u2502                                  \u2502<br \/>\n\u2502   \u6811\u7a81\u8f74\u7a81  \u53d8\u6210  \u8f93\u5165\u8f93\u51fa       \u2502<br \/>\n\u2502   \u7a81\u89e6\u5f3a\u5ea6  \u53d8\u6210  \u6743\u91cd           \u2502<br \/>\n\u2502   \u5174\u594b\u9608\u503c  \u53d8\u6210  \u504f\u7f6e           \u2502<br \/>\n\u2502   \u5b66\u4e60      \u53d8\u6210  \u66f4\u65b0\u89c4\u5219       \u2502<br \/>\n\u2502                                  \u2502<br \/>\n\u2502   \u5355\u5c42\u611f\u77e5\u5668&#xff0c;\u7ebf\u6027\u53ef\u5206\u624d\u73a9\u5f97\u8f6c   \u2502<br \/>\n\u2502   \u5f02\u6216\u5361\u4f4f\u7684\u5730\u65b9&#xff0c;\u7559\u7ed9\u540e\u9762\u7684\u5c42   \u2502<br \/>\n\u2514\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2518<\/p>\n<h3>\u9644\u5f55 A \u901f\u67e5\u5361<\/h3>\n<table>\n<tr>\u6761\u76ee\u4e00\u53e5\u8bdd<\/tr>\n<tbody>\n<tr>\n<td>\u795e\u7ecf\u5143<\/td>\n<td>\u6811\u7a81\u7ba1\u6536&#xff0c;\u7ec6\u80de\u4f53\u7ba1\u7b97&#xff0c;\u8f74\u7a81\u7ba1\u4f20<\/td>\n<\/tr>\n<tr>\n<td>\u7a81\u89e6<\/td>\n<td>\u795e\u7ecf\u5143\u63a5\u5934&#xff0c;\u5f3a\u5ea6\u53ef\u53d8&#xff0c;\u5b66\u4e60\u53d1\u751f\u5728\u8fd9<\/td>\n<\/tr>\n<tr>\n<td>\u6743\u91cd w<\/td>\n<td>\u7a81\u89e6\u5f3a\u5ea6\u7684\u6570\u5b66\u7248&#xff0c;\u7ba1\u8f93\u5165\u7684\u5206\u91cf<\/td>\n<\/tr>\n<tr>\n<td>\u504f\u7f6e b<\/td>\n<td>\u603b\u95e8\u69db&#xff0c;\u51b3\u5b9a\u4e00\u5200\u5207\u7684\u4f4d\u7f6e<\/td>\n<\/tr>\n<tr>\n<td>\u6fc0\u6d3b\u51fd\u6570<\/td>\n<td>\u611f\u77e5\u5668\u7528\u9636\u8dc3&#xff0c;z \u5927\u4e8e 0 \u8f93\u51fa 1<\/td>\n<\/tr>\n<tr>\n<td>\u611f\u77e5\u5668<\/td>\n<td>\u4e00\u5c42\u6743\u91cd\u76f4\u901a\u8f93\u51fa\u7684\u5355\u5c42\u6a21\u578b<\/td>\n<\/tr>\n<tr>\n<td>\u7ebf\u6027\u53ef\u5206<\/td>\n<td>\u4e00\u6761\u76f4\u7ebf\u5206\u5f00\u4e24\u7c7b&#xff0c;\u611f\u77e5\u5668\u7684\u5730\u76d8<\/td>\n<\/tr>\n<tr>\n<td>\u76d1\u7763\u5b66\u4e60<\/td>\n<td>\u6837\u672c\u5e26\u6807\u7b7e&#xff0c;\u6a21\u578b\u7167\u7740\u7b54\u6848\u5b66<\/td>\n<\/tr>\n<tr>\n<td>\u5b66\u4e60\u7387<\/td>\n<td>\u66f4\u65b0\u7684\u6b65\u5b50&#xff0c;\u5e38\u7528\u8d77\u70b9 0.1<\/td>\n<\/tr>\n<tr>\n<td>\u8f6e\u6b21<\/td>\n<td>\u5168\u6837\u672c\u8fc7\u4e00\u904d<\/td>\n<\/tr>\n<tr>\n<td>\u524d\u5411<\/td>\n<td>z &#061; w1x1 &#043; w2x2 &#043; b&#xff0c;\u518d\u8fc7\u9636\u8dc3<\/td>\n<\/tr>\n<tr>\n<td>\u66f4\u65b0<\/td>\n<td>w &#043;&#061; lr*(t-y)x&#xff0c;b &#043;&#061; lr(t-y)<\/td>\n<\/tr>\n<tr>\n<td>\u6536\u655b<\/td>\n<td>\u5168\u6837\u672c\u5224\u5bf9&#xff0c;\u6536\u5de5<\/td>\n<\/tr>\n<\/tbody>\n<\/table>\n<h3>\u9644\u5f55 B \u6392\u9519\u8868<\/h3>\n<table>\n<tr>\u5e38\u89c1\u73b0\u8c61\u75c5\u6839\u836f\u65b9<\/tr>\n<tbody>\n<tr>\n<td>\u8dd1\u4e00\u767e\u8f6e\u4e0d\u6536\u655b&#xff0c;\u6743\u91cd\u5361\u4f4f\u4e0d\u52a8<\/td>\n<td>\u5fd8\u66f4\u65b0\u504f\u7f6e&#xff0c;b \u90a3\u6761\u6f0f\u4e86<\/td>\n<td>\u8865\u4e0a b &#043;&#061; lr*(t-y)<\/td>\n<\/tr>\n<tr>\n<td>\u6bcf\u8f6e\u7a33\u5b9a\u9519\u540c\u6837\u591a\u4e2a&#xff0c;\u6743\u91cd\u6765\u56de\u649e<\/td>\n<td>\u5b66\u4e60\u7387\u76f8\u5bf9\u5c3a\u5ea6\u592a\u5927<\/td>\n<td>\u7279\u5f81\u5f52\u4e00\u5316&#xff0c;\u6216\u5b66\u4e60\u7387\u964d\u5341\u500d<\/td>\n<\/tr>\n<tr>\n<td>300 \u8f6e\u8fd8\u4e0d\u6536\u655b&#xff0c;\u6743\u91cd\u7f13\u6162\u6f02<\/td>\n<td>\u6b65\u5b50\u592a\u5c0f&#xff0c;\u6216\u5c3a\u5ea6\u592a\u5927<\/td>\n<td>\u5148\u5f52\u4e00\u5316&#xff0c;\u518d\u8003\u8651\u8c03\u5b66\u4e60\u7387<\/td>\n<\/tr>\n<tr>\n<td>\u6743\u91cd\u8d8a\u8dd1\u8d8a\u80d6&#xff0c;\u9884\u6d4b\u4e00\u8fb9\u5012<\/td>\n<td>\u6807\u7b7e\u5199\u6210 2&#xff0c;\u8bef\u5dee\u6c38\u8fdc\u4e0d\u4e3a 0<\/td>\n<td>\u6807\u7b7e\u53ea\u7528 0 \u548c 1<\/td>\n<\/tr>\n<tr>\n<td>predict \u8f93\u51fa 0.3 \u8fd9\u79cd\u5c0f\u6570<\/td>\n<td>\u5fd8\u4e86\u9636\u8dc3\u6fc0\u6d3b<\/td>\n<td>\u52a0 z \u5927\u4e8e 0 \u7684\u4e00\u5200\u5207<\/td>\n<\/tr>\n<tr>\n<td>\u5224\u65ad\u6536\u655b\u9760\u6bd4\u6743\u91cd\u76f8\u7b49<\/td>\n<td>double \u5b58\u4e0d\u7cbe\u786e&#xff0c;0.1 \u52a0 0.2 \u90fd\u4e0d\u7b49\u4e8e 0.3<\/td>\n<td>\u6570\u5206\u9519\u7684\u6837\u672c\u4e2a\u6570&#xff0c;\u5f52\u96f6\u5c31\u6536\u5de5<\/td>\n<\/tr>\n<tr>\n<td>\u5f02\u6216\u8dd1\u4e00\u4e07\u8f6e\u4e5f\u6ca1\u7528<\/td>\n<td>\u5355\u5c42\u611f\u77e5\u5668\u7684\u786c\u8fb9\u754c<\/td>\n<td>\u4e0a\u591a\u5c42\u7f51\u7edc&#xff0c;\u672c\u4e66\u4e0d\u5c55\u5f00<\/td>\n<\/tr>\n<tr>\n<td>\u7b2c 2 \u8f6e\u9519\u5f97\u6bd4\u7b2c 1 \u8f6e\u591a&#xff0c;\u4ee5\u4e3a\u4ee3\u7801\u574f\u4e86<\/td>\n<td>\u6536\u655b\u524d\u6b63\u5e38\u53cd\u5f39<\/td>\n<td>\u770b\u8d8b\u52bf&#xff0c;\u522b\u770b\u5355\u8f6e<\/td>\n<\/tr>\n<\/tbody>\n<\/table>\n","protected":false},"excerpt":{"rendered":"<p>\u7b2c\u5341\u4e94\u7ae0 \u4eba\u5de5\u667a\u80fd\u57fa\u7840\u7b2c\u5341\u56db\u7ae0\u8bb2\u5b8c STL&#xff0c;C \u7684\u5e38\u7528\u62db\u5f0f\u57fa\u672c\u9f50\u4e86\u3002\u672c\u7ae0\u4e0d\u5b66\u65b0\u8bed\u6cd5&#xff0c;\u62ff\u524d\u5341\u56db\u7ae0\u7684\u4e1c\u897f\u62fc\u4e2a\u4f1a\u81ea\u5df1\u957f\u672c\u4e8b\u7684\u7a0b\u5e8f\u3002\u4e0a\u7ae0\u7ed3\u5c3e\u6392\u7684\u662f\u5f02\u5e38\u5904\u7406&#xff0c;\u90a3\u7ae0\u5f80\u540e\u653e\u4e00\u7ad9&#xff0c;\u5148\u4e86\u4e86\u5b66\u59d4\u8fd9\u6869\u4e8b\u30021. \u4ece\u751f\u7269\u795e\u7ecf\u5143\u5230\u611f\u77e5\u56681.1 \u751f\u7269\u795e\u7ecf\u5143\u90a3\u70b9\u4e8b\u5927\u8111\u91cc\u7ba1\u601d\u8003\u7684\u7ec6\u80de\u53eb\u795e\u7ecf\u5143&#xff0c;\u4e00\u4e2a\u795e\u7ecf\u5143\u957f\u8fd9\u4e48\u526f\u6a21\u6837\u3002\u4e00\u5806\u6811\u7a81\u4f38\u51fa\u53bb\u6536\u4fe1\u53f7&#xff0c;\u50cf\u6811\u679d\u5206\u53c9\u3002\u4fe1\u53f7\u6c47\u5230\u7ec6\u80de\u4f53&#xff0c;\u6512\u591f\u5206\u91cf\u5c31\u5174\u594b\u3002\u8f74\u7a81\u628a\u5174\u594b\u4f20\u51fa\u53bb&#xff0c;<\/p>\n","protected":false},"author":2,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[1],"tags":[55,50,190],"topic":[],"class_list":["post-122989","post","type-post","status-publish","format-standard","hentry","category-server","tag-c","tag-50","tag-190"],"yoast_head":"<!-- This site is optimized with the Yoast SEO plugin v20.3 - https:\/\/yoast.com\/wordpress\/plugins\/seo\/ -->\n<title>\u7b2c\u5341\u4e94\u7ae0 \u4eba\u5de5\u667a\u80fd\u57fa\u7840 - \u7f51\u7855\u4e92\u8054\u5e2e\u52a9\u4e2d\u5fc3<\/title>\n<meta name=\"robots\" content=\"index, follow, max-snippet:-1, max-image-preview:large, max-video-preview:-1\" \/>\n<link rel=\"canonical\" href=\"https:\/\/www.wsisp.com\/helps\/122989.html\" \/>\n<meta property=\"og:locale\" content=\"zh_CN\" \/>\n<meta property=\"og:type\" content=\"article\" \/>\n<meta property=\"og:title\" content=\"\u7b2c\u5341\u4e94\u7ae0 \u4eba\u5de5\u667a\u80fd\u57fa\u7840 - \u7f51\u7855\u4e92\u8054\u5e2e\u52a9\u4e2d\u5fc3\" \/>\n<meta property=\"og:description\" content=\"\u7b2c\u5341\u4e94\u7ae0 \u4eba\u5de5\u667a\u80fd\u57fa\u7840\u7b2c\u5341\u56db\u7ae0\u8bb2\u5b8c STL&#xff0c;C \u7684\u5e38\u7528\u62db\u5f0f\u57fa\u672c\u9f50\u4e86\u3002\u672c\u7ae0\u4e0d\u5b66\u65b0\u8bed\u6cd5&#xff0c;\u62ff\u524d\u5341\u56db\u7ae0\u7684\u4e1c\u897f\u62fc\u4e2a\u4f1a\u81ea\u5df1\u957f\u672c\u4e8b\u7684\u7a0b\u5e8f\u3002\u4e0a\u7ae0\u7ed3\u5c3e\u6392\u7684\u662f\u5f02\u5e38\u5904\u7406&#xff0c;\u90a3\u7ae0\u5f80\u540e\u653e\u4e00\u7ad9&#xff0c;\u5148\u4e86\u4e86\u5b66\u59d4\u8fd9\u6869\u4e8b\u30021. \u4ece\u751f\u7269\u795e\u7ecf\u5143\u5230\u611f\u77e5\u56681.1 \u751f\u7269\u795e\u7ecf\u5143\u90a3\u70b9\u4e8b\u5927\u8111\u91cc\u7ba1\u601d\u8003\u7684\u7ec6\u80de\u53eb\u795e\u7ecf\u5143&#xff0c;\u4e00\u4e2a\u795e\u7ecf\u5143\u957f\u8fd9\u4e48\u526f\u6a21\u6837\u3002\u4e00\u5806\u6811\u7a81\u4f38\u51fa\u53bb\u6536\u4fe1\u53f7&#xff0c;\u50cf\u6811\u679d\u5206\u53c9\u3002\u4fe1\u53f7\u6c47\u5230\u7ec6\u80de\u4f53&#xff0c;\u6512\u591f\u5206\u91cf\u5c31\u5174\u594b\u3002\u8f74\u7a81\u628a\u5174\u594b\u4f20\u51fa\u53bb&#xff0c;\" \/>\n<meta property=\"og:url\" content=\"https:\/\/www.wsisp.com\/helps\/122989.html\" \/>\n<meta property=\"og:site_name\" content=\"\u7f51\u7855\u4e92\u8054\u5e2e\u52a9\u4e2d\u5fc3\" \/>\n<meta property=\"article:published_time\" content=\"2026-11-05T21:24:45+00:00\" \/>\n<meta name=\"author\" content=\"admin\" \/>\n<meta name=\"twitter:card\" content=\"summary_large_image\" \/>\n<meta name=\"twitter:label1\" content=\"\u4f5c\u8005\" \/>\n\t<meta name=\"twitter:data1\" content=\"admin\" \/>\n\t<meta name=\"twitter:label2\" content=\"\u9884\u8ba1\u9605\u8bfb\u65f6\u95f4\" \/>\n\t<meta name=\"twitter:data2\" content=\"9 \u5206\" \/>\n<script type=\"application\/ld+json\" class=\"yoast-schema-graph\">{\"@context\":\"https:\/\/schema.org\",\"@graph\":[{\"@type\":\"WebPage\",\"@id\":\"https:\/\/www.wsisp.com\/helps\/122989.html\",\"url\":\"https:\/\/www.wsisp.com\/helps\/122989.html\",\"name\":\"\u7b2c\u5341\u4e94\u7ae0 \u4eba\u5de5\u667a\u80fd\u57fa\u7840 - \u7f51\u7855\u4e92\u8054\u5e2e\u52a9\u4e2d\u5fc3\",\"isPartOf\":{\"@id\":\"https:\/\/www.wsisp.com\/helps\/#website\"},\"datePublished\":\"2026-11-05T21:24:45+00:00\",\"dateModified\":\"2026-11-05T21:24:45+00:00\",\"author\":{\"@id\":\"https:\/\/www.wsisp.com\/helps\/#\/schema\/person\/358e386c577a3ab51c4493330a20ad41\"},\"breadcrumb\":{\"@id\":\"https:\/\/www.wsisp.com\/helps\/122989.html#breadcrumb\"},\"inLanguage\":\"zh-Hans\",\"potentialAction\":[{\"@type\":\"ReadAction\",\"target\":[\"https:\/\/www.wsisp.com\/helps\/122989.html\"]}]},{\"@type\":\"BreadcrumbList\",\"@id\":\"https:\/\/www.wsisp.com\/helps\/122989.html#breadcrumb\",\"itemListElement\":[{\"@type\":\"ListItem\",\"position\":1,\"name\":\"\u9996\u9875\",\"item\":\"https:\/\/www.wsisp.com\/helps\"},{\"@type\":\"ListItem\",\"position\":2,\"name\":\"\u7b2c\u5341\u4e94\u7ae0 \u4eba\u5de5\u667a\u80fd\u57fa\u7840\"}]},{\"@type\":\"WebSite\",\"@id\":\"https:\/\/www.wsisp.com\/helps\/#website\",\"url\":\"https:\/\/www.wsisp.com\/helps\/\",\"name\":\"\u7f51\u7855\u4e92\u8054\u5e2e\u52a9\u4e2d\u5fc3\",\"description\":\"\u9999\u6e2f\u670d\u52a1\u5668_\u9999\u6e2f\u4e91\u670d\u52a1\u5668\u8d44\u8baf_\u670d\u52a1\u5668\u5e2e\u52a9\u6587\u6863_\u670d\u52a1\u5668\u6559\u7a0b\",\"potentialAction\":[{\"@type\":\"SearchAction\",\"target\":{\"@type\":\"EntryPoint\",\"urlTemplate\":\"https:\/\/www.wsisp.com\/helps\/?s={search_term_string}\"},\"query-input\":\"required name=search_term_string\"}],\"inLanguage\":\"zh-Hans\"},{\"@type\":\"Person\",\"@id\":\"https:\/\/www.wsisp.com\/helps\/#\/schema\/person\/358e386c577a3ab51c4493330a20ad41\",\"name\":\"admin\",\"image\":{\"@type\":\"ImageObject\",\"inLanguage\":\"zh-Hans\",\"@id\":\"https:\/\/www.wsisp.com\/helps\/#\/schema\/person\/image\/\",\"url\":\"https:\/\/gravatar.wp-china-yes.net\/avatar\/?s=96&d=mystery\",\"contentUrl\":\"https:\/\/gravatar.wp-china-yes.net\/avatar\/?s=96&d=mystery\",\"caption\":\"admin\"},\"sameAs\":[\"http:\/\/wp.wsisp.com\"],\"url\":\"https:\/\/www.wsisp.com\/helps\/author\/admin\"}]}<\/script>\n<!-- \/ Yoast SEO plugin. -->","yoast_head_json":{"title":"\u7b2c\u5341\u4e94\u7ae0 \u4eba\u5de5\u667a\u80fd\u57fa\u7840 - \u7f51\u7855\u4e92\u8054\u5e2e\u52a9\u4e2d\u5fc3","robots":{"index":"index","follow":"follow","max-snippet":"max-snippet:-1","max-image-preview":"max-image-preview:large","max-video-preview":"max-video-preview:-1"},"canonical":"https:\/\/www.wsisp.com\/helps\/122989.html","og_locale":"zh_CN","og_type":"article","og_title":"\u7b2c\u5341\u4e94\u7ae0 \u4eba\u5de5\u667a\u80fd\u57fa\u7840 - \u7f51\u7855\u4e92\u8054\u5e2e\u52a9\u4e2d\u5fc3","og_description":"\u7b2c\u5341\u4e94\u7ae0 \u4eba\u5de5\u667a\u80fd\u57fa\u7840\u7b2c\u5341\u56db\u7ae0\u8bb2\u5b8c STL&#xff0c;C \u7684\u5e38\u7528\u62db\u5f0f\u57fa\u672c\u9f50\u4e86\u3002\u672c\u7ae0\u4e0d\u5b66\u65b0\u8bed\u6cd5&#xff0c;\u62ff\u524d\u5341\u56db\u7ae0\u7684\u4e1c\u897f\u62fc\u4e2a\u4f1a\u81ea\u5df1\u957f\u672c\u4e8b\u7684\u7a0b\u5e8f\u3002\u4e0a\u7ae0\u7ed3\u5c3e\u6392\u7684\u662f\u5f02\u5e38\u5904\u7406&#xff0c;\u90a3\u7ae0\u5f80\u540e\u653e\u4e00\u7ad9&#xff0c;\u5148\u4e86\u4e86\u5b66\u59d4\u8fd9\u6869\u4e8b\u30021. \u4ece\u751f\u7269\u795e\u7ecf\u5143\u5230\u611f\u77e5\u56681.1 \u751f\u7269\u795e\u7ecf\u5143\u90a3\u70b9\u4e8b\u5927\u8111\u91cc\u7ba1\u601d\u8003\u7684\u7ec6\u80de\u53eb\u795e\u7ecf\u5143&#xff0c;\u4e00\u4e2a\u795e\u7ecf\u5143\u957f\u8fd9\u4e48\u526f\u6a21\u6837\u3002\u4e00\u5806\u6811\u7a81\u4f38\u51fa\u53bb\u6536\u4fe1\u53f7&#xff0c;\u50cf\u6811\u679d\u5206\u53c9\u3002\u4fe1\u53f7\u6c47\u5230\u7ec6\u80de\u4f53&#xff0c;\u6512\u591f\u5206\u91cf\u5c31\u5174\u594b\u3002\u8f74\u7a81\u628a\u5174\u594b\u4f20\u51fa\u53bb&#xff0c;","og_url":"https:\/\/www.wsisp.com\/helps\/122989.html","og_site_name":"\u7f51\u7855\u4e92\u8054\u5e2e\u52a9\u4e2d\u5fc3","article_published_time":"2026-11-05T21:24:45+00:00","author":"admin","twitter_card":"summary_large_image","twitter_misc":{"\u4f5c\u8005":"admin","\u9884\u8ba1\u9605\u8bfb\u65f6\u95f4":"9 \u5206"},"schema":{"@context":"https:\/\/schema.org","@graph":[{"@type":"WebPage","@id":"https:\/\/www.wsisp.com\/helps\/122989.html","url":"https:\/\/www.wsisp.com\/helps\/122989.html","name":"\u7b2c\u5341\u4e94\u7ae0 \u4eba\u5de5\u667a\u80fd\u57fa\u7840 - \u7f51\u7855\u4e92\u8054\u5e2e\u52a9\u4e2d\u5fc3","isPartOf":{"@id":"https:\/\/www.wsisp.com\/helps\/#website"},"datePublished":"2026-11-05T21:24:45+00:00","dateModified":"2026-11-05T21:24:45+00:00","author":{"@id":"https:\/\/www.wsisp.com\/helps\/#\/schema\/person\/358e386c577a3ab51c4493330a20ad41"},"breadcrumb":{"@id":"https:\/\/www.wsisp.com\/helps\/122989.html#breadcrumb"},"inLanguage":"zh-Hans","potentialAction":[{"@type":"ReadAction","target":["https:\/\/www.wsisp.com\/helps\/122989.html"]}]},{"@type":"BreadcrumbList","@id":"https:\/\/www.wsisp.com\/helps\/122989.html#breadcrumb","itemListElement":[{"@type":"ListItem","position":1,"name":"\u9996\u9875","item":"https:\/\/www.wsisp.com\/helps"},{"@type":"ListItem","position":2,"name":"\u7b2c\u5341\u4e94\u7ae0 \u4eba\u5de5\u667a\u80fd\u57fa\u7840"}]},{"@type":"WebSite","@id":"https:\/\/www.wsisp.com\/helps\/#website","url":"https:\/\/www.wsisp.com\/helps\/","name":"\u7f51\u7855\u4e92\u8054\u5e2e\u52a9\u4e2d\u5fc3","description":"\u9999\u6e2f\u670d\u52a1\u5668_\u9999\u6e2f\u4e91\u670d\u52a1\u5668\u8d44\u8baf_\u670d\u52a1\u5668\u5e2e\u52a9\u6587\u6863_\u670d\u52a1\u5668\u6559\u7a0b","potentialAction":[{"@type":"SearchAction","target":{"@type":"EntryPoint","urlTemplate":"https:\/\/www.wsisp.com\/helps\/?s={search_term_string}"},"query-input":"required name=search_term_string"}],"inLanguage":"zh-Hans"},{"@type":"Person","@id":"https:\/\/www.wsisp.com\/helps\/#\/schema\/person\/358e386c577a3ab51c4493330a20ad41","name":"admin","image":{"@type":"ImageObject","inLanguage":"zh-Hans","@id":"https:\/\/www.wsisp.com\/helps\/#\/schema\/person\/image\/","url":"https:\/\/gravatar.wp-china-yes.net\/avatar\/?s=96&d=mystery","contentUrl":"https:\/\/gravatar.wp-china-yes.net\/avatar\/?s=96&d=mystery","caption":"admin"},"sameAs":["http:\/\/wp.wsisp.com"],"url":"https:\/\/www.wsisp.com\/helps\/author\/admin"}]}},"_links":{"self":[{"href":"https:\/\/www.wsisp.com\/helps\/wp-json\/wp\/v2\/posts\/122989","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/www.wsisp.com\/helps\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.wsisp.com\/helps\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.wsisp.com\/helps\/wp-json\/wp\/v2\/users\/2"}],"replies":[{"embeddable":true,"href":"https:\/\/www.wsisp.com\/helps\/wp-json\/wp\/v2\/comments?post=122989"}],"version-history":[{"count":0,"href":"https:\/\/www.wsisp.com\/helps\/wp-json\/wp\/v2\/posts\/122989\/revisions"}],"wp:attachment":[{"href":"https:\/\/www.wsisp.com\/helps\/wp-json\/wp\/v2\/media?parent=122989"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.wsisp.com\/helps\/wp-json\/wp\/v2\/categories?post=122989"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.wsisp.com\/helps\/wp-json\/wp\/v2\/tags?post=122989"},{"taxonomy":"topic","embeddable":true,"href":"https:\/\/www.wsisp.com\/helps\/wp-json\/wp\/v2\/topic?post=122989"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}