{"id":47859,"date":"2025-07-30T09:32:51","date_gmt":"2025-07-30T01:32:51","guid":{"rendered":"https:\/\/www.wsisp.com\/helps\/47859.html"},"modified":"2025-07-30T09:32:51","modified_gmt":"2025-07-30T01:32:51","slug":"65%e3%80%81%e5%85%a8%e8%bf%9e%e6%8e%a5%e7%a5%9e%e7%bb%8f%e7%bd%91%e7%bb%9c%ef%bc%88%e5%a4%9a%e5%b1%82%e6%84%9f%e7%9f%a5%e6%9c%ba%ef%bc%89%e7%9a%84%e6%9e%84%e5%bb%ba%e3%80%90%e7%94%a8python%e8%bf%9b","status":"publish","type":"post","link":"https:\/\/www.wsisp.com\/helps\/47859.html","title":{"rendered":"65\u3001\u5168\u8fde\u63a5\u795e\u7ecf\u7f51\u7edc\uff08\u591a\u5c42\u611f\u77e5\u673a\uff09\u7684\u6784\u5efa\u3010\u7528Python\u8fdb\u884cAI\u6570\u636e\u5206\u6790\u8fdb\u9636\u6559\u7a0b\u3011"},"content":{"rendered":"<p><span style=\"color:#fe2c24\">\u7528Python\u8fdb\u884cAI\u6570\u636e\u5206\u6790\u8fdb\u9636\u6559\u7a0b65&#xff1a;<\/span><\/p>\n<h2><span style=\"color:#fe2c24\">\u5168\u8fde\u63a5\u795e\u7ecf\u7f51\u7edc&#xff08;\u591a\u5c42\u611f\u77e5\u673a&#xff09;\u7684\u6784\u5efa<\/span><\/h2>\n<hr \/>\n<p>\u5173\u952e\u8bcd&#xff1a;\u5168\u8fde\u63a5\u795e\u7ecf\u7f51\u7edc\u3001\u591a\u5c42\u611f\u77e5\u673a\u3001TensorFlow\u3001\u6a21\u578b\u8bad\u7ec3\u3001MNIST\u6570\u636e\u96c6<\/p>\n<p>\u6458\u8981&#xff1a;\u672c\u6587\u4ecb\u7ecd\u4e86\u5168\u8fde\u63a5\u795e\u7ecf\u7f51\u7edc&#xff08;\u4e5f\u79f0\u591a\u5c42\u611f\u77e5\u673a&#xff0c;MLP&#xff09;\u7684\u57fa\u672c\u6982\u5ff5\u53ca\u5176\u6784\u5efa\u8fc7\u7a0b\u3002\u4ee5TensorFlow\u6846\u67b6\u4e3a\u4f8b&#xff0c;\u901a\u8fc7\u5bfc\u5165\u5fc5\u8981\u7684\u5e93\u3001\u51c6\u5907\u548c\u9884\u5904\u7406MNIST\u624b\u5199\u6570\u5b57\u6570\u636e\u96c6\u3001\u6784\u5efa\u6a21\u578b\u7ed3\u6784&#xff08;\u5305\u62ecFlatten\u5c42\u3001Dense\u5c42\u548cDropout\u5c42&#xff09;\u3001\u7f16\u8bd1\u6a21\u578b&#xff08;\u9009\u62e9\u4f18\u5316\u5668\u3001\u635f\u5931\u51fd\u6570\u548c\u8bc4\u4f30\u6307\u6807&#xff09;\u3001\u8bad\u7ec3\u6a21\u578b\u4ee5\u53ca\u8bc4\u4f30\u6a21\u578b\u6027\u80fd\u7b49\u6b65\u9aa4&#xff0c;\u8be6\u7ec6\u5c55\u793a\u4e86\u5982\u4f55\u5b9e\u73b0\u4e00\u4e2a\u7b80\u5355\u7684\u5206\u7c7b\u4efb\u52a1\u3002\u6587\u4e2d\u5f3a\u8c03\u4e86\u6570\u636e\u5f52\u4e00\u5316\u3001\u6a21\u578b\u7ed3\u6784\u8bbe\u8ba1\u3001\u9632\u6b62\u8fc7\u62df\u5408\u7b49\u5173\u952e\u70b9&#xff0c;\u5e76\u63d0\u4f9b\u4e86\u5b8c\u6574\u4ee3\u7801\u793a\u4f8b\u53ca\u8fd0\u884c\u7ed3\u679c\u8bf4\u660e&#xff0c;\u5e2e\u52a9\u8bfb\u8005\u7406\u89e3\u548c\u638c\u63e1\u6784\u5efa\u5168\u8fde\u63a5\u795e\u7ecf\u7f51\u7edc\u7684\u6838\u5fc3\u65b9\u6cd5\u3002<\/p>\n<p>&#x1f449; \u6b22\u8fce\u8ba2\u9605&#x1f517; \u300a\u7528Python\u8fdb\u884cAI\u6570\u636e\u5206\u6790\u8fdb\u9636\u6559\u7a0b\u300b\u4e13\u680f \u300aAI\u5927\u6a21\u578b\u5e94\u7528\u5b9e\u8df5\u8fdb\u9636\u6559\u7a0b\u300b\u4e13\u680f \u300aPython\u7f16\u7a0b\u77e5\u8bc6\u96c6\u9526\u300b\u4e13\u680f \u300a\u5b57\u8282\u8df3\u52a8\u65d7\u4e0bAI\u5236\u4f5c\u6296\u97f3\u89c6\u9891\u300b\u4e13\u680f \u300a\u667a\u80fd\u8f85\u52a9\u9a7e\u9a76\u300b\u4e13\u680f \u300a\u5de5\u5177\u8f6f\u4ef6\u53caIT\u6280\u672f\u96c6\u9526\u300b\u4e13\u680f<\/p>\n<hr \/>\n<p style=\"margin-left:0;margin-right:0;text-align:left\"><span style=\"background-color:#ffffff\"><span style=\"color:#000000\">\u5168\u8fde\u63a5\u795e\u7ecf\u7f51\u7edc&#xff08;Fully Connected Neural Network&#xff09;&#xff0c;\u4e5f\u79f0\u4e3a\u591a\u5c42\u611f\u77e5\u673a&#xff08;Multilayer Perceptron, MLP&#xff09;&#xff0c;\u662f\u4e00\u79cd\u57fa\u672c\u7684\u4eba\u5de5\u795e\u7ecf\u7f51\u7edc\u6a21\u578b\u3002\u5b83\u7531\u8f93\u5165\u5c42\u3001\u4e00\u4e2a\u6216\u591a\u4e2a\u9690\u85cf\u5c42\u4ee5\u53ca\u8f93\u51fa\u5c42\u7ec4\u6210&#xff0c;\u6bcf\u4e00\u5c42\u7684\u795e\u7ecf\u5143\u90fd\u4e0e\u4e0b\u4e00\u5c42\u7684\u6240\u6709\u795e\u7ecf\u5143\u76f8\u8fde&#xff0c;\u56e0\u6b64\u88ab\u79f0\u4e3a\u5168\u8fde\u63a5\u3002<\/span><\/span><\/p>\n<h2 style=\"margin-left:0pt;margin-right:0pt;text-align:justify\"><span style=\"color:#1a1a1a\">\u4e00\u3001<\/span><span style=\"color:#1a1a1a\">\u6784\u5efa\u6b65\u9aa4\u53ca\u5173\u952e\u70b9\u3001\u6ce8\u610f\u70b9<\/span><\/h2>\n<h3 style=\"margin-left:0pt;margin-right:0pt;text-align:justify\"><span style=\"color:#1a1a1a\">1. \u5bfc\u5165\u5fc5\u8981\u7684\u5e93<\/span><\/h3>\n<p style=\"margin-left:0;margin-right:0;text-align:left\"><span style=\"background-color:#ffffff\"><span style=\"color:#000000\">\u5728 Python \u4e2d&#xff0c;\u901a\u5e38\u4f7f\u7528<\/span><\/span><span style=\"background-color:#ffffff\"><span style=\"color:#000000\">TensorFlow<\/span><\/span><span style=\"background-color:#ffffff\"><span style=\"color:#000000\">\u6216<\/span><\/span><span style=\"background-color:#ffffff\"><span style=\"color:#000000\">PyTorch<\/span><\/span><span style=\"background-color:#ffffff\"><span style=\"color:#000000\">\u6765\u6784\u5efa\u795e\u7ecf\u7f51\u7edc\u3002\u8fd9\u91cc\u4ee5<\/span><\/span><span style=\"background-color:#ffffff\"><span style=\"color:#000000\">TensorFlow<\/span><\/span><span style=\"background-color:#ffffff\"><span style=\"color:#000000\">\u4e3a\u4f8b\u3002<\/span><\/span><\/p>\n<p style=\"margin-left:0;margin-right:0;text-align:left\"><span style=\"color:#939393\">Python\u811a\u672c<\/span><\/p>\n<p>  # \u5bfc\u5165TensorFlow\u5e93&#xff0c;\u8fd9\u662f\u4e00\u4e2a\u7528\u4e8e\u673a\u5668\u5b66\u4e60\u548c\u6df1\u5ea6\u5b66\u4e60\u7684\u5f00\u6e90\u6846\u67b6<br \/>\nimport tensorflow as tf<\/p>\n<p># \u4ecetensorflow.keras\u6a21\u5757\u4e2d\u5bfc\u5165layers\u548cmodels\u5b50\u6a21\u5757<br \/>\n# layers\u7528\u4e8e\u6784\u5efa\u795e\u7ecf\u7f51\u7edc\u5c42&#xff0c;models\u7528\u4e8e\u6784\u5efa\u548c\u7ba1\u7406\u6a21\u578b<br \/>\nfrom tensorflow.keras import layers, models <\/p>\n<p style=\"margin-left:0;margin-right:0;text-align:left\"><span style=\"color:#000000\">&#xff08;1&#xff09;\u5173\u952e\u70b9<\/span><span style=\"color:#000000\">&#xff1a;<\/span><\/p>\n<ul>\n<li style=\"text-align:justify\"><span style=\"background-color:#ffffff\"><span style=\"color:#222222\">tensorflow.keras<\/span><\/span><span style=\"background-color:#ffffff\"><span style=\"color:#222222\">\u63d0\u4f9b\u4e86\u9ad8\u7ea7\u7684 API&#xff0c;\u4f7f\u5f97\u6784\u5efa\u795e\u7ecf\u7f51\u7edc\u53d8\u5f97\u7b80\u5355\u3002<\/span><\/span><\/li>\n<li style=\"text-align:justify\"><span style=\"background-color:#ffffff\"><span style=\"color:#222222\">layers<\/span><\/span><span style=\"background-color:#ffffff\"><span style=\"color:#222222\">\u6a21\u5757\u5305\u542b\u4e86\u5404\u79cd\u7c7b\u578b\u7684\u5c42&#xff0c;\u5982\u5168\u8fde\u63a5\u5c42&#xff08;<\/span><\/span><span style=\"background-color:#ffffff\"><span style=\"color:#222222\">Dense<\/span><\/span><span style=\"background-color:#ffffff\"><span style=\"color:#222222\">&#xff09;\u3002<\/span><\/span><\/li>\n<\/ul>\n<p style=\"margin-left:0;margin-right:0;text-align:left\"><span style=\"color:#000000\">&#xff08;2&#xff09;\u6ce8\u610f\u70b9<\/span><span style=\"color:#000000\">&#xff1a;<\/span><\/p>\n<ul>\n<li style=\"text-align:justify\"><span style=\"background-color:#ffffff\"><span style=\"color:#222222\">\u786e\u4fdd<\/span><\/span><span style=\"background-color:#ffffff\"><span style=\"color:#222222\">TensorFlow<\/span><\/span><span style=\"background-color:#ffffff\"><span style=\"color:#222222\">\u7248\u672c\u517c\u5bb9&#xff0c;\u4e0d\u540c\u7248\u672c\u7684 API \u53ef\u80fd\u4f1a\u6709\u5dee\u5f02\u3002<\/span><\/span><\/li>\n<\/ul>\n<h3 style=\"margin-left:0pt;margin-right:0pt;text-align:justify\"><span style=\"color:#1a1a1a\">2. \u51c6\u5907\u6570\u636e<\/span><\/h3>\n<p style=\"margin-left:0;margin-right:0;text-align:left\"><span style=\"background-color:#ffffff\"><span style=\"color:#000000\">\u8fd9\u91cc\u4ee5 MNIST \u624b\u5199\u6570\u5b57\u6570\u636e\u96c6\u4e3a\u4f8b\u3002<\/span><\/span><\/p>\n<p style=\"margin-left:0;margin-right:0;text-align:left\"><span style=\"color:#939393\">Python\u811a\u672c<\/span><\/p>\n<p>  # \u52a0\u8f7dMNIST\u6570\u636e\u96c6<br \/>\n(x_train, y_train), (x_test, y_test) &#061; tf.keras.datasets.mnist.load_data()<\/p>\n<p># \u6570\u636e\u9884\u5904\u7406 &#8211; \u5f52\u4e00\u5316\u5230[0,1]\u8303\u56f4<br \/>\nx_train, x_test &#061; x_train \/ 255.0, x_test \/ 255.0<\/p>\n<p># \u67e5\u770b\u6570\u636e\u5f62\u72b6<br \/>\nprint(f&#034;\u8bad\u7ec3\u96c6\u5f62\u72b6: {x_train.shape}, \u6807\u7b7e\u5f62\u72b6: {y_train.shape}&#034;)<br \/>\nprint(f&#034;\u6d4b\u8bd5\u96c6\u5f62\u72b6: {x_test.shape}, \u6807\u7b7e\u5f62\u72b6: {y_test.shape}&#034;) <\/p>\n<p style=\"margin-left:0;margin-right:0;text-align:left\"><span style=\"color:#000000\">&#xff08;1&#xff09;\u5173\u952e\u70b9<\/span><span style=\"color:#000000\">&#xff1a;<\/span><\/p>\n<ul>\n<li style=\"text-align:justify\"><span style=\"background-color:#ffffff\"><span style=\"color:#222222\">\u6570\u636e\u9884\u5904\u7406\u662f\u5f88\u91cd\u8981\u7684\u4e00\u6b65&#xff0c;\u5c06\u50cf\u7d20\u503c\u5f52\u4e00\u5316\u5230 0 &#8211; 1 \u4e4b\u95f4\u53ef\u4ee5\u63d0\u9ad8\u6a21\u578b\u7684\u8bad\u7ec3\u6548\u679c\u3002<\/span><\/span><\/li>\n<li style=\"text-align:justify\"><span style=\"background-color:#ffffff\"><span style=\"color:#222222\">\u6570\u636e\u96c6\u5206\u4e3a\u8bad\u7ec3\u96c6\u548c\u6d4b\u8bd5\u96c6&#xff0c;\u7528\u4e8e\u6a21\u578b\u7684\u8bad\u7ec3\u548c\u8bc4\u4f30\u3002<\/span><\/span><\/li>\n<\/ul>\n<p style=\"margin-left:0;margin-right:0;text-align:left\"><span style=\"color:#000000\">&#xff08;2&#xff09;\u6ce8\u610f\u70b9<\/span><span style=\"color:#000000\">&#xff1a;<\/span><\/p>\n<ul>\n<li style=\"text-align:justify\"><span style=\"background-color:#ffffff\"><span style=\"color:#222222\">\u4e0d\u540c\u7684\u6570\u636e\u96c6\u53ef\u80fd\u9700\u8981\u4e0d\u540c\u7684\u9884\u5904\u7406\u65b9\u6cd5\u3002<\/span><\/span><\/li>\n<\/ul>\n<h3 style=\"margin-left:0pt;margin-right:0pt;text-align:justify\"><span style=\"color:#1a1a1a\">3. \u6784\u5efa\u6a21\u578b<\/span><\/h3>\n<p style=\"margin-left:0;margin-right:0;text-align:left\"><span style=\"color:#939393\">Python\u811a\u672c<\/span><\/p>\n<p>  # \u5bfc\u5165\u5fc5\u8981\u7684\u5e93<br \/>\nimport tensorflow as tf<br \/>\nfrom tensorflow import keras<br \/>\nfrom tensorflow.keras import layers, models<\/p>\n<p># \u6784\u5efa\u5168\u8fde\u63a5\u795e\u7ecf\u7f51\u7edc\u6a21\u578b<br \/>\nmodel &#061; models.Sequential([<br \/>\n    # \u5c0628&#215;28\u7684\u56fe\u50cf\u5c55\u5e73\u4e3a\u4e00\u7ef4\u5411\u91cf<br \/>\n    layers.Flatten(input_shape&#061;(28, 28)),<\/p>\n<p>    # \u7b2c\u4e00\u4e2a\u9690\u85cf\u5c42&#xff0c;\u6709128\u4e2a\u795e\u7ecf\u5143&#xff0c;\u4f7f\u7528ReLU\u6fc0\u6d3b\u51fd\u6570<br \/>\n    layers.Dense(128, activation&#061;&#039;relu&#039;),<\/p>\n<p>    # \u9632\u6b62\u8fc7\u62df\u5408&#xff0c;\u968f\u673a\u4e22\u5f0320%\u7684\u795e\u7ecf\u5143<br \/>\n    layers.Dropout(0.2),<\/p>\n<p>    # \u8f93\u51fa\u5c42&#xff0c;\u670910\u4e2a\u795e\u7ecf\u5143&#xff0c;\u5bf9\u5e940-9\u7684\u6570\u5b57&#xff0c;\u4f7f\u7528softmax\u6fc0\u6d3b\u51fd\u6570<br \/>\n    layers.Dense(10, activation&#061;&#039;softmax&#039;)<br \/>\n])<\/p>\n<p># \u7f16\u8bd1\u6a21\u578b<br \/>\nmodel.compile(<br \/>\n    optimizer&#061;&#039;adam&#039;,<br \/>\n    loss&#061;&#039;sparse_categorical_crossentropy&#039;,<br \/>\n    metrics&#061;[&#039;accuracy&#039;]<br \/>\n)<\/p>\n<p># \u67e5\u770b\u6a21\u578b\u7ed3\u6784<br \/>\nmodel.summary() <\/p>\n<p style=\"margin-left:0;margin-right:0;text-align:left\"><span style=\"color:#000000\">&#xff08;1&#xff09;\u5173\u952e\u70b9<\/span><span style=\"color:#000000\">&#xff1a;<\/span><\/p>\n<ul>\n<li style=\"text-align:justify\"><span style=\"background-color:#ffffff\"><span style=\"color:#222222\">Sequential<\/span><\/span><span style=\"background-color:#ffffff\"><span style=\"color:#222222\">\u6a21\u578b\u662f\u4e00\u79cd\u7b80\u5355\u7684\u7ebf\u6027\u5806\u53e0\u6a21\u578b&#xff0c;\u6309\u987a\u5e8f\u6dfb\u52a0\u5404\u4e2a\u5c42\u3002<\/span><\/span><\/li>\n<li style=\"text-align:justify\"><span style=\"background-color:#ffffff\"><span style=\"color:#222222\">Flatten<\/span><\/span><span style=\"background-color:#ffffff\"><span style=\"color:#222222\">\u5c42\u5c06\u4e8c\u7ef4\u7684\u56fe\u50cf\u6570\u636e\u5c55\u5e73\u4e3a\u4e00\u7ef4\u5411\u91cf&#xff0c;\u4ee5\u4fbf\u8f93\u5165\u5230\u5168\u8fde\u63a5\u5c42\u3002<\/span><\/span><\/li>\n<li style=\"text-align:justify\"><span style=\"background-color:#ffffff\"><span style=\"color:#222222\">Dense<\/span><\/span><span style=\"background-color:#ffffff\"><span style=\"color:#222222\">\u5c42\u662f\u5168\u8fde\u63a5\u5c42&#xff0c;<\/span><\/span><span style=\"background-color:#ffffff\"><span style=\"color:#222222\">activation<\/span><\/span><span style=\"background-color:#ffffff\"><span style=\"color:#222222\">\u53c2\u6570\u6307\u5b9a\u6fc0\u6d3b\u51fd\u6570&#xff0c;\u5e38\u7528\u7684\u6709 ReLU\u3001softmax \u7b49\u3002<\/span><\/span><\/li>\n<li style=\"text-align:justify\"><span style=\"background-color:#ffffff\"><span style=\"color:#222222\">Dropout<\/span><\/span><span style=\"background-color:#ffffff\"><span style=\"color:#222222\">\u5c42\u7528\u4e8e\u9632\u6b62\u8fc7\u62df\u5408&#xff0c;\u5728\u8bad\u7ec3\u8fc7\u7a0b\u4e2d\u968f\u673a\u4e22\u5f03\u4e00\u90e8\u5206\u795e\u7ecf\u5143\u3002<\/span><\/span><\/li>\n<\/ul>\n<p style=\"margin-left:0;margin-right:0;text-align:left\"><span style=\"color:#000000\">&#xff08;2&#xff09;\u6ce8\u610f\u70b9<\/span><span style=\"color:#000000\">&#xff1a;<\/span><\/p>\n<ul>\n<li style=\"text-align:justify\"><span style=\"background-color:#ffffff\"><span style=\"color:#222222\">\u9690\u85cf\u5c42\u7684\u795e\u7ecf\u5143\u6570\u91cf\u548c\u5c42\u6570\u9700\u8981\u6839\u636e\u5177\u4f53\u95ee\u9898\u8fdb\u884c\u8c03\u6574&#xff0c;\u8fc7\u591a\u7684\u795e\u7ecf\u5143\u6216\u5c42\u6570\u53ef\u80fd\u5bfc\u81f4\u8fc7\u62df\u5408\u3002<\/span><\/span><\/li>\n<li style=\"text-align:justify\"><span style=\"background-color:#ffffff\"><span style=\"color:#222222\">\u8f93\u51fa\u5c42\u7684\u795e\u7ecf\u5143\u6570\u91cf\u548c\u6fc0\u6d3b\u51fd\u6570\u9700\u8981\u6839\u636e\u5177\u4f53\u4efb\u52a1\u6765\u9009\u62e9&#xff0c;\u4f8b\u5982\u5206\u7c7b\u4efb\u52a1\u901a\u5e38\u4f7f\u7528 softmax \u6fc0\u6d3b\u51fd\u6570\u3002<\/span><\/span><\/li>\n<\/ul>\n<h3 style=\"margin-left:0pt;margin-right:0pt;text-align:justify\"><span style=\"color:#1a1a1a\">4. \u7f16\u8bd1\u6a21\u578b<\/span><\/h3>\n<p style=\"margin-left:0;margin-right:0;text-align:left\"><span style=\"color:#939393\">Python\u811a\u672c<\/span><\/p>\n<p>  # \u7f16\u8bd1\u6a21\u578b&#xff0c;\u914d\u7f6e\u8bad\u7ec3\u6240\u9700\u7684\u5173\u952e\u53c2\u6570&#xff0c;\u8ba9\u6a21\u578b\u505a\u597d\u8bad\u7ec3\u7684\u51c6\u5907<br \/>\nmodel.compile(<br \/>\n    # \u6307\u5b9a\u4f18\u5316\u5668\u4e3a &#039;adam&#039;<br \/>\n    # Adam \u4f18\u5316\u5668\u7ed3\u5408\u4e86 AdaGrad \u548c RMSProp \u7684\u4f18\u70b9&#xff0c;<br \/>\n    # \u80fd\u591f\u81ea\u9002\u5e94\u5730\u8c03\u6574\u6bcf\u4e2a\u53c2\u6570\u7684\u5b66\u4e60\u7387&#xff0c;<br \/>\n    # \u4f7f\u5f97\u6a21\u578b\u5728\u8bad\u7ec3\u65f6\u6536\u655b\u901f\u5ea6\u66f4\u5feb\u4e14\u66f4\u7a33\u5b9a<br \/>\n    optimizer&#061;&#039;adam&#039;,<\/p>\n<p>    # \u6307\u5b9a\u635f\u5931\u51fd\u6570\u4e3a &#039;sparse_categorical_crossentropy&#039;<br \/>\n    # \u9002\u7528\u4e8e\u591a\u5206\u7c7b\u95ee\u9898\u4e2d\u6807\u7b7e\u4e3a\u6574\u6570\u7f16\u7801\u7684\u60c5\u51b5&#xff08;\u4f8b\u5982 0, 1, 2&#8230;&#xff09;<br \/>\n    # \u6a21\u578b\u8bad\u7ec3\u7684\u76ee\u6807\u662f\u6700\u5c0f\u5316\u8fd9\u4e2a\u635f\u5931\u503c<br \/>\n    loss&#061;&#039;sparse_categorical_crossentropy&#039;,<\/p>\n<p>    # \u6307\u5b9a\u8bc4\u4f30\u6307\u6807\u4e3a &#039;accuracy&#039;<br \/>\n    # \u51c6\u786e\u7387 &#061; \u9884\u6d4b\u6b63\u786e\u7684\u6837\u672c\u6570 \/ \u603b\u6837\u672c\u6570<br \/>\n    # \u7528\u4e8e\u76f4\u89c2\u4e86\u89e3\u6a21\u578b\u7684\u5206\u7c7b\u6548\u679c<br \/>\n    metrics&#061;[&#039;accuracy&#039;]<br \/>\n) <\/p>\n<p style=\"margin-left:0;margin-right:0;text-align:left\"><span style=\"color:#000000\">&#xff08;1&#xff09;\u5173\u952e\u70b9<\/span><span style=\"color:#000000\">&#xff1a;<\/span><\/p>\n<ul>\n<li style=\"text-align:justify\"><span style=\"background-color:#ffffff\"><span style=\"color:#222222\">optimizer<\/span><\/span><span style=\"background-color:#ffffff\"><span style=\"color:#222222\">\u6307\u5b9a\u4f18\u5316\u5668&#xff0c;\u5982<\/span><\/span><span style=\"background-color:#ffffff\"><span style=\"color:#222222\">adam<\/span><\/span><span style=\"background-color:#ffffff\"><span style=\"color:#222222\">&#xff0c;\u7528\u4e8e\u66f4\u65b0\u6a21\u578b\u7684\u53c2\u6570\u3002<\/span><\/span><\/li>\n<li style=\"text-align:justify\"><span style=\"background-color:#ffffff\"><span style=\"color:#222222\">loss<\/span><\/span><span style=\"background-color:#ffffff\"><span style=\"color:#222222\">\u6307\u5b9a\u635f\u5931\u51fd\u6570&#xff0c;<\/span><\/span><span style=\"background-color:#ffffff\"><span style=\"color:#222222\">sparse_categorical_crossentropy<\/span><\/span><span style=\"background-color:#ffffff\"><span style=\"color:#222222\">\u9002\u7528\u4e8e\u591a\u5206\u7c7b\u95ee\u9898\u3002<\/span><\/span><\/li>\n<li style=\"text-align:justify\"><span style=\"background-color:#ffffff\"><span style=\"color:#222222\">metrics<\/span><\/span><span style=\"background-color:#ffffff\"><span style=\"color:#222222\">\u6307\u5b9a\u8bc4\u4f30\u6307\u6807&#xff0c;\u8fd9\u91cc\u4f7f\u7528<\/span><\/span><span style=\"background-color:#ffffff\"><span style=\"color:#222222\">accuracy<\/span><\/span><span style=\"background-color:#ffffff\"><span style=\"color:#222222\">\u6765\u8bc4\u4f30\u6a21\u578b\u7684\u51c6\u786e\u7387\u3002<\/span><\/span><\/li>\n<\/ul>\n<p style=\"margin-left:0;margin-right:0;text-align:left\"><span style=\"color:#000000\">&#xff08;2&#xff09;\u6ce8\u610f\u70b9<\/span><span style=\"color:#000000\">&#xff1a;<\/span><\/p>\n<ul>\n<li style=\"text-align:justify\"><span style=\"background-color:#ffffff\"><span style=\"color:#222222\">\u4e0d\u540c\u7684\u4efb\u52a1\u9700\u8981\u9009\u62e9\u4e0d\u540c\u7684\u635f\u5931\u51fd\u6570\u548c\u4f18\u5316\u5668\u3002<\/span><\/span><\/li>\n<\/ul>\n<h3 style=\"margin-left:0pt;margin-right:0pt;text-align:justify\"><span style=\"color:#1a1a1a\">5. \u8bad\u7ec3\u6a21\u578b<\/span><\/h3>\n<p style=\"margin-left:0;margin-right:0;text-align:left\"><span style=\"color:#939393\">Python\u811a\u672c<\/span><\/p>\n<p>  # \u8bad\u7ec3\u6a21\u578b&#xff0c;\u901a\u8fc7\u8be5\u64cd\u4f5c\u8ba9\u6a21\u578b\u5b66\u4e60\u8bad\u7ec3\u6570\u636e\u4e2d\u7684\u7279\u5f81\u548c\u6a21\u5f0f&#xff0c;\u4ee5\u63d0\u5347\u6a21\u578b\u6027\u80fd<br \/>\nhistory &#061; model.fit(<br \/>\n    # \u4f20\u5165\u8bad\u7ec3\u6570\u636e\u7684\u7279\u5f81\u90e8\u5206&#xff0c;\u5373 x_train<br \/>\n    x_train,<br \/>\n    # \u4f20\u5165\u8bad\u7ec3\u6570\u636e\u7684\u6807\u7b7e\u90e8\u5206&#xff0c;\u5373 y_train<br \/>\n    y_train,<br \/>\n    # \u6307\u5b9a\u8bad\u7ec3\u7684\u8f6e\u6570\u4e3a 5&#xff0c;\u5373\u6574\u4e2a\u8bad\u7ec3\u6570\u636e\u96c6\u4f1a\u88ab\u6a21\u578b\u904d\u5386 5 \u6b21<br \/>\n    epochs&#061;5,<br \/>\n    # \u6dfb\u52a0\u9a8c\u8bc1\u6570\u636e&#xff0c;\u7528\u4e8e\u76d1\u63a7\u6a21\u578b\u5728\u672a\u89c1\u6570\u636e\u4e0a\u7684\u8868\u73b0<br \/>\n    validation_data&#061;(x_val, y_val),<br \/>\n    # \u8bbe\u7f6e\u6279\u6b21\u5927\u5c0f&#xff0c;\u9ed8\u8ba4\u901a\u5e38\u662f32<br \/>\n    batch_size&#061;32,<br \/>\n    # \u8bbe\u7f6everbose\u53c2\u6570&#xff0c;\u63a7\u5236\u8bad\u7ec3\u8fc7\u7a0b\u7684\u663e\u793a\u8be6\u7ec6\u7a0b\u5ea6<br \/>\n    # 0&#061;\u9759\u9ed8\u6a21\u5f0f&#xff0c;1&#061;\u8fdb\u5ea6\u6761&#xff0c;2&#061;\u6bcf\u8f6e\u663e\u793a\u4e00\u884c<br \/>\n    verbose&#061;1<br \/>\n)<\/p>\n<p># \u53ef\u9009&#xff1a;\u4f7f\u7528\u8fd4\u56de\u7684history\u5bf9\u8c61\u6765\u5206\u6790\u8bad\u7ec3\u8fc7\u7a0b<br \/>\nimport matplotlib.pyplot as plt<\/p>\n<p># \u7ed8\u5236\u8bad\u7ec3\u5386\u53f2<br \/>\ndef plot_training_history(history):<br \/>\n    &#034;&#034;&#034;<br \/>\n    \u7ed8\u5236\u6a21\u578b\u8bad\u7ec3\u5386\u53f2<br \/>\n    &#034;&#034;&#034;<br \/>\n    fig, (ax1, ax2) &#061; plt.subplots(1, 2, figsize&#061;(12, 4))<\/p>\n<p>    # \u7ed8\u5236\u635f\u5931\u66f2\u7ebf<br \/>\n    ax1.plot(history.history[&#039;loss&#039;], label&#061;&#039;Training Loss&#039;)<br \/>\n    ax1.plot(history.history[&#039;val_loss&#039;], label&#061;&#039;Validation Loss&#039;)<br \/>\n    ax1.set_title(&#039;Model Loss&#039;)<br \/>\n    ax1.set_xlabel(&#039;Epoch&#039;)<br \/>\n    ax1.set_ylabel(&#039;Loss&#039;)<br \/>\n    ax1.legend()<\/p>\n<p>    # \u7ed8\u5236\u51c6\u786e\u7387\u66f2\u7ebf&#xff08;\u5982\u679c\u6709\u7684\u8bdd&#xff09;<br \/>\n    if &#039;accuracy&#039; in history.history:<br \/>\n        ax2.plot(history.history[&#039;accuracy&#039;], label&#061;&#039;Training Accuracy&#039;)<br \/>\n        ax2.plot(history.history[&#039;val_accuracy&#039;], label&#061;&#039;Validation Accuracy&#039;)<br \/>\n        ax2.set_title(&#039;Model Accuracy&#039;)<br \/>\n        ax2.set_xlabel(&#039;Epoch&#039;)<br \/>\n        ax2.set_ylabel(&#039;Accuracy&#039;)<br \/>\n        ax2.legend()<\/p>\n<p>    plt.tight_layout()<br \/>\n    plt.show()<\/p>\n<p># \u8c03\u7528\u7ed8\u56fe\u51fd\u6570<br \/>\n# plot_training_history(history) <\/p>\n<p style=\"margin-left:0;margin-right:0;text-align:left\"><span style=\"color:#000000\">&#xff08;1&#xff09;\u5173\u952e\u70b9<\/span><span style=\"color:#000000\">&#xff1a;<\/span><\/p>\n<ul>\n<li style=\"text-align:justify\"><span style=\"background-color:#ffffff\"><span style=\"color:#222222\">fit<\/span><\/span><span style=\"background-color:#ffffff\"><span style=\"color:#222222\">\u65b9\u6cd5\u7528\u4e8e\u8bad\u7ec3\u6a21\u578b&#xff0c;<\/span><\/span><span style=\"background-color:#ffffff\"><span style=\"color:#222222\">epochs<\/span><\/span><span style=\"background-color:#ffffff\"><span style=\"color:#222222\">\u6307\u5b9a\u8bad\u7ec3\u7684\u8f6e\u6570\u3002<\/span><\/span><\/li>\n<\/ul>\n<p style=\"margin-left:0;margin-right:0;text-align:left\"><span style=\"color:#000000\">&#xff08;2&#xff09;\u6ce8\u610f\u70b9<\/span><span style=\"color:#000000\">&#xff1a;<\/span><\/p>\n<ul>\n<li style=\"text-align:justify\"><span style=\"background-color:#ffffff\"><span style=\"color:#222222\">\u8fc7\u591a\u7684\u8bad\u7ec3\u8f6e\u6570\u53ef\u80fd\u5bfc\u81f4\u8fc7\u62df\u5408&#xff0c;\u9700\u8981\u901a\u8fc7\u9a8c\u8bc1\u96c6\u6216\u4ea4\u53c9\u9a8c\u8bc1\u6765\u9009\u62e9\u5408\u9002\u7684\u8f6e\u6570\u3002<\/span><\/span><\/li>\n<\/ul>\n<h3 style=\"margin-left:0pt;margin-right:0pt;text-align:justify\"><span style=\"color:#1a1a1a\">6. \u8bc4\u4f30\u6a21\u578b<\/span><\/h3>\n<p style=\"margin-left:0;margin-right:0;text-align:left\"><span style=\"color:#939393\">Python\u811a\u672c<\/span><\/p>\n<p>  # \u8bc4\u4f30\u6a21\u578b\u5728\u6d4b\u8bd5\u96c6\u4e0a\u7684\u6027\u80fd&#xff0c;\u4ee5\u4e86\u89e3\u6a21\u578b\u7684\u6cdb\u5316\u80fd\u529b<br \/>\ntry:<br \/>\n    # model.evaluate \u65b9\u6cd5\u8fd4\u56de\u6a21\u578b\u5728\u6d4b\u8bd5\u96c6\u4e0a\u7684\u635f\u5931\u503c\u548c\u8bc4\u4f30\u6307\u6807\u503c<br \/>\n    test_loss, test_acc &#061; model.evaluate(<br \/>\n        x_test,           # \u6d4b\u8bd5\u6570\u636e\u7684\u7279\u5f81\u90e8\u5206<br \/>\n        y_test,           # \u6d4b\u8bd5\u6570\u636e\u7684\u771f\u5b9e\u6807\u7b7e<br \/>\n        verbose&#061;1         # \u663e\u793a\u8bc4\u4f30\u8fdb\u5ea6&#xff08;0&#061;\u9759\u9ed8&#xff0c;1&#061;\u8fdb\u5ea6\u6761&#xff0c;2&#061;\u6bcf\u8f6e\u4e00\u884c&#xff09;<br \/>\n    )<\/p>\n<p>    # \u6253\u5370\u6d4b\u8bd5\u7ed3\u679c&#xff0c;\u4f7f\u7528 f-string \u683c\u5f0f\u5316\u8f93\u51fa<br \/>\n    print(f&#034;Test Loss: {test_loss:.4f}&#034;)<br \/>\n    print(f&#034;Test Accuracy: {test_acc:.4f} ({test_acc*100:.2f}%)&#034;)<\/p>\n<p>except Exception as e:<br \/>\n    print(f&#034;\u6a21\u578b\u8bc4\u4f30\u8fc7\u7a0b\u4e2d\u51fa\u73b0\u9519\u8bef: {e}&#034;) <\/p>\n<p style=\"margin-left:0;margin-right:0;text-align:left\"><span style=\"color:#000000\">&#xff08;1&#xff09;\u5173\u952e\u70b9<\/span><span style=\"color:#000000\">&#xff1a;<\/span><\/p>\n<ul>\n<li style=\"text-align:justify\"><span style=\"background-color:#ffffff\"><span style=\"color:#222222\">evaluate<\/span><\/span><span style=\"background-color:#ffffff\"><span style=\"color:#222222\">\u65b9\u6cd5\u7528\u4e8e\u8bc4\u4f30\u6a21\u578b\u5728\u6d4b\u8bd5\u96c6\u4e0a\u7684\u6027\u80fd\u3002<\/span><\/span><\/li>\n<\/ul>\n<p style=\"margin-left:0;margin-right:0;text-align:left\"><span style=\"color:#000000\">&#xff08;2&#xff09;\u6ce8\u610f\u70b9<\/span><span style=\"color:#000000\">&#xff1a;<\/span><\/p>\n<ul>\n<li style=\"text-align:justify\"><span style=\"background-color:#ffffff\"><span style=\"color:#222222\">\u6d4b\u8bd5\u96c6\u5e94\u8be5\u4e0e\u8bad\u7ec3\u96c6\u72ec\u7acb&#xff0c;\u4ee5\u4fdd\u8bc1\u8bc4\u4f30\u7ed3\u679c\u7684\u5ba2\u89c2\u6027\u3002<\/span><\/span><\/li>\n<\/ul>\n<h3 style=\"margin-left:0pt;margin-right:0pt;text-align:justify\"><span style=\"color:#1a1a1a\">\u4e8c\u3001<\/span><span style=\"color:#1a1a1a\">\u5b8c\u6574\u4ee3\u7801\u793a\u4f8b<\/span><\/h3>\n<h3 style=\"margin-left:21pt;margin-right:0pt;text-align:justify\"><span style=\"color:#939393\">Python\u811a\u672c<\/span><\/h3>\n<p>  # \u5bfc\u5165\u5fc5\u8981\u7684\u5e93<br \/>\nimport tensorflow as tf<br \/>\nfrom tensorflow.keras import layers, models<\/p>\n<p># \u8bbe\u7f6e\u968f\u673a\u79cd\u5b50\u4ee5\u4fdd\u8bc1\u7ed3\u679c\u53ef\u590d\u73b0&#xff08;\u53ef\u9009&#xff09;<br \/>\ntf.random.set_seed(42)<\/p>\n<p># \u52a0\u8f7d MNIST \u6570\u636e\u96c6<br \/>\nmnist &#061; tf.keras.datasets.mnist<br \/>\n(x_train, y_train), (x_test, y_test) &#061; mnist.load_data()<\/p>\n<p># \u6570\u636e\u9884\u5904\u7406&#xff1a;\u5f52\u4e00\u5316\u5230 [0, 1]<br \/>\nx_train, x_test &#061; x_train \/ 255.0, x_test \/ 255.0<\/p>\n<p># \u6784\u5efa\u6a21\u578b<br \/>\nmodel &#061; models.Sequential([<br \/>\n    layers.Flatten(input_shape&#061;(28, 28)),        # \u5c55\u5e73\u56fe\u50cf<br \/>\n    layers.Dense(128, activation&#061;&#039;relu&#039;),        # \u5168\u8fde\u63a5\u5c42 &#043; ReLU<br \/>\n    layers.Dropout(0.2),                         # Dropout \u9632\u6b62\u8fc7\u62df\u5408<br \/>\n    layers.Dense(10, activation&#061;&#039;softmax&#039;)       # \u8f93\u51fa\u5c42&#xff0c;10\u7c7b\u5206\u7c7b<br \/>\n])<\/p>\n<p># \u7f16\u8bd1\u6a21\u578b<br \/>\nmodel.compile(<br \/>\n    optimizer&#061;&#039;adam&#039;,<br \/>\n    loss&#061;&#039;sparse_categorical_crossentropy&#039;,<br \/>\n    metrics&#061;[&#039;accuracy&#039;]<br \/>\n)<\/p>\n<p># \u663e\u793a\u6a21\u578b\u7ed3\u6784<br \/>\nmodel.summary()<\/p>\n<p># \u8bad\u7ec3\u6a21\u578b<br \/>\nmodel.fit(<br \/>\n    x_train,<br \/>\n    y_train,<br \/>\n    epochs&#061;5,<br \/>\n    validation_split&#061;0.1  # \u4f7f\u752810%\u8bad\u7ec3\u6570\u636e\u4f5c\u4e3a\u9a8c\u8bc1\u96c6&#xff08;\u53ef\u9009&#xff09;<br \/>\n)<\/p>\n<p># \u5728\u6d4b\u8bd5\u96c6\u4e0a\u8bc4\u4f30\u6a21\u578b<br \/>\ntest_loss, test_acc &#061; model.evaluate(x_test, y_test, verbose&#061;2)<\/p>\n<p># \u6253\u5370\u6d4b\u8bd5\u51c6\u786e\u7387<br \/>\nprint(f&#034;\\\\nTest accuracy: {test_acc:.4f}&#034;) <\/p>\n<h3 style=\"margin-left:21pt;margin-right:0pt;text-align:justify\"><span style=\"color:#1a1a1a\">\u8f93\u51fa \/ \u6253\u5370\u7ed3\u679c\u793a\u4f8b\u53ca\u6ce8\u91ca<\/span><\/h3>\n<p style=\"margin-left:0;margin-right:0;text-align:left\"><span style=\"background-color:#ffffff\"><span style=\"color:#222222\">plaintext<\/span><\/span><\/p>\n<p style=\"margin-left:0;margin-right:0;text-align:left\"><span style=\"background-color:#ffffff\"><span style=\"color:#000000\">Epoch 1\/5<\/span><\/span><\/p>\n<p style=\"margin-left:0;margin-right:0;text-align:left\"><span style=\"background-color:#ffffff\"><span style=\"color:#000000\">1875\/1875 [&#061;&#061;&#061;&#061;&#061;&#061;&#061;&#061;&#061;&#061;&#061;&#061;&#061;&#061;&#061;&#061;&#061;&#061;&#061;&#061;&#061;&#061;&#061;&#061;&#061;&#061;&#061;&#061;&#061;&#061;] &#8211; 3s 2ms\/step &#8211; loss: 0.2587 &#8211; accuracy: 0.9246<\/span><\/span><\/p>\n<p style=\"margin-left:0;margin-right:0;text-align:left\"><span style=\"background-color:#ffffff\"><span style=\"color:#000000\">Epoch 2\/5<\/span><\/span><\/p>\n<p style=\"margin-left:0;margin-right:0;text-align:left\"><span style=\"background-color:#ffffff\"><span style=\"color:#000000\">1875\/1875 [&#061;&#061;&#061;&#061;&#061;&#061;&#061;&#061;&#061;&#061;&#061;&#061;&#061;&#061;&#061;&#061;&#061;&#061;&#061;&#061;&#061;&#061;&#061;&#061;&#061;&#061;&#061;&#061;&#061;&#061;] &#8211; 3s 2ms\/step &#8211; loss: 0.1077 &#8211; accuracy: 0.9678<\/span><\/span><\/p>\n<p style=\"margin-left:0;margin-right:0;text-align:left\"><span style=\"background-color:#ffffff\"><span style=\"color:#000000\">Epoch 3\/5<\/span><\/span><\/p>\n<p style=\"margin-left:0;margin-right:0;text-align:left\"><span style=\"background-color:#ffffff\"><span style=\"color:#000000\">1875\/1875 [&#061;&#061;&#061;&#061;&#061;&#061;&#061;&#061;&#061;&#061;&#061;&#061;&#061;&#061;&#061;&#061;&#061;&#061;&#061;&#061;&#061;&#061;&#061;&#061;&#061;&#061;&#061;&#061;&#061;&#061;] &#8211; 3s 2ms\/step &#8211; loss: 0.0737 &#8211; accuracy: 0.9778<\/span><\/span><\/p>\n<p style=\"margin-left:0;margin-right:0;text-align:left\"><span style=\"background-color:#ffffff\"><span style=\"color:#000000\">Epoch 4\/5<\/span><\/span><\/p>\n<p style=\"margin-left:0;margin-right:0;text-align:left\"><span style=\"background-color:#ffffff\"><span style=\"color:#000000\">1875\/1875 [&#061;&#061;&#061;&#061;&#061;&#061;&#061;&#061;&#061;&#061;&#061;&#061;&#061;&#061;&#061;&#061;&#061;&#061;&#061;&#061;&#061;&#061;&#061;&#061;&#061;&#061;&#061;&#061;&#061;&#061;] &#8211; 3s 2ms\/step &#8211; loss: 0.0538 &#8211; accuracy: 0.9837<\/span><\/span><\/p>\n<p style=\"margin-left:0;margin-right:0;text-align:left\"><span style=\"background-color:#ffffff\"><span style=\"color:#000000\">Epoch 5\/5<\/span><\/span><\/p>\n<p style=\"margin-left:0;margin-right:0;text-align:left\"><span style=\"background-color:#ffffff\"><span style=\"color:#000000\">1875\/1875 [&#061;&#061;&#061;&#061;&#061;&#061;&#061;&#061;&#061;&#061;&#061;&#061;&#061;&#061;&#061;&#061;&#061;&#061;&#061;&#061;&#061;&#061;&#061;&#061;&#061;&#061;&#061;&#061;&#061;&#061;] &#8211; 3s 2ms\/step &#8211; loss: 0.0425 &#8211; accuracy: 0.9868<\/span><\/span><\/p>\n<p style=\"margin-left:0;margin-right:0;text-align:left\"><span style=\"background-color:#ffffff\"><span style=\"color:#000000\">313\/313 [&#061;&#061;&#061;&#061;&#061;&#061;&#061;&#061;&#061;&#061;&#061;&#061;&#061;&#061;&#061;&#061;&#061;&#061;&#061;&#061;&#061;&#061;&#061;&#061;&#061;&#061;&#061;&#061;&#061;&#061;] &#8211; 1s 2ms\/step &#8211; loss: 0.0733 &#8211; accuracy: 0.9787<\/span><\/span><\/p>\n<p style=\"margin-left:0;margin-right:0;text-align:left\"><span style=\"background-color:#ffffff\"><span style=\"color:#000000\">Test accuracy: 0.9787000155448914<\/span><\/span><\/p>\n<h3 style=\"margin-left:21pt;margin-right:0pt;text-align:justify\"><span style=\"color:#1a1a1a\">\u8f93\u51fa\u7ed3\u679c\u6ce8\u91ca<\/span><\/h3>\n<p style=\"margin-left:0;margin-right:0;text-align:left\"><span style=\"color:#000000\">&#xff08;1&#xff09;\u8bad\u7ec3\u8fc7\u7a0b\u8f93\u51fa<\/span><span style=\"color:#000000\">&#xff1a;<\/span><\/p>\n<ul>\n<li style=\"text-align:justify\"><span style=\"background-color:#ffffff\"><span style=\"color:#222222\">Epoch 1\/5<\/span><\/span><span style=\"background-color:#ffffff\"><span style=\"color:#222222\">\u00a0\u8868\u793a\u5f53\u524d\u662f\u7b2c 1 \u8f6e\u8bad\u7ec3&#xff0c;\u603b\u5171\u8981\u8fdb\u884c 5 \u8f6e\u8bad\u7ec3\u3002<\/span><\/span><\/li>\n<li style=\"text-align:justify\"><span style=\"background-color:#ffffff\"><span style=\"color:#222222\">1875\/1875<\/span><\/span><span style=\"background-color:#ffffff\"><span style=\"color:#222222\">\u00a0\u8868\u793a\u8bad\u7ec3\u6570\u636e\u603b\u5171\u88ab\u5206\u6210\u4e86 1875 \u4e2a\u6279\u6b21&#xff0c;\u5f53\u524d\u5df2\u7ecf\u5b8c\u6210\u4e86\u6240\u6709\u6279\u6b21\u7684\u8bad\u7ec3\u3002<\/span><\/span><\/li>\n<li style=\"text-align:justify\"><span style=\"background-color:#ffffff\"><span style=\"color:#222222\">3s 2ms\/step<\/span><\/span><span style=\"background-color:#ffffff\"><span style=\"color:#222222\">\u00a0\u8868\u793a\u8fd9\u4e00\u8f6e\u8bad\u7ec3\u603b\u5171\u82b1\u8d39\u4e86 3 \u79d2&#xff0c;\u5e73\u5747\u6bcf\u4e2a\u6279\u6b21\u7684\u8bad\u7ec3\u65f6\u95f4\u662f 2 \u6beb\u79d2\u3002<\/span><\/span><\/li>\n<li style=\"text-align:justify\"><span style=\"background-color:#ffffff\"><span style=\"color:#222222\">loss: 0.2587<\/span><\/span><span style=\"background-color:#ffffff\"><span style=\"color:#222222\">\u00a0\u8868\u793a\u8fd9\u4e00\u8f6e\u8bad\u7ec3\u7ed3\u675f\u540e&#xff0c;\u6a21\u578b\u5728\u8bad\u7ec3\u96c6\u4e0a\u7684\u635f\u5931\u503c\u4e3a 0.2587&#xff0c;\u635f\u5931\u503c\u8d8a\u5c0f\u8bf4\u660e\u6a21\u578b\u9884\u6d4b\u7ed3\u679c\u4e0e\u771f\u5b9e\u6807\u7b7e\u8d8a\u63a5\u8fd1\u3002<\/span><\/span><\/li>\n<li style=\"text-align:justify\"><span style=\"background-color:#ffffff\"><span style=\"color:#222222\">accuracy: 0.9246<\/span><\/span><span style=\"background-color:#ffffff\"><span style=\"color:#222222\">\u00a0\u8868\u793a\u8fd9\u4e00\u8f6e\u8bad\u7ec3\u7ed3\u675f\u540e&#xff0c;\u6a21\u578b\u5728\u8bad\u7ec3\u96c6\u4e0a\u7684\u51c6\u786e\u7387\u4e3a 92.46%&#xff0c;\u5373\u6a21\u578b\u6b63\u786e\u9884\u6d4b\u7684\u6837\u672c\u6570\u5360\u603b\u6837\u672c\u6570\u7684\u6bd4\u4f8b\u3002<\/span><\/span><\/li>\n<\/ul>\n<p style=\"margin-left:0;margin-right:0;text-align:left\"><span style=\"color:#000000\">&#xff08;2&#xff09;\u8bc4\u4f30\u8fc7\u7a0b\u8f93\u51fa<\/span><span style=\"color:#000000\">&#xff1a;<\/span><\/p>\n<ul>\n<li style=\"text-align:justify\"><span style=\"background-color:#ffffff\"><span style=\"color:#222222\">313\/313<\/span><\/span><span style=\"background-color:#ffffff\"><span style=\"color:#222222\">\u00a0\u8868\u793a\u6d4b\u8bd5\u6570\u636e\u603b\u5171\u88ab\u5206\u6210\u4e86 313 \u4e2a\u6279\u6b21&#xff0c;\u5f53\u524d\u5df2\u7ecf\u5b8c\u6210\u4e86\u6240\u6709\u6279\u6b21\u7684\u8bc4\u4f30\u3002<\/span><\/span><\/li>\n<li style=\"text-align:justify\"><span style=\"background-color:#ffffff\"><span style=\"color:#222222\">1s 2ms\/step<\/span><\/span><span style=\"background-color:#ffffff\"><span style=\"color:#222222\">\u00a0\u8868\u793a\u8bc4\u4f30\u8fc7\u7a0b\u603b\u5171\u82b1\u8d39\u4e86 1 \u79d2&#xff0c;\u5e73\u5747\u6bcf\u4e2a\u6279\u6b21\u7684\u8bc4\u4f30\u65f6\u95f4\u662f 2 \u6beb\u79d2\u3002<\/span><\/span><\/li>\n<li style=\"text-align:justify\"><span style=\"background-color:#ffffff\"><span style=\"color:#222222\">loss: 0.0733<\/span><\/span><span style=\"background-color:#ffffff\"><span style=\"color:#222222\">\u00a0\u8868\u793a\u6a21\u578b\u5728\u6d4b\u8bd5\u96c6\u4e0a\u7684\u635f\u5931\u503c\u4e3a 0.0733\u3002<\/span><\/span><\/li>\n<li style=\"text-align:justify\"><span style=\"background-color:#ffffff\"><span style=\"color:#222222\">accuracy: 0.9787<\/span><\/span><span style=\"background-color:#ffffff\"><span style=\"color:#222222\">\u00a0\u8868\u793a\u6a21\u578b\u5728\u6d4b\u8bd5\u96c6\u4e0a\u7684\u51c6\u786e\u7387\u4e3a 97.87%\u3002<\/span><\/span><\/li>\n<\/ul>\n<p style=\"margin-left:0;margin-right:0;text-align:left\"><span style=\"color:#000000\">&#xff08;3&#xff09;\u6700\u7ec8\u6253\u5370\u7ed3\u679c<\/span><span style=\"color:#000000\">&#xff1a;<\/span><\/p>\n<ul>\n<li style=\"text-align:justify\"><span style=\"background-color:#ffffff\"><span style=\"color:#222222\">Test accuracy: 0.9787000155448914<\/span><\/span><span style=\"background-color:#ffffff\"><span style=\"color:#222222\">\u00a0\u662f\u6700\u7ec8\u8f93\u51fa\u7684\u6d4b\u8bd5\u96c6\u51c6\u786e\u7387&#xff0c;\u56db\u820d\u4e94\u5165\u540e\u7ea6\u4e3a 97.87%&#xff0c;\u53cd\u6620\u4e86\u6a21\u578b\u5728\u672a\u89c1\u8fc7\u7684\u6570\u636e\u4e0a\u7684\u5206\u7c7b\u6027\u80fd\u3002<\/span><\/span><\/li>\n<\/ul>\n<p style=\"margin-left:0;margin-right:0;text-align:left\">\n<p style=\"margin-left:0;margin-right:0;text-align:left\"><span style=\"background-color:#ffffff\"><span style=\"color:#000000\">\u901a\u8fc7\u4ee5\u4e0a\u6b65\u9aa4&#xff0c;\u6211\u4eec\u53ef\u4ee5\u6784\u5efa\u4e00\u4e2a\u7b80\u5355\u7684\u5168\u8fde\u63a5\u795e\u7ecf\u7f51\u7edc\u3002\u5728\u6784\u5efa\u8fc7\u7a0b\u4e2d&#xff0c;\u9700\u8981\u6ce8\u610f\u6570\u636e\u9884\u5904\u7406\u3001\u6a21\u578b\u7ed3\u6784\u7684\u8bbe\u8ba1\u3001\u635f\u5931\u51fd\u6570\u548c\u4f18\u5316\u5668\u7684\u9009\u62e9&#xff0c;\u4ee5\u53ca\u8bad\u7ec3\u8f6e\u6570\u7684\u63a7\u5236&#xff0c;\u4ee5\u907f\u514d\u8fc7\u62df\u5408\u548c\u6b20\u62df\u5408\u95ee\u9898\u3002<\/span><\/span><\/p>\n<\/p>\n<p>\u2014\u2014The END\u2014\u2014<\/p>\n<hr \/>\n<h3>&#x1f517; \u6b22\u8fce\u8ba2\u9605\u4e13\u680f<\/h3>\n<table>\n<tr>\u5e8f\u53f7\u4e13\u680f\u540d\u79f0\u8bf4\u660e<\/tr>\n<tbody>\n<tr>\n<td>1<\/td>\n<td>\u7528Python\u8fdb\u884cAI\u6570\u636e\u5206\u6790\u8fdb\u9636\u6559\u7a0b<\/td>\n<td>\u300a\u7528Python\u8fdb\u884cAI\u6570\u636e\u5206\u6790\u8fdb\u9636\u6559\u7a0b\u300b\u4e13\u680f<\/td>\n<\/tr>\n<tr>\n<td>2<\/td>\n<td>AI\u5927\u6a21\u578b\u5e94\u7528\u5b9e\u8df5\u8fdb\u9636\u6559\u7a0b<\/td>\n<td>\u300aAI\u5927\u6a21\u578b\u5e94\u7528\u5b9e\u8df5\u8fdb\u9636\u6559\u7a0b\u300b\u4e13\u680f<\/td>\n<\/tr>\n<tr>\n<td>3<\/td>\n<td>Python\u7f16\u7a0b\u77e5\u8bc6\u96c6\u9526<\/td>\n<td>\u300aPython\u7f16\u7a0b\u77e5\u8bc6\u96c6\u9526\u300b\u4e13\u680f<\/td>\n<\/tr>\n<tr>\n<td>4<\/td>\n<td>\u5b57\u8282\u8df3\u52a8\u65d7\u4e0bAI\u5236\u4f5c\u6296\u97f3\u89c6\u9891<\/td>\n<td>\u300a\u5b57\u8282\u8df3\u52a8\u65d7\u4e0bAI\u5236\u4f5c\u6296\u97f3\u89c6\u9891\u300b\u4e13\u680f<\/td>\n<\/tr>\n<tr>\n<td>5<\/td>\n<td>\u667a\u80fd\u8f85\u52a9\u9a7e\u9a76<\/td>\n<td>\u300a\u667a\u80fd\u8f85\u52a9\u9a7e\u9a76\u300b\u4e13\u680f<\/td>\n<\/tr>\n<tr>\n<td>6<\/td>\n<td>\u5de5\u5177\u8f6f\u4ef6\u53caIT\u6280\u672f\u96c6\u9526<\/td>\n<td>\u300a\u5de5\u5177\u8f6f\u4ef6\u53caIT\u6280\u672f\u96c6\u9526\u300b\u4e13\u680f<\/td>\n<\/tr>\n<\/tbody>\n<\/table>\n<p>&#x1f449; \u5173\u6ce8\u6211\u00a0&#064;\u7406\u5de5\u7537\u5927\u8f89\u90ce\u00a0\u83b7\u53d6\u5b9e\u65f6\u66f4\u65b0<\/p>\n<p>\u6b22\u8fce\u5173\u6ce8\u3001\u6536\u85cf\u6216\u8f6c\u53d1\u3002 \u656c\u8bf7\u5173\u6ce8 \u6211\u7684 \u5fae\u4fe1\u641c\u7d22\u516c\u4f17\u53f7&#xff1a;cnFuJH CSDN\u535a\u5ba2&#xff1a;\u7406\u5de5\u7537\u5927\u8f89\u90ce \u6296\u97f3\u53f7&#xff1a;31580422589<\/p>\n","protected":false},"excerpt":{"rendered":"<p>\u6587\u7ae0\u6d4f\u89c8\u9605\u8bfb335\u6b21\uff0c\u70b9\u8d5e4\u6b21\uff0c\u6536\u85cf4\u6b21\u3002\u6458\u8981\uff1a\u672c\u6587\u4ecb\u7ecd\u4e86\u5168\u8fde\u63a5\u795e\u7ecf\u7f51\u7edc\uff08\u4e5f\u79f0\u591a\u5c42\u611f\u77e5\u673a\uff0cMLP\uff09\u7684\u57fa\u672c\u6982\u5ff5\u53ca\u5176\u6784\u5efa\u8fc7\u7a0b\u3002\u4ee5TensorFlow\u6846\u67b6\u4e3a\u4f8b\uff0c\u901a\u8fc7\u5bfc\u5165\u5fc5\u8981\u7684\u5e93\u3001\u51c6\u5907\u548c\u9884\u5904\u7406MNIST\u624b\u5199\u6570\u5b57\u6570\u636e\u96c6\u3001\u6784\u5efa\u6a21\u578b\u7ed3\u6784\uff08\u5305\u62ecFlatten\u5c42\u3001Dense\u5c42\u548cDropout\u5c42\uff09\u3001\u7f16\u8bd1\u6a21\u578b\uff08\u9009\u62e9\u4f18\u5316\u5668\u3001\u635f\u5931\u51fd\u6570\u548c\u8bc4\u4f30\u6307\u6807\uff09\u3001\u8bad\u7ec3\u6a21\u578b\u4ee5\u53ca\u8bc4\u4f30\u6a21\u578b\u6027\u80fd\u7b49\u6b65\u9aa4\uff0c\u8be6\u7ec6\u5c55\u793a\u4e86\u5982\u4f55\u5b9e\u73b0\u4e00\u4e2a\u7b80\u5355\u7684\u5206\u7c7b\u4efb\u52a1\u3002\u6587\u4e2d\u5f3a\u8c03\u4e86\u6570\u636e\u5f52\u4e00\u5316\u3001\u6a21\u578b\u7ed3\u6784\u8bbe\u8ba1\u3001\u9632\u6b62\u8fc7\u62df\u5408\u7b49\u5173\u952e\u70b9\uff0c\u5e76\u63d0\u4f9b\u4e86\u5b8c\u6574\u4ee3\u7801\u793a\u4f8b\u53ca\u8fd0\u884c\u7ed3\u679c\u8bf4\u660e\uff0c\u5e2e\u52a9\u8bfb\u8005\u7406\u89e3\u548c\u638c\u63e1\u6784\u5efa\u5168\u8fde\u63a5\u795e\u7ecf\u7f51\u7edc\u7684\u6838\u5fc3\u65b9\u6cd5\u3002<\/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":[587,81,50,2863,801,207,4605],"topic":[],"class_list":["post-47859","post","type-post","status-publish","format-standard","hentry","category-server","tag-587","tag-python","tag-50","tag-2863","tag-801","tag-207","tag-pythonai"],"yoast_head":"<!-- This site is optimized with the Yoast SEO plugin v20.3 - https:\/\/yoast.com\/wordpress\/plugins\/seo\/ -->\n<title>65\u3001\u5168\u8fde\u63a5\u795e\u7ecf\u7f51\u7edc\uff08\u591a\u5c42\u611f\u77e5\u673a\uff09\u7684\u6784\u5efa\u3010\u7528Python\u8fdb\u884cAI\u6570\u636e\u5206\u6790\u8fdb\u9636\u6559\u7a0b\u3011 - \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\/47859.html\" \/>\n<meta property=\"og:locale\" content=\"zh_CN\" \/>\n<meta property=\"og:type\" content=\"article\" \/>\n<meta property=\"og:title\" content=\"65\u3001\u5168\u8fde\u63a5\u795e\u7ecf\u7f51\u7edc\uff08\u591a\u5c42\u611f\u77e5\u673a\uff09\u7684\u6784\u5efa\u3010\u7528Python\u8fdb\u884cAI\u6570\u636e\u5206\u6790\u8fdb\u9636\u6559\u7a0b\u3011 - \u7f51\u7855\u4e92\u8054\u5e2e\u52a9\u4e2d\u5fc3\" \/>\n<meta property=\"og:description\" content=\"\u6587\u7ae0\u6d4f\u89c8\u9605\u8bfb335\u6b21\uff0c\u70b9\u8d5e4\u6b21\uff0c\u6536\u85cf4\u6b21\u3002\u6458\u8981\uff1a\u672c\u6587\u4ecb\u7ecd\u4e86\u5168\u8fde\u63a5\u795e\u7ecf\u7f51\u7edc\uff08\u4e5f\u79f0\u591a\u5c42\u611f\u77e5\u673a\uff0cMLP\uff09\u7684\u57fa\u672c\u6982\u5ff5\u53ca\u5176\u6784\u5efa\u8fc7\u7a0b\u3002\u4ee5TensorFlow\u6846\u67b6\u4e3a\u4f8b\uff0c\u901a\u8fc7\u5bfc\u5165\u5fc5\u8981\u7684\u5e93\u3001\u51c6\u5907\u548c\u9884\u5904\u7406MNIST\u624b\u5199\u6570\u5b57\u6570\u636e\u96c6\u3001\u6784\u5efa\u6a21\u578b\u7ed3\u6784\uff08\u5305\u62ecFlatten\u5c42\u3001Dense\u5c42\u548cDropout\u5c42\uff09\u3001\u7f16\u8bd1\u6a21\u578b\uff08\u9009\u62e9\u4f18\u5316\u5668\u3001\u635f\u5931\u51fd\u6570\u548c\u8bc4\u4f30\u6307\u6807\uff09\u3001\u8bad\u7ec3\u6a21\u578b\u4ee5\u53ca\u8bc4\u4f30\u6a21\u578b\u6027\u80fd\u7b49\u6b65\u9aa4\uff0c\u8be6\u7ec6\u5c55\u793a\u4e86\u5982\u4f55\u5b9e\u73b0\u4e00\u4e2a\u7b80\u5355\u7684\u5206\u7c7b\u4efb\u52a1\u3002\u6587\u4e2d\u5f3a\u8c03\u4e86\u6570\u636e\u5f52\u4e00\u5316\u3001\u6a21\u578b\u7ed3\u6784\u8bbe\u8ba1\u3001\u9632\u6b62\u8fc7\u62df\u5408\u7b49\u5173\u952e\u70b9\uff0c\u5e76\u63d0\u4f9b\u4e86\u5b8c\u6574\u4ee3\u7801\u793a\u4f8b\u53ca\u8fd0\u884c\u7ed3\u679c\u8bf4\u660e\uff0c\u5e2e\u52a9\u8bfb\u8005\u7406\u89e3\u548c\u638c\u63e1\u6784\u5efa\u5168\u8fde\u63a5\u795e\u7ecf\u7f51\u7edc\u7684\u6838\u5fc3\u65b9\u6cd5\u3002\" \/>\n<meta property=\"og:url\" content=\"https:\/\/www.wsisp.com\/helps\/47859.html\" \/>\n<meta property=\"og:site_name\" content=\"\u7f51\u7855\u4e92\u8054\u5e2e\u52a9\u4e2d\u5fc3\" \/>\n<meta property=\"article:published_time\" content=\"2025-07-30T01:32:51+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=\"4 \u5206\" \/>\n<script type=\"application\/ld+json\" class=\"yoast-schema-graph\">{\"@context\":\"https:\/\/schema.org\",\"@graph\":[{\"@type\":\"WebPage\",\"@id\":\"https:\/\/www.wsisp.com\/helps\/47859.html\",\"url\":\"https:\/\/www.wsisp.com\/helps\/47859.html\",\"name\":\"65\u3001\u5168\u8fde\u63a5\u795e\u7ecf\u7f51\u7edc\uff08\u591a\u5c42\u611f\u77e5\u673a\uff09\u7684\u6784\u5efa\u3010\u7528Python\u8fdb\u884cAI\u6570\u636e\u5206\u6790\u8fdb\u9636\u6559\u7a0b\u3011 - \u7f51\u7855\u4e92\u8054\u5e2e\u52a9\u4e2d\u5fc3\",\"isPartOf\":{\"@id\":\"https:\/\/www.wsisp.com\/helps\/#website\"},\"datePublished\":\"2025-07-30T01:32:51+00:00\",\"dateModified\":\"2025-07-30T01:32:51+00:00\",\"author\":{\"@id\":\"https:\/\/www.wsisp.com\/helps\/#\/schema\/person\/358e386c577a3ab51c4493330a20ad41\"},\"breadcrumb\":{\"@id\":\"https:\/\/www.wsisp.com\/helps\/47859.html#breadcrumb\"},\"inLanguage\":\"zh-Hans\",\"potentialAction\":[{\"@type\":\"ReadAction\",\"target\":[\"https:\/\/www.wsisp.com\/helps\/47859.html\"]}]},{\"@type\":\"BreadcrumbList\",\"@id\":\"https:\/\/www.wsisp.com\/helps\/47859.html#breadcrumb\",\"itemListElement\":[{\"@type\":\"ListItem\",\"position\":1,\"name\":\"\u9996\u9875\",\"item\":\"https:\/\/www.wsisp.com\/helps\"},{\"@type\":\"ListItem\",\"position\":2,\"name\":\"65\u3001\u5168\u8fde\u63a5\u795e\u7ecf\u7f51\u7edc\uff08\u591a\u5c42\u611f\u77e5\u673a\uff09\u7684\u6784\u5efa\u3010\u7528Python\u8fdb\u884cAI\u6570\u636e\u5206\u6790\u8fdb\u9636\u6559\u7a0b\u3011\"}]},{\"@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":"65\u3001\u5168\u8fde\u63a5\u795e\u7ecf\u7f51\u7edc\uff08\u591a\u5c42\u611f\u77e5\u673a\uff09\u7684\u6784\u5efa\u3010\u7528Python\u8fdb\u884cAI\u6570\u636e\u5206\u6790\u8fdb\u9636\u6559\u7a0b\u3011 - \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\/47859.html","og_locale":"zh_CN","og_type":"article","og_title":"65\u3001\u5168\u8fde\u63a5\u795e\u7ecf\u7f51\u7edc\uff08\u591a\u5c42\u611f\u77e5\u673a\uff09\u7684\u6784\u5efa\u3010\u7528Python\u8fdb\u884cAI\u6570\u636e\u5206\u6790\u8fdb\u9636\u6559\u7a0b\u3011 - \u7f51\u7855\u4e92\u8054\u5e2e\u52a9\u4e2d\u5fc3","og_description":"\u6587\u7ae0\u6d4f\u89c8\u9605\u8bfb335\u6b21\uff0c\u70b9\u8d5e4\u6b21\uff0c\u6536\u85cf4\u6b21\u3002\u6458\u8981\uff1a\u672c\u6587\u4ecb\u7ecd\u4e86\u5168\u8fde\u63a5\u795e\u7ecf\u7f51\u7edc\uff08\u4e5f\u79f0\u591a\u5c42\u611f\u77e5\u673a\uff0cMLP\uff09\u7684\u57fa\u672c\u6982\u5ff5\u53ca\u5176\u6784\u5efa\u8fc7\u7a0b\u3002\u4ee5TensorFlow\u6846\u67b6\u4e3a\u4f8b\uff0c\u901a\u8fc7\u5bfc\u5165\u5fc5\u8981\u7684\u5e93\u3001\u51c6\u5907\u548c\u9884\u5904\u7406MNIST\u624b\u5199\u6570\u5b57\u6570\u636e\u96c6\u3001\u6784\u5efa\u6a21\u578b\u7ed3\u6784\uff08\u5305\u62ecFlatten\u5c42\u3001Dense\u5c42\u548cDropout\u5c42\uff09\u3001\u7f16\u8bd1\u6a21\u578b\uff08\u9009\u62e9\u4f18\u5316\u5668\u3001\u635f\u5931\u51fd\u6570\u548c\u8bc4\u4f30\u6307\u6807\uff09\u3001\u8bad\u7ec3\u6a21\u578b\u4ee5\u53ca\u8bc4\u4f30\u6a21\u578b\u6027\u80fd\u7b49\u6b65\u9aa4\uff0c\u8be6\u7ec6\u5c55\u793a\u4e86\u5982\u4f55\u5b9e\u73b0\u4e00\u4e2a\u7b80\u5355\u7684\u5206\u7c7b\u4efb\u52a1\u3002\u6587\u4e2d\u5f3a\u8c03\u4e86\u6570\u636e\u5f52\u4e00\u5316\u3001\u6a21\u578b\u7ed3\u6784\u8bbe\u8ba1\u3001\u9632\u6b62\u8fc7\u62df\u5408\u7b49\u5173\u952e\u70b9\uff0c\u5e76\u63d0\u4f9b\u4e86\u5b8c\u6574\u4ee3\u7801\u793a\u4f8b\u53ca\u8fd0\u884c\u7ed3\u679c\u8bf4\u660e\uff0c\u5e2e\u52a9\u8bfb\u8005\u7406\u89e3\u548c\u638c\u63e1\u6784\u5efa\u5168\u8fde\u63a5\u795e\u7ecf\u7f51\u7edc\u7684\u6838\u5fc3\u65b9\u6cd5\u3002","og_url":"https:\/\/www.wsisp.com\/helps\/47859.html","og_site_name":"\u7f51\u7855\u4e92\u8054\u5e2e\u52a9\u4e2d\u5fc3","article_published_time":"2025-07-30T01:32:51+00:00","author":"admin","twitter_card":"summary_large_image","twitter_misc":{"\u4f5c\u8005":"admin","\u9884\u8ba1\u9605\u8bfb\u65f6\u95f4":"4 \u5206"},"schema":{"@context":"https:\/\/schema.org","@graph":[{"@type":"WebPage","@id":"https:\/\/www.wsisp.com\/helps\/47859.html","url":"https:\/\/www.wsisp.com\/helps\/47859.html","name":"65\u3001\u5168\u8fde\u63a5\u795e\u7ecf\u7f51\u7edc\uff08\u591a\u5c42\u611f\u77e5\u673a\uff09\u7684\u6784\u5efa\u3010\u7528Python\u8fdb\u884cAI\u6570\u636e\u5206\u6790\u8fdb\u9636\u6559\u7a0b\u3011 - \u7f51\u7855\u4e92\u8054\u5e2e\u52a9\u4e2d\u5fc3","isPartOf":{"@id":"https:\/\/www.wsisp.com\/helps\/#website"},"datePublished":"2025-07-30T01:32:51+00:00","dateModified":"2025-07-30T01:32:51+00:00","author":{"@id":"https:\/\/www.wsisp.com\/helps\/#\/schema\/person\/358e386c577a3ab51c4493330a20ad41"},"breadcrumb":{"@id":"https:\/\/www.wsisp.com\/helps\/47859.html#breadcrumb"},"inLanguage":"zh-Hans","potentialAction":[{"@type":"ReadAction","target":["https:\/\/www.wsisp.com\/helps\/47859.html"]}]},{"@type":"BreadcrumbList","@id":"https:\/\/www.wsisp.com\/helps\/47859.html#breadcrumb","itemListElement":[{"@type":"ListItem","position":1,"name":"\u9996\u9875","item":"https:\/\/www.wsisp.com\/helps"},{"@type":"ListItem","position":2,"name":"65\u3001\u5168\u8fde\u63a5\u795e\u7ecf\u7f51\u7edc\uff08\u591a\u5c42\u611f\u77e5\u673a\uff09\u7684\u6784\u5efa\u3010\u7528Python\u8fdb\u884cAI\u6570\u636e\u5206\u6790\u8fdb\u9636\u6559\u7a0b\u3011"}]},{"@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\/47859","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=47859"}],"version-history":[{"count":0,"href":"https:\/\/www.wsisp.com\/helps\/wp-json\/wp\/v2\/posts\/47859\/revisions"}],"wp:attachment":[{"href":"https:\/\/www.wsisp.com\/helps\/wp-json\/wp\/v2\/media?parent=47859"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.wsisp.com\/helps\/wp-json\/wp\/v2\/categories?post=47859"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.wsisp.com\/helps\/wp-json\/wp\/v2\/tags?post=47859"},{"taxonomy":"topic","embeddable":true,"href":"https:\/\/www.wsisp.com\/helps\/wp-json\/wp\/v2\/topic?post=47859"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}