{"id":91574,"date":"2026-08-08T00:32:47","date_gmt":"2026-08-07T16:32:47","guid":{"rendered":"https:\/\/www.wsisp.com\/helps\/91574.html"},"modified":"2026-08-08T00:32:47","modified_gmt":"2026-08-07T16:32:47","slug":"01-%e6%9c%ba%e5%99%a8%e5%ad%a6%e4%b9%a0%e5%88%b0%e5%ba%95%e6%98%af%e4%bb%80%e4%b9%88%ef%bc%9f%e4%bb%8e%e5%9f%ba%e6%9c%ac%e6%a6%82%e5%bf%b5%e5%88%b0%e7%ac%ac%e4%b8%80%e4%b8%aa%e9%a2%84%e6%b5%8b","status":"publish","type":"post","link":"https:\/\/www.wsisp.com\/helps\/91574.html","title":{"rendered":"01 \u673a\u5668\u5b66\u4e60\u5230\u5e95\u662f\u4ec0\u4e48\uff1f\u4ece\u57fa\u672c\u6982\u5ff5\u5230\u7b2c\u4e00\u4e2a\u9884\u6d4b\u6a21\u578b"},"content":{"rendered":"<h3>\u524d\u8a00<\/h3>\n<p>\u5929\u6c14\u8f6f\u4ef6\u4f30\u8ba1\u660e\u5929\u7684\u6c14\u6e29&#xff0c;\u90ae\u7bb1\u8bc6\u522b\u5783\u573e\u90ae\u4ef6&#xff0c;\u8d2d\u7269\u7f51\u7ad9\u63a8\u8350\u53ef\u80fd\u611f\u5174\u8da3\u7684\u5546\u54c1&#xff0c;\u8fd9\u4e9b\u529f\u80fd\u80cc\u540e\u90fd\u53ef\u80fd\u7528\u5230\u673a\u5668\u5b66\u4e60\u3002\u4e0d\u8fc7&#xff0c;\u673a\u5668\u5b66\u4e60\u5e76\u4e0d\u662f\u8ba9\u8ba1\u7b97\u673a\u50cf\u4eba\u4e00\u6837\u201c\u51ed\u7a7a\u601d\u8003\u201d&#xff0c;\u5b83\u66f4\u50cf\u4e00\u79cd\u4ece\u5df2\u6709\u6570\u636e\u4e2d\u603b\u7ed3\u89c4\u5f8b\u3001\u518d\u5229\u7528\u89c4\u5f8b\u5904\u7406\u65b0\u6570\u636e\u7684\u65b9\u6cd5\u3002<\/p>\n<p>\u8fd9\u7bc7\u6587\u7ae0\u5148\u5efa\u7acb\u51e0\u4e2a\u6700\u5e38\u7528\u7684\u6982\u5ff5&#xff0c;\u518d\u7528 Python \u548c scikit-learn \u5b8c\u6210\u4e00\u4e2a\u5c0f\u578b\u56de\u5f52\u4efb\u52a1&#xff1a;\u6839\u636e\u5b66\u4e60\u65f6\u957f\u9884\u6d4b\u8003\u8bd5\u5206\u6570\u3002\u793a\u4f8b\u6570\u636e\u7531\u4ee3\u7801\u751f\u6210&#xff0c;\u4e0d\u4ee3\u8868\u771f\u5b9e\u6559\u5b66\u7814\u7a76&#xff1b;\u5b83\u7684\u7528\u9014\u662f\u8ba9\u6211\u4eec\u770b\u6e05\u4e00\u6b21\u673a\u5668\u5b66\u4e60\u5b9e\u9a8c\u7684\u5b8c\u6574\u8def\u5f84\u3002<\/p>\n<h3>\u4ec0\u4e48\u662f\u673a\u5668\u5b66\u4e60<\/h3>\n<p>\u673a\u5668\u5b66\u4e60&#xff08;Machine Learning&#xff09;\u662f\u8ba9\u8ba1\u7b97\u673a\u4ece\u6570\u636e\u4e2d\u5b66\u4e60\u89c4\u5f8b&#xff0c;\u5e76\u5229\u7528\u8fd9\u4e9b\u89c4\u5f8b\u505a\u51fa\u9884\u6d4b\u6216\u51b3\u7b56\u7684\u4e00\u7c7b\u65b9\u6cd5\u3002\u8fd9\u91cc\u7684\u201c\u5b66\u4e60\u201d\u4e0d\u662f\u8bb0\u4f4f\u6807\u51c6\u7b54\u6848&#xff0c;\u800c\u662f\u8c03\u6574\u6a21\u578b\u5185\u90e8\u7684\u53c2\u6570&#xff0c;\u4f7f\u6a21\u578b\u7ed9\u51fa\u7684\u7ed3\u679c\u5c3d\u91cf\u63a5\u8fd1\u5df2\u77e5\u7ed3\u679c\u3002<\/p>\n<p>\u4f8b\u5982&#xff0c;\u6211\u4eec\u6536\u96c6\u4e00\u4e9b\u5b66\u751f\u7684\u5b66\u4e60\u65f6\u957f\u548c\u8003\u8bd5\u5206\u6570\u3002\u591a\u6570\u60c5\u51b5\u4e0b&#xff0c;\u5b66\u4e60\u65f6\u95f4\u589e\u52a0&#xff0c;\u5206\u6570\u4e5f\u4f1a\u53d1\u751f\u76f8\u5e94\u53d8\u5316\u3002\u673a\u5668\u5b66\u4e60\u6a21\u578b\u4f1a\u5c1d\u8bd5\u4ece\u8fd9\u4e9b\u6210\u5bf9\u6570\u636e\u4e2d\u627e\u51fa\u5173\u7cfb\u3002\u4e4b\u540e\u7ed9\u5b83\u4e00\u4e2a\u6ca1\u6709\u89c1\u8fc7\u7684\u5b66\u4e60\u65f6\u957f&#xff0c;\u5b83\u5c31\u80fd\u7ed9\u51fa\u9884\u6d4b\u5206\u6570\u3002<\/p>\n<p>\u673a\u5668\u5b66\u4e60\u9002\u5408\u89c4\u5f8b\u5b58\u5728\u3001\u4f46\u5f88\u96be\u624b\u5199\u6210\u5927\u91cf\u7cbe\u786e\u89c4\u5219\u7684\u95ee\u9898\u3002\u5b83\u4e5f\u6709\u8fb9\u754c&#xff1a;\u8bad\u7ec3\u6570\u636e\u6709\u504f\u5dee&#xff0c;\u6a21\u578b\u901a\u5e38\u4f1a\u7ee7\u627f\u8fd9\u79cd\u504f\u5dee&#xff1b;\u6570\u636e\u592a\u5c11\u6216\u8f93\u5165\u4e0e\u76ee\u6807\u6ca1\u6709\u7a33\u5b9a\u5173\u7cfb&#xff0c;\u9884\u6d4b\u4e5f\u4e0d\u4f1a\u53ef\u9760\u3002<\/p>\n<h3>\u4f20\u7edf\u7f16\u7a0b\u4e0e\u673a\u5668\u5b66\u4e60\u7684\u533a\u522b<\/h3>\n<p>\u4f20\u7edf\u7f16\u7a0b\u901a\u5e38\u662f\u201c\u6570\u636e &#043; \u4eba\u5199\u7684\u89c4\u5219 \u2192 \u7ed3\u679c\u201d\u3002\u4f8b\u5982&#xff0c;\u89c4\u5b9a\u6210\u7ee9\u5927\u4e8e\u7b49\u4e8e 60 \u5206\u5c31\u662f\u53ca\u683c&#xff0c;\u7a0b\u5e8f\u53ea\u9700\u5fe0\u5b9e\u6267\u884c\u8fd9\u6761\u89c4\u5219\u3002<\/p>\n<p>\u76d1\u7763\u5f0f\u673a\u5668\u5b66\u4e60\u66f4\u63a5\u8fd1\u201c\u6570\u636e &#043; \u5df2\u77e5\u7b54\u6848 \u2192 \u6a21\u578b\u201d\u3002\u6211\u4eec\u4e0d\u76f4\u63a5\u544a\u8bc9\u7a0b\u5e8f\u5b66\u4e60 1 \u5c0f\u65f6\u5e94\u5f97\u591a\u5c11\u5206&#xff0c;\u800c\u662f\u63d0\u4f9b\u591a\u7ec4\u5b66\u4e60\u65f6\u957f\u548c\u5bf9\u5e94\u5206\u6570&#xff0c;\u8ba9\u7b97\u6cd5\u81ea\u5df1\u4f30\u8ba1\u4e24\u8005\u7684\u5173\u7cfb\u3002\u8bad\u7ec3\u5b8c\u6210\u540e&#xff0c;\u518d\u4f7f\u7528\u201c\u65b0\u6570\u636e &#043; \u6a21\u578b \u2192 \u9884\u6d4b\u7ed3\u679c\u201d\u3002<\/p>\n<p>\u4e24\u8005\u5e76\u4e0d\u662f\u4e92\u76f8\u66ff\u4ee3\u3002\u89c4\u5219\u660e\u786e\u3001\u7a33\u5b9a\u5e76\u4e14\u5fc5\u987b\u4e25\u683c\u6267\u884c\u65f6&#xff0c;\u4f20\u7edf\u7a0b\u5e8f\u5f80\u5f80\u66f4\u5408\u9002&#xff1b;\u89c4\u5219\u96be\u4ee5\u9010\u6761\u63cf\u8ff0&#xff0c;\u5374\u6709\u8db3\u591f\u7684\u4ee3\u8868\u6027\u6570\u636e\u65f6&#xff0c;\u53ef\u4ee5\u8003\u8651\u673a\u5668\u5b66\u4e60\u3002\u5b9e\u9645\u7cfb\u7edf\u4e5f\u7ecf\u5e38\u628a\u4e24\u8005\u7ec4\u5408\u8d77\u6765\u3002<\/p>\n<h3>\u76d1\u7763\u5b66\u4e60\u3001\u65e0\u76d1\u7763\u5b66\u4e60\u548c\u5f3a\u5316\u5b66\u4e60<\/h3>\n<p>\u6309\u7167\u83b7\u5f97\u53cd\u9988\u7684\u65b9\u5f0f&#xff0c;\u673a\u5668\u5b66\u4e60\u5e38\u88ab\u5206\u4e3a\u4e09\u7c7b&#xff1a;<\/p>\n<li>\u76d1\u7763\u5b66\u4e60&#xff08;Supervised Learning&#xff09;&#xff1a;\u8bad\u7ec3\u6570\u636e\u5e26\u6709\u5df2\u77e5\u7b54\u6848\u3002\u9884\u6d4b\u623f\u4ef7\u3001\u8bc6\u522b\u5783\u573e\u90ae\u4ef6\u90fd\u5c5e\u4e8e\u8fd9\u4e00\u7c7b\u3002\u9884\u6d4b\u8fde\u7eed\u6570\u503c\u53eb\u56de\u5f52&#xff0c;\u9884\u6d4b\u7c7b\u522b\u53eb\u5206\u7c7b\u3002\u672c\u6587\u7684\u5206\u6570\u9884\u6d4b\u662f\u56de\u5f52\u4efb\u52a1\u3002<\/li>\n<li>\u65e0\u76d1\u7763\u5b66\u4e60&#xff08;Unsupervised Learning&#xff09;&#xff1a;\u6570\u636e\u6ca1\u6709\u9884\u5148\u7ed9\u51fa\u7684\u7b54\u6848&#xff0c;\u7b97\u6cd5\u5c1d\u8bd5\u53d1\u73b0\u5185\u90e8\u7ed3\u6784\u3002\u4f8b\u5982&#xff0c;\u6839\u636e\u6d88\u8d39\u884c\u4e3a\u628a\u987e\u5ba2\u5206\u6210\u82e5\u5e72\u7ec4\u3002\u805a\u7c7b\u662f\u5e38\u89c1\u7684\u65e0\u76d1\u7763\u5b66\u4e60\u4efb\u52a1\u3002<\/li>\n<li>\u5f3a\u5316\u5b66\u4e60&#xff08;Reinforcement Learning&#xff09;&#xff1a;\u667a\u80fd\u4f53\u5728\u73af\u5883\u4e2d\u91c7\u53d6\u52a8\u4f5c&#xff0c;\u5e76\u4ece\u5956\u52b1\u6216\u60e9\u7f5a\u4e2d\u9010\u6b65\u6539\u8fdb\u7b56\u7565\u3002\u4f8b\u5982&#xff0c;\u8ba9\u7a0b\u5e8f\u5728\u6a21\u62df\u73af\u5883\u4e2d\u5b66\u4e60\u5982\u4f55\u5b8c\u6210\u6e38\u620f\u4efb\u52a1\u3002<\/li>\n<p>\u4e09\u8005\u89e3\u51b3\u7684\u95ee\u9898\u4e0d\u540c\u3002\u521d\u5b66\u65f6\u4e0d\u5fc5\u6025\u7740\u8bb0\u4f4f\u5927\u91cf\u7b97\u6cd5&#xff0c;\u5148\u5224\u65ad\u201c\u6709\u6ca1\u6709\u7b54\u6848\u201d\u201c\u5e0c\u671b\u9884\u6d4b\u4ec0\u4e48\u201d\u66f4\u91cd\u8981\u3002<\/p>\n<h3>\u7279\u5f81\u3001\u6807\u7b7e\u3001\u6837\u672c\u548c\u6a21\u578b<\/h3>\n<p>\u8fd9\u56db\u4e2a\u8bcd\u4f1a\u8d2f\u7a7f\u540e\u7eed\u6587\u7ae0&#xff1a;<\/p>\n<ul>\n<li>\u6837\u672c&#xff08;Sample&#xff09;&#xff1a;\u4e00\u6761\u89c2\u5bdf\u8bb0\u5f55\u3002\u672c\u4f8b\u4e2d&#xff0c;\u4e00\u540d\u5b66\u751f\u7684\u4e00\u7ec4\u201c\u5b66\u4e60\u65f6\u957f\u4e0e\u5206\u6570\u201d\u5c31\u662f\u4e00\u4e2a\u6837\u672c\u3002<\/li>\n<li>\u7279\u5f81&#xff08;Feature&#xff09;&#xff1a;\u6a21\u578b\u7528\u6765\u8fdb\u884c\u9884\u6d4b\u7684\u8f93\u5165\u4fe1\u606f\u3002\u672c\u4f8b\u53ea\u6709\u201c\u5b66\u4e60\u65f6\u957f\u201d\u4e00\u4e2a\u7279\u5f81&#xff1b;\u771f\u5b9e\u4efb\u52a1\u8fd8\u53ef\u80fd\u52a0\u5165\u51fa\u52e4\u7387\u7b49\u7279\u5f81\u3002<\/li>\n<li>\u6807\u7b7e&#xff08;Label&#xff09;&#xff1a;\u76d1\u7763\u5b66\u4e60\u4e2d\u5e0c\u671b\u6a21\u578b\u9884\u6d4b\u7684\u5df2\u77e5\u7ed3\u679c\u3002\u672c\u4f8b\u7684\u6807\u7b7e\u662f\u8003\u8bd5\u5206\u6570\u3002<\/li>\n<li>\u6a21\u578b&#xff08;Model&#xff09;&#xff1a;\u4ece\u8bad\u7ec3\u6570\u636e\u4e2d\u5b66\u5230\u7684\u6570\u5b66\u5173\u7cfb\u3002\u672c\u6587\u4f7f\u7528\u7ebf\u6027\u56de\u5f52&#xff08;Linear Regression&#xff09;&#xff0c;\u5b83\u5c1d\u8bd5\u7528\u4e00\u6761\u76f4\u7ebf\u63cf\u8ff0\u5b66\u4e60\u65f6\u957f\u4e0e\u5206\u6570\u7684\u5173\u7cfb\u3002<\/li>\n<\/ul>\n<p>\u5728 scikit-learn \u4e2d&#xff0c;\u7279\u5f81\u901a\u5e38\u8bb0\u4e3a X&#xff0c;\u6807\u7b7e\u901a\u5e38\u8bb0\u4e3a y\u3002\u5373\u4f7f\u53ea\u6709\u4e00\u4e2a\u7279\u5f81&#xff0c;X \u4e5f\u901a\u5e38\u5199\u6210\u201c\u6837\u672c\u6570 \u00d7 \u7279\u5f81\u6570\u201d\u7684\u4e8c\u7ef4\u6570\u7ec4\u3002<\/p>\n<h3>\u8bad\u7ec3\u96c6\u4e0e\u6d4b\u8bd5\u96c6<\/h3>\n<p>\u5982\u679c\u628a\u6240\u6709\u6570\u636e\u90fd\u4ea4\u7ed9\u6a21\u578b\u8bad\u7ec3&#xff0c;\u518d\u7528\u540c\u4e00\u6279\u6570\u636e\u8003\u8bd5&#xff0c;\u5f97\u5230\u7684\u5206\u6570\u5bb9\u6613\u8fc7\u4e8e\u4e50\u89c2\u3002\u56e0\u6b64&#xff0c;\u6211\u4eec\u901a\u5e38\u5148\u62c6\u5206\u6570\u636e&#xff1a;<\/p>\n<ul>\n<li>\u8bad\u7ec3\u96c6&#xff08;Training Set&#xff09;\u7528\u4e8e\u8ba9\u6a21\u578b\u5b66\u4e60\u53c2\u6570&#xff1b;<\/li>\n<li>\u6d4b\u8bd5\u96c6&#xff08;Test Set&#xff09;\u53ea\u5728\u8bad\u7ec3\u5b8c\u6210\u540e\u7528\u4e8e\u68c0\u67e5\u6a21\u578b\u5bf9\u672a\u89c1\u6837\u672c\u7684\u8868\u73b0\u3002<\/li>\n<li>\u9a8c\u8bc1\u96c6&#xff08;Val Set&#xff09;\u00a0\u6a21\u578b\u786e\u5b9a\u540e\u53c2\u52a0\u6700\u7ec8\u8003\u8bd5&#xff0c;\u7528\u6765\u62a5\u544a\u771f\u5b9e\u51c6\u786e\u7387\u3002<\/li>\n<\/ul>\n<p>\u672c\u6587\u628a 75% \u7684\u6837\u672c\u7528\u4e8e\u8bad\u7ec3&#xff0c;25% \u7559\u4f5c\u6d4b\u8bd5&#xff0c;\u5e76\u7ed9 train_test_split \u8bbe\u7f6e random_state&#061;42\u3002\u56fa\u5b9a\u968f\u673a\u79cd\u5b50\u610f\u5473\u7740\u6bcf\u6b21\u8fd0\u884c\u90fd\u4f1a\u5f97\u5230\u76f8\u540c\u7684\u62c6\u5206&#xff0c;\u4fbf\u4e8e\u590d\u73b0\u548c\u6838\u5bf9\u3002\u6d4b\u8bd5\u96c6\u4e0d\u53c2\u4e0e fit&#xff0c;\u5426\u5219\u5c31\u5931\u53bb\u4e86\u6a21\u62df\u201c\u65b0\u6570\u636e\u201d\u7684\u610f\u4e49\u3002<\/p>\n<h3>\u7b2c\u4e00\u4e2a\u673a\u5668\u5b66\u4e60\u6848\u4f8b<\/h3>\n<p>\u6211\u4eec\u7528\u4ee3\u7801\u6784\u9020 20 \u6761\u6a21\u62df\u6570\u636e&#xff1a;\u5b66\u4e60\u65f6\u957f\u4ece 1.0 \u5c0f\u65f6\u589e\u52a0\u5230 10.5 \u5c0f\u65f6&#xff0c;\u5206\u6570\u603b\u4f53\u968f\u65f6\u957f\u4e0a\u5347&#xff0c;\u540c\u65f6\u52a0\u5165\u5c11\u91cf\u968f\u673a\u6ce2\u52a8\u3002\u968f\u673a\u6570\u751f\u6210\u5668\u4e5f\u56fa\u5b9a\u4e3a 42&#xff0c;\u6240\u4ee5\u6570\u636e\u672c\u8eab\u6bcf\u6b21\u90fd\u4e00\u81f4\u3002<\/p>\n<p>\u4efb\u52a1\u6d41\u7a0b\u662f&#xff1a;\u751f\u6210\u6570\u636e \u2192 \u62c6\u5206\u8bad\u7ec3\u96c6\u548c\u6d4b\u8bd5\u96c6 \u2192 \u8bad\u7ec3\u7ebf\u6027\u56de\u5f52\u6a21\u578b \u2192 \u9884\u6d4b\u6d4b\u8bd5\u96c6 \u2192 \u8ba1\u7b97\u8bc4\u4f30\u6307\u6807 \u2192 \u9884\u6d4b\u4e00\u4e2a\u65b0\u7684 6.5 \u5c0f\u65f6\u6837\u672c\u3002<\/p>\n<h3>\u5b8c\u6574\u53ef\u8fd0\u884c\u4ee3\u7801<\/h3>\n<p>\u5c06\u4e0b\u9762\u4ee3\u7801\u4fdd\u5b58\u4e3a 01_demo.py&#xff0c;\u5728\u88c5\u6709 NumPy \u548c scikit-learn \u7684 Python 3 \u73af\u5883\u4e2d\u8fd0\u884c&#xff1a;<\/p>\n<p>&#034;&#034;&#034;\u6839\u636e\u5b66\u4e60\u65f6\u957f\u9884\u6d4b\u8003\u8bd5\u5206\u6570\u3002&#034;&#034;&#034;<\/p>\n<p>import sys<\/p>\n<p>def check_environment():<br \/>\n    &#034;&#034;&#034;\u68c0\u67e5 Python \u7248\u672c\u548c\u793a\u4f8b\u4f9d\u8d56&#xff0c;\u5e76\u7ed9\u51fa\u53ef\u8bfb\u7684\u9519\u8bef\u4fe1\u606f\u3002&#034;&#034;&#034;<br \/>\n    if sys.version_info &lt; (3, 8):<br \/>\n        raise RuntimeError(&#034;\u672c\u793a\u4f8b\u9700\u8981 Python 3.8 \u6216\u66f4\u9ad8\u7248\u672c\u3002&#034;)<\/p>\n<p>    try:<br \/>\n        import numpy as np<br \/>\n        import sklearn<br \/>\n    except ImportError as exc:<br \/>\n        raise RuntimeError(<br \/>\n            &#034;\u7f3a\u5c11 NumPy \u6216 scikit-learn&#xff0c;\u8bf7\u5148\u5728\u5f53\u524d\u73af\u5883\u5b89\u88c5 requirements.txt \u4e2d\u7684\u4f9d\u8d56\u3002&#034;<br \/>\n        ) from exc<\/p>\n<p>    return np, sklearn<\/p>\n<p>def main():<br \/>\n    np, sklearn &#061; check_environment()<\/p>\n<p>    from sklearn.linear_model import LinearRegression<br \/>\n    from sklearn.metrics import mean_absolute_error, r2_score<br \/>\n    from sklearn.model_selection import train_test_split<\/p>\n<p>    # \u6784\u9020\u4e00\u7ec4\u6559\u5b66\u7528\u7684\u6a21\u62df\u6570\u636e\u3002\u56fa\u5b9a\u79cd\u5b50\u4f7f\u6bcf\u6b21\u751f\u6210\u7684\u6570\u636e\u5b8c\u5168\u4e00\u81f4\u3002<br \/>\n    random_seed &#061; 42<br \/>\n    rng &#061; np.random.default_rng(random_seed)<br \/>\n    study_hours &#061; np.arange(1.0, 11.0, 0.5).reshape(-1, 1)<br \/>\n    scores &#061; 30.0 &#043; 6.2 * study_hours.ravel() &#043; rng.normal(<br \/>\n        loc&#061;0.0, scale&#061;2.0, size&#061;study_hours.shape[0]<br \/>\n    )<\/p>\n<p>    if study_hours.shape[0] !&#061; scores.shape[0] or not np.isfinite(scores).all():<br \/>\n        raise ValueError(&#034;\u793a\u4f8b\u6570\u636e\u65e0\u6548&#xff1a;\u7279\u5f81\u548c\u6807\u7b7e\u6570\u91cf\u4e0d\u4e00\u81f4&#xff0c;\u6216\u6807\u7b7e\u5305\u542b\u975e\u6709\u9650\u503c\u3002&#034;)<\/p>\n<p>    # \u7559\u51fa 25% \u7684\u6837\u672c\u4f5c\u4e3a\u6d4b\u8bd5\u96c6&#xff0c;\u6a21\u578b\u8bad\u7ec3\u65f6\u4e0d\u4f1a\u770b\u5230\u5b83\u4eec\u3002<br \/>\n    x_train, x_test, y_train, y_test &#061; train_test_split(<br \/>\n        study_hours,<br \/>\n        scores,<br \/>\n        test_size&#061;0.25,<br \/>\n        random_state&#061;random_seed,<br \/>\n    )<\/p>\n<p>    model &#061; LinearRegression()<br \/>\n    model.fit(x_train, y_train)<br \/>\n    y_pred &#061; model.predict(x_test)<\/p>\n<p>    mae &#061; mean_absolute_error(y_test, y_pred)<br \/>\n    r2 &#061; r2_score(y_test, y_pred)<br \/>\n    new_prediction &#061; model.predict(np.array([[6.5]]))[0]<\/p>\n<p>    print(f&#034;Python: {sys.version.split()[0]}&#034;)<br \/>\n    print(f&#034;NumPy: {np.__version__}&#034;)<br \/>\n    print(f&#034;scikit-learn: {sklearn.__version__}&#034;)<br \/>\n    print(f&#034;\u8bad\u7ec3\u96c6\u6837\u672c\u6570: {len(x_train)}&#034;)<br \/>\n    print(f&#034;\u6d4b\u8bd5\u96c6\u6837\u672c\u6570: {len(x_test)}&#034;)<br \/>\n    print(&#034;\\\\n\u6d4b\u8bd5\u96c6\u9884\u6d4b\u7ed3\u679c:&#034;)<br \/>\n    for hours, actual, predicted in zip(x_test.ravel(), y_test, y_pred):<br \/>\n        print(<br \/>\n            f&#034;\u5b66\u4e60 {hours:&gt;4.1f} \u5c0f\u65f6 | \u5b9e\u9645\u5206\u6570 {actual:&gt;5.2f} | &#034;<br \/>\n            f&#034;\u9884\u6d4b\u5206\u6570 {predicted:&gt;5.2f}&#034;<br \/>\n        )<br \/>\n    print(f&#034;\\\\n\u5e73\u5747\u7edd\u5bf9\u8bef\u5dee&#xff08;MAE&#xff09;: {mae:.2f}&#034;)<br \/>\n    print(f&#034;\u51b3\u5b9a\u7cfb\u6570&#xff08;R2&#xff09;: {r2:.3f}&#034;)<br \/>\n    print(f&#034;\u5b66\u4e60 6.5 \u5c0f\u65f6\u7684\u9884\u6d4b\u5206\u6570: {new_prediction:.2f}&#034;)<\/p>\n<p>if __name__ &#061;&#061; &#034;__main__&#034;:<br \/>\n    try:<br \/>\n        main()<br \/>\n    except (RuntimeError, ValueError) as exc:<br \/>\n        print(f&#034;\u7a0b\u5e8f\u65e0\u6cd5\u7ee7\u7eed&#xff1a;{exc}&#034;, file&#061;sys.stderr)<br \/>\n        sys.exit(1)<\/p>\n<h3>\u9010\u6bb5\u4ee3\u7801\u89e3\u91ca<\/h3>\n<p>check_environment \u5148\u786e\u8ba4 Python \u7248\u672c&#xff0c;\u518d\u5c1d\u8bd5\u5bfc\u5165 NumPy \u548c scikit-learn\u3002\u5982\u679c\u4f9d\u8d56\u7f3a\u5931&#xff0c;\u7a0b\u5e8f\u4f1a\u7ed9\u51fa\u660e\u786e\u63d0\u793a\u5e76\u6b63\u5e38\u8fdb\u5165\u9519\u8bef\u5904\u7406&#xff0c;\u800c\u4e0d\u662f\u5728\u540e\u7eed\u6b65\u9aa4\u4ea7\u751f\u96be\u61c2\u7684\u5f02\u5e38\u3002<\/p>\n<p>np.arange(&#8230;).reshape(-1, 1) \u751f\u6210\u5b66\u4e60\u65f6\u957f&#xff0c;\u5e76\u628a\u4e00\u7ef4\u6570\u636e\u6539\u4e3a scikit-learn \u9700\u8981\u7684\u4e8c\u7ef4\u7279\u5f81\u77e9\u9635\u3002rng.normal \u751f\u6210\u5747\u503c\u4e3a 0 \u7684\u5c0f\u5e45\u968f\u673a\u6ce2\u52a8\u3002\u8fd9\u91cc\u660e\u786e\u5199\u51fa\u5b83\u662f\u6a21\u62df\u6570\u636e&#xff0c;\u4e0d\u80fd\u628a\u7ed3\u679c\u89e3\u91ca\u6210\u771f\u5b9e\u5b66\u751f\u7fa4\u4f53\u7684\u89c4\u5f8b\u3002<\/p>\n<p>train_test_split \u5b8c\u6210\u968f\u673a\u62c6\u5206\u3002model.fit(x_train, y_train) \u662f\u8bad\u7ec3\u6b65\u9aa4&#xff0c;\u7ebf\u6027\u56de\u5f52\u4f1a\u6839\u636e 15 \u4e2a\u8bad\u7ec3\u6837\u672c\u4f30\u8ba1\u76f4\u7ebf\u7684\u659c\u7387\u548c\u622a\u8ddd\u3002model.predict(x_test) \u5219\u628a 5 \u4e2a\u672a\u53c2\u4e0e\u8bad\u7ec3\u7684\u5b66\u4e60\u65f6\u957f\u653e\u5165\u6a21\u578b&#xff0c;\u5f97\u5230\u9884\u6d4b\u5206\u6570\u3002<\/p>\n<p>\u6700\u540e&#xff0c;\u4ee3\u7801\u8ba1\u7b97\u6d4b\u8bd5\u96c6\u4e0a\u7684 MAE \u548c R\u00b2&#xff0c;\u5e76\u9884\u6d4b\u5b66\u4e60 6.5 \u5c0f\u65f6\u7684\u5206\u6570\u3002\u4f20\u5165 [[6.5]] \u800c\u4e0d\u662f 6.5&#xff0c;\u662f\u56e0\u4e3a\u6a21\u578b\u671f\u5f85\u7684\u8f93\u5165\u5f62\u72b6\u4ecd\u7136\u662f\u201c1 \u4e2a\u6837\u672c\u30011 \u4e2a\u7279\u5f81\u201d\u3002<\/p>\n<p>\u8fd9\u4efd\u4ee3\u7801\u5df2\u5728 Conda \u7684 base \u73af\u5883\u4e2d\u5b9e\u9645\u8fd0\u884c&#xff0c;\u7248\u672c\u4e3a Python 3.11.4\u3001NumPy 1.24.3 \u548c scikit-learn 1.3.0\u3002\u7a0b\u5e8f\u6b63\u5e38\u7ed3\u675f&#xff0c;\u672c\u6b21\u56fa\u5b9a\u6570\u636e\u4e0e\u62c6\u5206\u5f97\u5230&#xff1a;\u8bad\u7ec3\u96c6 15 \u6761\u3001\u6d4b\u8bd5\u96c6 5 \u6761&#xff0c;MAE \u4e3a 1.66&#xff0c;R\u00b2 \u4e3a 0.992&#xff0c;\u5b66\u4e60 6.5 \u5c0f\u65f6\u7684\u9884\u6d4b\u5206\u6570\u4e3a 70.67\u3002\u56e0\u4e3a\u968f\u673a\u79cd\u5b50\u548c\u5e93\u7248\u672c\u90fd\u56fa\u5b9a&#xff0c;\u5728\u76f8\u540c\u73af\u5883\u4e2d\u5e94\u5f97\u5230\u76f8\u540c\u7ed3\u679c&#xff1b;\u4e0d\u540c\u5e93\u7248\u672c\u53ef\u80fd\u51fa\u73b0\u5f88\u5c0f\u7684\u6d6e\u70b9\u5dee\u5f02\u3002<\/p>\n<h3>\u5982\u4f55\u5224\u65ad\u6a21\u578b\u6548\u679c<\/h3>\n<p>\u53ea\u770b\u67d0\u4e00\u6761\u9884\u6d4b\u5e76\u4e0d\u591f&#xff0c;\u56e0\u6b64\u9700\u8981\u8bc4\u4f30\u6307\u6807&#xff08;Evaluation Metric&#xff09;&#xff0c;\u4e5f\u5c31\u662f\u628a\u4e00\u7ec4\u9884\u6d4b\u8d28\u91cf\u538b\u7f29\u6210\u6570\u503c\u7684\u65b9\u6cd5\u3002<\/p>\n<p>\u5e73\u5747\u7edd\u5bf9\u8bef\u5dee&#xff08;Mean Absolute Error&#xff0c;MAE&#xff09;\u4f1a\u8ba1\u7b97\u6bcf\u6761\u9884\u6d4b\u4e0e\u771f\u5b9e\u503c\u4e4b\u5dee\u7684\u7edd\u5bf9\u503c&#xff0c;\u518d\u53d6\u5e73\u5747\u3002\u8fd9\u91cc MAE \u4e3a 1.66&#xff0c;\u53ef\u4ee5\u76f4\u89c2\u7406\u89e3\u4e3a&#xff1a;\u5728\u8fd9 5 \u6761\u6d4b\u8bd5\u6837\u672c\u4e0a&#xff0c;\u9884\u6d4b\u5206\u6570\u5e73\u5747\u76f8\u5dee\u7ea6 1.66 \u5206\u3002MAE \u8d8a\u63a5\u8fd1 0 \u8d8a\u597d\u3002<\/p>\n<p>\u51b3\u5b9a\u7cfb\u6570&#xff08;R-squared&#xff0c;R\u00b2&#xff09;\u8861\u91cf\u6a21\u578b\u76f8\u5bf9\u4e8e\u201c\u603b\u662f\u9884\u6d4b\u5e73\u5747\u503c\u201d\u7684\u65b9\u6cd5\u89e3\u91ca\u4e86\u591a\u5c11\u53d8\u5316\u3002\u5b83\u901a\u5e38\u8d8a\u63a5\u8fd1 1 \u8d8a\u597d&#xff0c;0 \u8868\u793a\u6ca1\u6709\u4f18\u4e8e\u7b80\u5355\u7684\u5e73\u5747\u503c\u57fa\u7ebf&#xff0c;\u4e5f\u53ef\u80fd\u51fa\u73b0\u8d1f\u6570\u3002\u672c\u4f8b\u7684 0.992 \u63a5\u8fd11&#xff0c;\u662f\u56e0\u4e3a\u6a21\u62df\u6570\u636e\u672c\u6765\u5c31\u63a5\u8fd1\u76f4\u7ebf&#xff1b;\u8fd9\u4e0d\u80fd\u8bc1\u660e\u6a21\u578b\u5728\u771f\u5b9e\u8003\u8bd5\u6570\u636e\u4e0a\u4e5f\u4f1a\u540c\u6837\u51c6\u786e\u3002<\/p>\n<p>\u6d4b\u8bd5\u96c6\u53ea\u6709 5 \u6761&#xff0c;\u6240\u4ee5\u8fd9\u4e2a\u6570\u503c\u4e3b\u8981\u7528\u4e8e\u6f14\u793a\u6d41\u7a0b&#xff0c;\u4e0d\u80fd\u636e\u6b64\u4f5c\u73b0\u5b9e\u51b3\u7b56\u3002\u771f\u5b9e\u9879\u76ee\u8fd8\u8981\u4f7f\u7528\u66f4\u591a\u6709\u4ee3\u8868\u6027\u7684\u6570\u636e&#xff0c;\u5e76\u68c0\u67e5\u5f02\u5e38\u503c\u3001\u504f\u5dee\u548c\u91cd\u590d\u5b9e\u9a8c\u7ed3\u679c\u3002<\/p>\n<h3>\u521d\u5b66\u8005\u5e38\u89c1\u95ee\u9898<\/h3>\n<h4>1. \u673a\u5668\u5b66\u4e60\u662f\u4e0d\u662f\u5fc5\u987b\u4f7f\u7528\u5927\u91cf\u6570\u5b66\u516c\u5f0f&#xff1f;<\/h4>\n<p>\u5165\u95e8\u9636\u6bb5\u53ef\u4ee5\u5148\u7406\u89e3\u6570\u636e\u3001\u8bad\u7ec3\u548c\u8bc4\u4f30\u7684\u6d41\u7a0b\u3002\u968f\u7740\u4efb\u52a1\u6df1\u5165&#xff0c;\u7ebf\u6027\u4ee3\u6570\u3001\u6982\u7387\u7edf\u8ba1\u548c\u5fae\u79ef\u5206\u4f1a\u5e2e\u52a9\u4f60\u7406\u89e3\u7b97\u6cd5\u4e3a\u4ec0\u4e48\u6709\u6548&#xff0c;\u4f46\u4e0d\u5fc5\u7b49\u5230\u5b66\u5b8c\u6240\u6709\u6570\u5b66\u624d\u5f00\u59cb\u5b9e\u8df5\u3002<\/p>\n<h4>2. \u4e3a\u4ec0\u4e48\u4e0d\u80fd\u7528\u5168\u90e8\u6570\u636e\u8bad\u7ec3&#xff1f;<\/h4>\n<p>\u6a21\u578b\u9700\u8981\u5728\u6ca1\u6709\u89c1\u8fc7\u7684\u6570\u636e\u4e0a\u63a5\u53d7\u68c0\u67e5\u3002\u5982\u679c\u6ca1\u6709\u6d4b\u8bd5\u96c6&#xff0c;\u6211\u4eec\u5f88\u96be\u5206\u8fa8\u6a21\u578b\u662f\u771f\u6b63\u5b66\u5230\u4e86\u89c4\u5f8b&#xff0c;\u8fd8\u662f\u53ea\u8bb0\u4f4f\u4e86\u8bad\u7ec3\u6570\u636e\u3002<\/p>\n<h4>3. R\u00b2 \u5f88\u9ad8\u662f\u5426\u8bf4\u660e\u6a21\u578b\u4e00\u5b9a\u5f88\u597d&#xff1f;<\/h4>\n<p>\u4e0d\u4e00\u5b9a\u3002\u6307\u6807\u8fd8\u4f1a\u53d7\u5230\u6570\u636e\u89c4\u6a21\u3001\u62c6\u5206\u65b9\u5f0f\u3001\u6570\u636e\u6cc4\u6f0f\u548c\u6570\u636e\u4ee3\u8868\u6027\u7684\u5f71\u54cd\u3002\u672c\u4f8b\u662f\u523b\u610f\u8bbe\u8ba1\u7684\u7b80\u5355\u6a21\u62df\u6570\u636e&#xff0c;\u56e0\u6b64\u7ed3\u679c\u8f83\u9ad8\u3002\u73b0\u5b9e\u4efb\u52a1\u5fc5\u987b\u7ed3\u5408\u4e1a\u52a1\u76ee\u6807\u548c\u6570\u636e\u6765\u6e90\u5224\u65ad\u3002<\/p>\n<h4>4. \u4e3a\u4ec0\u4e48\u56fa\u5b9a\u968f\u673a\u79cd\u5b50&#xff1f;<\/h4>\n<p>\u968f\u673a\u62c6\u5206\u548c\u968f\u673a\u751f\u6210\u6570\u636e\u53ef\u80fd\u8ba9\u6bcf\u6b21\u7ed3\u679c\u4e0d\u540c\u3002\u56fa\u5b9a\u79cd\u5b50\u53ef\u4ee5\u8ba9\u5b9e\u9a8c\u66f4\u5bb9\u6613\u590d\u73b0\u548c\u6392\u67e5\u3002\u56fa\u5b9a\u79cd\u5b50\u4e0d\u4f1a\u81ea\u52a8\u4fdd\u8bc1\u6a21\u578b\u6b63\u786e&#xff0c;\u5b83\u53ea\u662f\u56fa\u5b9a\u4e86\u968f\u673a\u8fc7\u7a0b\u3002<\/p>\n<h4>5. \u9884\u6d4b\u7ed3\u679c\u53ef\u4ee5\u5f53\u4f5c\u771f\u5b9e\u6210\u7ee9\u5417&#xff1f;<\/h4>\n<p>\u4e0d\u80fd\u3002\u672c\u4f8b\u53ea\u4f7f\u7528\u5b66\u4e60\u65f6\u957f\u8fd9\u4e00\u9879\u6a21\u62df\u7279\u5f81&#xff0c;\u4e5f\u6ca1\u6709\u771f\u5b9e\u5b66\u751f\u6570\u636e\u3002\u5b83\u662f\u7f16\u7a0b\u6559\u5b66\u6848\u4f8b&#xff0c;\u4e0d\u9002\u5408\u8bc4\u4ef7\u4e2a\u4eba\u3001\u6307\u5bfc\u6559\u5b66\u6216\u4f5c\u51fa\u5b9e\u9645\u51b3\u5b9a\u3002<\/p>\n<h4>6. \u8fd0\u884c\u65f6\u63d0\u793a\u7f3a\u5c11 sklearn \u600e\u4e48\u529e&#xff1f;<\/h4>\n<p>\u5148\u786e\u8ba4\u7ec8\u7aef\u4f7f\u7528\u7684\u662f\u9884\u671f\u7684 Conda \u73af\u5883&#xff0c;\u518d\u5728\u8be5\u73af\u5883\u4e2d\u5b89\u88c5\u4e0e\u9879\u76ee\u5339\u914d\u7684 scikit-learn\u3002\u5305\u7684\u5b89\u88c5\u540d\u662f scikit-learn&#xff0c;\u4ee3\u7801\u4e2d\u7684\u5bfc\u5165\u540d\u662f sklearn\u3002\u4e0d\u8981\u4e3a\u4e86\u4e00\u4e2a\u793a\u4f8b\u76f2\u76ee\u5347\u7ea7\u6574\u4e2a\u73af\u5883\u3002<\/p>\n<h3>\u672c\u6587\u603b\u7ed3<\/h3>\n<p>\u673a\u5668\u5b66\u4e60\u7684\u6838\u5fc3\u4e0d\u662f\u67d0\u4e2a\u795e\u79d8\u51fd\u6570&#xff0c;\u800c\u662f\u4e00\u5957\u4ece\u6570\u636e\u4e2d\u5b66\u4e60\u5e76\u7528\u65b0\u6570\u636e\u68c0\u9a8c\u7684\u8fc7\u7a0b\u3002\u672c\u6587\u533a\u5206\u4e86\u4f20\u7edf\u7f16\u7a0b\u4e0e\u673a\u5668\u5b66\u4e60&#xff0c;\u8ba4\u8bc6\u4e86\u4e09\u7c7b\u5e38\u89c1\u5b66\u4e60\u65b9\u5f0f&#xff0c;\u4e5f\u660e\u786e\u4e86\u6837\u672c\u3001\u7279\u5f81\u3001\u6807\u7b7e\u3001\u6a21\u578b\u3001\u8bad\u7ec3\u96c6\u548c\u6d4b\u8bd5\u96c6\u3002\u968f\u540e&#xff0c;\u6211\u4eec\u5b8c\u6210\u4e86\u4e00\u4e2a\u53ef\u590d\u73b0\u7684\u7ebf\u6027\u56de\u5f52\u6848\u4f8b&#xff0c;\u5e76\u7528 MAE \u4e0e R\u00b2 \u68c0\u67e5\u9884\u6d4b\u6548\u679c\u3002<\/p>\n<p>\u8bb0\u4f4f\u4e00\u4e2a\u57fa\u672c\u987a\u5e8f\u5373\u53ef&#xff1a;\u660e\u786e\u95ee\u9898&#xff0c;\u51c6\u5907\u6570\u636e&#xff0c;\u62c6\u5206\u6570\u636e&#xff0c;\u8bad\u7ec3\u6a21\u578b&#xff0c;\u8bc4\u4f30\u6a21\u578b&#xff0c;\u518d\u8c28\u614e\u4f7f\u7528\u9884\u6d4b\u7ed3\u679c\u3002<\/p>\n<h3>\u4e0b\u4e00\u7bc7\u9884\u544a<\/h3>\n<p>\u4e0b\u4e00\u7bc7\u5c06\u4ecb\u7ecd Anaconda\u3001Python \u4e0e\u673a\u5668\u5b66\u4e60\u5f00\u53d1\u73af\u5883&#xff0c;\u5305\u62ec\u5982\u4f55\u7406\u89e3 Conda \u73af\u5883\u3001\u9009\u62e9\u89e3\u91ca\u5668\u3001\u5b89\u88c5\u4f9d\u8d56&#xff0c;\u4ee5\u53ca\u907f\u5f00\u201c\u5305\u88c5\u597d\u4e86\u5374\u8fd0\u884c\u4e0d\u4e86\u201d\u7684\u5e38\u89c1\u95ee\u9898\u3002<\/p>\n","protected":false},"excerpt":{"rendered":"<p>\u524d\u8a00\u5929\u6c14\u8f6f\u4ef6\u4f30\u8ba1\u660e\u5929\u7684\u6c14\u6e29&#xff0c;\u90ae\u7bb1\u8bc6\u522b\u5783\u573e\u90ae\u4ef6&#xff0c;\u8d2d\u7269\u7f51\u7ad9\u63a8\u8350\u53ef\u80fd\u611f\u5174\u8da3\u7684\u5546\u54c1&#xff0c;\u8fd9\u4e9b\u529f\u80fd\u80cc\u540e\u90fd\u53ef\u80fd\u7528\u5230\u673a\u5668\u5b66\u4e60\u3002\u4e0d\u8fc7&#xff0c;\u673a\u5668\u5b66\u4e60\u5e76\u4e0d\u662f\u8ba9\u8ba1\u7b97\u673a\u50cf\u4eba\u4e00\u6837\u201c\u51ed\u7a7a\u601d\u8003\u201d&#xff0c;\u5b83\u66f4\u50cf\u4e00\u79cd\u4ece\u5df2\u6709\u6570\u636e\u4e2d\u603b\u7ed3\u89c4\u5f8b\u3001\u518d\u5229\u7528\u89c4\u5f8b\u5904\u7406\u65b0\u6570\u636e\u7684\u65b9\u6cd5\u3002\u8fd9\u7bc7\u6587\u7ae0\u5148\u5efa\u7acb\u51e0\u4e2a\u6700\u5e38\u7528\u7684\u6982\u5ff5&#xff0c;\u518d\u7528 Python \u548c scikit-learn \u5b8c\u6210\u4e00\u4e2a\u5c0f\u578b\u56de\u5f52\u4efb\u52a1&#xff1a;\u6839\u636e\u5b66\u4e60\u65f6\u957f\u9884\u6d4b\u8003\u8bd5\u5206\u6570\u3002\u793a\u4f8b\u6570\u636e\u7531\u4ee3\u7801\u751f\u6210&#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":[81,737,50,207],"topic":[],"class_list":["post-91574","post","type-post","status-publish","format-standard","hentry","category-server","tag-python","tag-scikit-learn","tag-50","tag-207"],"yoast_head":"<!-- This site is optimized with the Yoast SEO plugin v20.3 - https:\/\/yoast.com\/wordpress\/plugins\/seo\/ -->\n<title>01 \u673a\u5668\u5b66\u4e60\u5230\u5e95\u662f\u4ec0\u4e48\uff1f\u4ece\u57fa\u672c\u6982\u5ff5\u5230\u7b2c\u4e00\u4e2a\u9884\u6d4b\u6a21\u578b - \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\/91574.html\" \/>\n<meta property=\"og:locale\" content=\"zh_CN\" \/>\n<meta property=\"og:type\" content=\"article\" \/>\n<meta property=\"og:title\" content=\"01 \u673a\u5668\u5b66\u4e60\u5230\u5e95\u662f\u4ec0\u4e48\uff1f\u4ece\u57fa\u672c\u6982\u5ff5\u5230\u7b2c\u4e00\u4e2a\u9884\u6d4b\u6a21\u578b - \u7f51\u7855\u4e92\u8054\u5e2e\u52a9\u4e2d\u5fc3\" \/>\n<meta property=\"og:description\" content=\"\u524d\u8a00\u5929\u6c14\u8f6f\u4ef6\u4f30\u8ba1\u660e\u5929\u7684\u6c14\u6e29&#xff0c;\u90ae\u7bb1\u8bc6\u522b\u5783\u573e\u90ae\u4ef6&#xff0c;\u8d2d\u7269\u7f51\u7ad9\u63a8\u8350\u53ef\u80fd\u611f\u5174\u8da3\u7684\u5546\u54c1&#xff0c;\u8fd9\u4e9b\u529f\u80fd\u80cc\u540e\u90fd\u53ef\u80fd\u7528\u5230\u673a\u5668\u5b66\u4e60\u3002\u4e0d\u8fc7&#xff0c;\u673a\u5668\u5b66\u4e60\u5e76\u4e0d\u662f\u8ba9\u8ba1\u7b97\u673a\u50cf\u4eba\u4e00\u6837\u201c\u51ed\u7a7a\u601d\u8003\u201d&#xff0c;\u5b83\u66f4\u50cf\u4e00\u79cd\u4ece\u5df2\u6709\u6570\u636e\u4e2d\u603b\u7ed3\u89c4\u5f8b\u3001\u518d\u5229\u7528\u89c4\u5f8b\u5904\u7406\u65b0\u6570\u636e\u7684\u65b9\u6cd5\u3002\u8fd9\u7bc7\u6587\u7ae0\u5148\u5efa\u7acb\u51e0\u4e2a\u6700\u5e38\u7528\u7684\u6982\u5ff5&#xff0c;\u518d\u7528 Python \u548c scikit-learn \u5b8c\u6210\u4e00\u4e2a\u5c0f\u578b\u56de\u5f52\u4efb\u52a1&#xff1a;\u6839\u636e\u5b66\u4e60\u65f6\u957f\u9884\u6d4b\u8003\u8bd5\u5206\u6570\u3002\u793a\u4f8b\u6570\u636e\u7531\u4ee3\u7801\u751f\u6210&#xff0c;\" \/>\n<meta property=\"og:url\" content=\"https:\/\/www.wsisp.com\/helps\/91574.html\" \/>\n<meta property=\"og:site_name\" content=\"\u7f51\u7855\u4e92\u8054\u5e2e\u52a9\u4e2d\u5fc3\" \/>\n<meta property=\"article:published_time\" content=\"2026-08-07T16:32:47+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=\"3 \u5206\" \/>\n<script type=\"application\/ld+json\" class=\"yoast-schema-graph\">{\"@context\":\"https:\/\/schema.org\",\"@graph\":[{\"@type\":\"WebPage\",\"@id\":\"https:\/\/www.wsisp.com\/helps\/91574.html\",\"url\":\"https:\/\/www.wsisp.com\/helps\/91574.html\",\"name\":\"01 \u673a\u5668\u5b66\u4e60\u5230\u5e95\u662f\u4ec0\u4e48\uff1f\u4ece\u57fa\u672c\u6982\u5ff5\u5230\u7b2c\u4e00\u4e2a\u9884\u6d4b\u6a21\u578b - \u7f51\u7855\u4e92\u8054\u5e2e\u52a9\u4e2d\u5fc3\",\"isPartOf\":{\"@id\":\"https:\/\/www.wsisp.com\/helps\/#website\"},\"datePublished\":\"2026-08-07T16:32:47+00:00\",\"dateModified\":\"2026-08-07T16:32:47+00:00\",\"author\":{\"@id\":\"https:\/\/www.wsisp.com\/helps\/#\/schema\/person\/358e386c577a3ab51c4493330a20ad41\"},\"breadcrumb\":{\"@id\":\"https:\/\/www.wsisp.com\/helps\/91574.html#breadcrumb\"},\"inLanguage\":\"zh-Hans\",\"potentialAction\":[{\"@type\":\"ReadAction\",\"target\":[\"https:\/\/www.wsisp.com\/helps\/91574.html\"]}]},{\"@type\":\"BreadcrumbList\",\"@id\":\"https:\/\/www.wsisp.com\/helps\/91574.html#breadcrumb\",\"itemListElement\":[{\"@type\":\"ListItem\",\"position\":1,\"name\":\"\u9996\u9875\",\"item\":\"https:\/\/www.wsisp.com\/helps\"},{\"@type\":\"ListItem\",\"position\":2,\"name\":\"01 \u673a\u5668\u5b66\u4e60\u5230\u5e95\u662f\u4ec0\u4e48\uff1f\u4ece\u57fa\u672c\u6982\u5ff5\u5230\u7b2c\u4e00\u4e2a\u9884\u6d4b\u6a21\u578b\"}]},{\"@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":"01 \u673a\u5668\u5b66\u4e60\u5230\u5e95\u662f\u4ec0\u4e48\uff1f\u4ece\u57fa\u672c\u6982\u5ff5\u5230\u7b2c\u4e00\u4e2a\u9884\u6d4b\u6a21\u578b - \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\/91574.html","og_locale":"zh_CN","og_type":"article","og_title":"01 \u673a\u5668\u5b66\u4e60\u5230\u5e95\u662f\u4ec0\u4e48\uff1f\u4ece\u57fa\u672c\u6982\u5ff5\u5230\u7b2c\u4e00\u4e2a\u9884\u6d4b\u6a21\u578b - \u7f51\u7855\u4e92\u8054\u5e2e\u52a9\u4e2d\u5fc3","og_description":"\u524d\u8a00\u5929\u6c14\u8f6f\u4ef6\u4f30\u8ba1\u660e\u5929\u7684\u6c14\u6e29&#xff0c;\u90ae\u7bb1\u8bc6\u522b\u5783\u573e\u90ae\u4ef6&#xff0c;\u8d2d\u7269\u7f51\u7ad9\u63a8\u8350\u53ef\u80fd\u611f\u5174\u8da3\u7684\u5546\u54c1&#xff0c;\u8fd9\u4e9b\u529f\u80fd\u80cc\u540e\u90fd\u53ef\u80fd\u7528\u5230\u673a\u5668\u5b66\u4e60\u3002\u4e0d\u8fc7&#xff0c;\u673a\u5668\u5b66\u4e60\u5e76\u4e0d\u662f\u8ba9\u8ba1\u7b97\u673a\u50cf\u4eba\u4e00\u6837\u201c\u51ed\u7a7a\u601d\u8003\u201d&#xff0c;\u5b83\u66f4\u50cf\u4e00\u79cd\u4ece\u5df2\u6709\u6570\u636e\u4e2d\u603b\u7ed3\u89c4\u5f8b\u3001\u518d\u5229\u7528\u89c4\u5f8b\u5904\u7406\u65b0\u6570\u636e\u7684\u65b9\u6cd5\u3002\u8fd9\u7bc7\u6587\u7ae0\u5148\u5efa\u7acb\u51e0\u4e2a\u6700\u5e38\u7528\u7684\u6982\u5ff5&#xff0c;\u518d\u7528 Python \u548c scikit-learn \u5b8c\u6210\u4e00\u4e2a\u5c0f\u578b\u56de\u5f52\u4efb\u52a1&#xff1a;\u6839\u636e\u5b66\u4e60\u65f6\u957f\u9884\u6d4b\u8003\u8bd5\u5206\u6570\u3002\u793a\u4f8b\u6570\u636e\u7531\u4ee3\u7801\u751f\u6210&#xff0c;","og_url":"https:\/\/www.wsisp.com\/helps\/91574.html","og_site_name":"\u7f51\u7855\u4e92\u8054\u5e2e\u52a9\u4e2d\u5fc3","article_published_time":"2026-08-07T16:32:47+00:00","author":"admin","twitter_card":"summary_large_image","twitter_misc":{"\u4f5c\u8005":"admin","\u9884\u8ba1\u9605\u8bfb\u65f6\u95f4":"3 \u5206"},"schema":{"@context":"https:\/\/schema.org","@graph":[{"@type":"WebPage","@id":"https:\/\/www.wsisp.com\/helps\/91574.html","url":"https:\/\/www.wsisp.com\/helps\/91574.html","name":"01 \u673a\u5668\u5b66\u4e60\u5230\u5e95\u662f\u4ec0\u4e48\uff1f\u4ece\u57fa\u672c\u6982\u5ff5\u5230\u7b2c\u4e00\u4e2a\u9884\u6d4b\u6a21\u578b - \u7f51\u7855\u4e92\u8054\u5e2e\u52a9\u4e2d\u5fc3","isPartOf":{"@id":"https:\/\/www.wsisp.com\/helps\/#website"},"datePublished":"2026-08-07T16:32:47+00:00","dateModified":"2026-08-07T16:32:47+00:00","author":{"@id":"https:\/\/www.wsisp.com\/helps\/#\/schema\/person\/358e386c577a3ab51c4493330a20ad41"},"breadcrumb":{"@id":"https:\/\/www.wsisp.com\/helps\/91574.html#breadcrumb"},"inLanguage":"zh-Hans","potentialAction":[{"@type":"ReadAction","target":["https:\/\/www.wsisp.com\/helps\/91574.html"]}]},{"@type":"BreadcrumbList","@id":"https:\/\/www.wsisp.com\/helps\/91574.html#breadcrumb","itemListElement":[{"@type":"ListItem","position":1,"name":"\u9996\u9875","item":"https:\/\/www.wsisp.com\/helps"},{"@type":"ListItem","position":2,"name":"01 \u673a\u5668\u5b66\u4e60\u5230\u5e95\u662f\u4ec0\u4e48\uff1f\u4ece\u57fa\u672c\u6982\u5ff5\u5230\u7b2c\u4e00\u4e2a\u9884\u6d4b\u6a21\u578b"}]},{"@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\/91574","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=91574"}],"version-history":[{"count":0,"href":"https:\/\/www.wsisp.com\/helps\/wp-json\/wp\/v2\/posts\/91574\/revisions"}],"wp:attachment":[{"href":"https:\/\/www.wsisp.com\/helps\/wp-json\/wp\/v2\/media?parent=91574"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.wsisp.com\/helps\/wp-json\/wp\/v2\/categories?post=91574"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.wsisp.com\/helps\/wp-json\/wp\/v2\/tags?post=91574"},{"taxonomy":"topic","embeddable":true,"href":"https:\/\/www.wsisp.com\/helps\/wp-json\/wp\/v2\/topic?post=91574"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}