{"id":176877,"date":"2024-05-08T19:19:36","date_gmt":"2024-05-08T11:19:36","guid":{"rendered":"https:\/\/docs.pingcode.com\/ask\/ask-ask\/176877.html"},"modified":"2024-05-08T19:19:41","modified_gmt":"2024-05-08T11:19:41","slug":"r%e8%af%ad%e8%a8%80%e6%88%96python%e6%80%8e%e4%b9%88%e7%94%a8%e6%9c%80%e5%b0%8f%e4%b8%80%e4%b9%98%e6%b3%95%e5%81%9a%e5%9b%9e%e5%bd%92","status":"publish","type":"post","link":"https:\/\/docs.pingcode.com\/ask\/176877.html","title":{"rendered":"R\u8bed\u8a00(\u6216python)\u600e\u4e48\u7528\u6700\u5c0f\u4e00\u4e58\u6cd5\u505a\u56de\u5f52"},"content":{"rendered":"<p style=\"text-align:center\"><img decoding=\"async\" src=\"https:\/\/cdn-kb.worktile.com\/kb\/wp-content\/uploads\/2024\/04\/27060601\/3fe52202-1b42-428e-8a1d-04ed8533b757.webp\" alt=\"R\u8bed\u8a00(\u6216python)\u600e\u4e48\u7528\u6700\u5c0f\u4e00\u4e58\u6cd5\u505a\u56de\u5f52\" \/><\/p>\n<p><p>\u5728\u5904\u7406\u6570\u636e\u5206\u6790\u548c\u7edf\u8ba1\u5efa\u6a21\u95ee\u9898\u65f6\uff0c\u6700\u5c0f\u4e8c\u4e58\u6cd5\uff08Least Squares Method\uff09\u662f\u4e00\u79cd\u5e7f\u6cdb\u5e94\u7528\u7684\u6280\u672f\uff0c\u5b83\u901a\u8fc7\u6700\u5c0f\u5316\u8bef\u5dee\u7684\u5e73\u65b9\u548c\u6765\u5bfb\u627e\u6570\u636e\u7684\u6700\u4f73\u62df\u5408\u3002\u5728R\u8bed\u8a00\u548cPython\u4e2d\uff0c\u5b9e\u73b0\u6700\u5c0f\u4e8c\u4e58\u6cd5\u8fdb\u884c\u56de\u5f52\u5206\u6790\u53ef\u4ee5\u901a\u8fc7\u591a\u79cd\u65b9\u5f0f\uff0c\u5305\u62ec\u4f7f\u7528\u5185\u7f6e\u51fd\u6570\u548c\u7f16\u5199\u81ea\u5b9a\u4e49\u4ee3\u7801\u6765\u624b\u52a8\u5b9e\u73b0\u3002<strong>\u6700\u6838\u5fc3\u7684\u89c2\u70b9\u662f\uff0c\u5728R\u8bed\u8a00\u4e2d\u53ef\u4ee5\u91c7\u7528<code>lm()<\/code>\u51fd\u6570\u8fdb\u884c\u6700\u5c0f\u4e8c\u4e58\u56de\u5f52\uff0c\u800c\u5728Python\u4e2d\uff0c\u53ef\u4ee5\u501f\u52a9SciPy\u5e93\u6216\u8005NumPy\u5e93\u6765\u5b9e\u73b0\u6700\u5c0f\u4e8c\u4e58\u56de\u5f52<\/strong>\u3002\u5728\u8fd9\u4e24\u79cd\u8bed\u8a00\u4e2d\uff0c\u9009\u62e9\u5408\u9002\u7684\u5e93\u548c\u51fd\u6570\u5bf9\u4e8e\u9ad8\u6548\u5730\u5b8c\u6210\u6570\u636e\u5206\u6790\u5de5\u4f5c\u81f3\u5173\u91cd\u8981\u3002<\/p>\n<\/p>\n<p><p>\u5728R\u8bed\u8a00\u4e2d\uff0c<code>lm()<\/code>\u51fd\u6570\u662f\u6700\u5e38\u89c1\u7684\u5b9e\u73b0\u6700\u5c0f\u4e8c\u4e58\u56de\u5f52\u7684\u65b9\u5f0f\uff0c\u5b83\u63d0\u4f9b\u4e86\u4e00\u4e2a\u76f4\u89c2\u4e14\u6613\u4e8e\u4f7f\u7528\u7684\u63a5\u53e3\u6765\u5904\u7406\u7ebf\u6027\u6a21\u578b\u3002\u8fd9\u4e2a\u51fd\u6570\u4e0d\u4ec5\u53ef\u4ee5\u4f30\u8ba1\u7cfb\u6570\uff0c\u8fd8\u63d0\u4f9b\u4e86\u8be6\u5c3d\u7684\u6a21\u578b\u6458\u8981\uff0c\u5305\u62ec\u7cfb\u6570\u7684\u6807\u51c6\u8bef\u3001t\u503c\u3001p\u503c\u7b49\uff0c\u975e\u5e38\u9002\u5408\u8fdb\u884c\u7edf\u8ba1\u5b66\u4e0a\u7684\u5047\u8bbe\u68c0\u9a8c\u548c\u6a21\u578b\u8bc4\u4f30\u3002<\/p>\n<\/p>\n<p><h2>\u4e00\u3001R\u8bed\u8a00\u4e2d\u7684\u6700\u5c0f\u4e8c\u4e58\u56de\u5f52<\/h2>\n<\/p>\n<p><p>\u5728R\u8bed\u8a00\u4e2d\uff0c\u6700\u5c0f\u4e8c\u4e58\u56de\u5f52\u5206\u6790\u901a\u5e38\u4f7f\u7528<code>lm()<\/code>\u51fd\u6570\u6765\u6267\u884c\u3002\u8fd9\u4e2a\u51fd\u6570\u62e5\u6709\u4e00\u4e2a\u76f4\u89c2\u7684\u8bed\u6cd5\u7ed3\u6784\uff0c\u5141\u8bb8\u7528\u6237\u65b9\u4fbf\u5730\u6307\u5b9a\u6a21\u578b\u516c\u5f0f\u548c\u6570\u636e\u96c6\u3002<\/p>\n<\/p>\n<p><h3>\u6570\u636e\u51c6\u5907<\/h3>\n<\/p>\n<p><p>\u9996\u5148\uff0c\u4f60\u9700\u8981\u51c6\u5907\u6216\u5bfc\u5165\u4f60\u7684\u6570\u636e\u96c6\u3002\u786e\u4fdd\u4f60\u7684\u6570\u636e\u5728R\u4e2d\u662f\u4e00\u4e2a<code>data.frame<\/code>\u7ed3\u6784\uff0c\u5176\u4e2d\u5305\u542b\u4f60\u60f3\u8981\u5206\u6790\u7684\u6570\u503c\u578b\u56e0\u53d8\u91cf\u548c\u4e00\u4e2a\u6216\u591a\u4e2a\u81ea\u53d8\u91cf\u3002<\/p>\n<\/p>\n<p><pre><code class=\"language-R\"># \u793a\u4f8b\uff1a\u521b\u5efa\u4e00\u4e2a\u6570\u636e\u96c6<\/p>\n<p>data &lt;- data.frame(<\/p>\n<p>  x1 = 1:10,<\/p>\n<p>  y = c(2, 4, 5, 7, 10, 11, 14, 15, 18, 20)<\/p>\n<p>)<\/p>\n<p><\/code><\/pre>\n<\/p>\n<p><h3>\u5b9e\u65bd\u56de\u5f52\u5206\u6790<\/h3>\n<\/p>\n<p><p>\u63a5\u4e0b\u6765\uff0c\u4f7f\u7528<code>lm()<\/code>\u51fd\u6570\u6765\u5b9a\u4e49\u548c\u62df\u5408\u4e00\u4e2a\u7ebf\u6027\u6a21\u578b\u3002\u4f60\u9700\u8981\u6307\u5b9a\u516c\u5f0f\uff0c\u5373\u56e0\u53d8\u91cf\u548c\u81ea\u53d8\u91cf\u7684\u5173\u7cfb\uff0c\u4ee5\u53ca\u6240\u4f7f\u7528\u7684\u6570\u636e\u96c6\u3002<\/p>\n<\/p>\n<p><pre><code class=\"language-R\"># \u4f7f\u7528lm()\u51fd\u6570\u62df\u5408\u6a21\u578b<\/p>\n<p>model &lt;- lm(y ~ x1, data=data)<\/p>\n<h2><strong>\u67e5\u770b\u6a21\u578b\u6458\u8981<\/strong><\/h2>\n<p>summary(model)<\/p>\n<p><\/code><\/pre>\n<\/p>\n<p><h2>\u4e8c\u3001Python\u4e2d\u7684\u6700\u5c0f\u4e8c\u4e58\u56de\u5f52<\/h2>\n<\/p>\n<p><p>\u5728Python\u73af\u5883\u4e0b\uff0c\u8fdb\u884c\u6700\u5c0f\u4e8c\u4e58\u56de\u5f52\u5206\u6790\u5219\u66f4\u4e3a\u4f9d\u8d56\u4e8e\u7b2c\u4e09\u65b9\u5e93\uff0c\u5982NumPy\u548cSciPy\u3002<\/p>\n<\/p>\n<p><h3>\u4f7f\u7528SciPy\u5e93<\/h3>\n<\/p>\n<p><p>SciPy\u5e93\u4e2d\u7684<code>scipy.optimize<\/code>\u6a21\u5757\u63d0\u4f9b\u4e86\u4e30\u5bcc\u7684\u6700\u5c0f\u5316\uff08\u6216\u6700\u5927\u5316\uff09\u51fd\u6570\u7684\u65b9\u6cd5\uff0c\u5176\u4e2d<code>least_squares<\/code>\u662f\u8fdb\u884c\u6700\u5c0f\u4e8c\u4e58\u56de\u5f52\u5206\u6790\u7684\u5de5\u5177\u3002<\/p>\n<\/p>\n<p><pre><code class=\"language-python\">import numpy as np<\/p>\n<p>from scipy.optimize import least_squares<\/p>\n<h2><strong>\u5b9a\u4e49\u6a21\u578b\u51fd\u6570<\/strong><\/h2>\n<p>def model_func(x, params):<\/p>\n<p>    return params[0] + params[1] * x<\/p>\n<h2><strong>\u5b9a\u4e49\u8bef\u5dee\u51fd\u6570<\/strong><\/h2>\n<p>def error_func(params, x, y):<\/p>\n<p>    return model_func(x, params) - y<\/p>\n<h2><strong>\u793a\u4f8b\u6570\u636e<\/strong><\/h2>\n<p>x_data = np.arange(1, 11)<\/p>\n<p>y_data = np.array([2, 4, 5, 7, 10, 11, 14, 15, 18, 20])<\/p>\n<h2><strong>\u4f7f\u7528least_squares\u8fdb\u884c\u62df\u5408<\/strong><\/h2>\n<p>params_result = least_squares(error_func, [0, 0], args=(x_data, y_data))<\/p>\n<p>print(params_result)<\/p>\n<p><\/code><\/pre>\n<\/p>\n<p><h3>\u4f7f\u7528NumPy\u5e93<\/h3>\n<\/p>\n<p><p>NumPy\u662f\u53e6\u4e00\u4e2a\u5f3a\u5927\u7684\u6570\u5b66\u5e93\uff0c\u5b83\u63d0\u4f9b\u4e86\u4e00\u4e2a\u540d\u4e3a<code>polyfit<\/code>\u7684\u51fd\u6570\uff0c\u8be5\u51fd\u6570\u53ef\u4ee5\u5b9e\u73b0\u7b80\u5355\u7684\u6700\u5c0f\u4e8c\u4e58\u591a\u9879\u5f0f\u62df\u5408\u3002<\/p>\n<\/p>\n<p><pre><code class=\"language-python\">import numpy as np<\/p>\n<h2><strong>\u540c\u6837\u7684\u793a\u4f8b\u6570\u636e<\/strong><\/h2>\n<p>x_data = np.arange(1, 11)<\/p>\n<p>y_data = np.array([2, 4, 5, 7, 10, 11, 14, 15, 18, 20])<\/p>\n<h2><strong>\u4f7f\u7528polyfit\u62df\u5408\u4e00\u6b21\u591a\u9879\u5f0f\uff08\u7ebf\u6027\u6a21\u578b\uff09<\/strong><\/h2>\n<p>params = np.polyfit(x_data, y_data, 1)<\/p>\n<p>print(params)<\/p>\n<p><\/code><\/pre>\n<\/p>\n<p><h2>\u4e09\u3001\u6a21\u578b\u8bc4\u4f30\u4e0e\u89e3\u91ca<\/h2>\n<\/p>\n<p><p>\u65e0\u8bba\u4f7f\u7528R\u8bed\u8a00\u8fd8\u662fPython\uff0c\u5b8c\u6210\u6700\u5c0f\u4e8c\u4e58\u56de\u5f52\u62df\u5408\u540e\uff0c\u4e0b\u4e00\u6b65\u90fd\u662f\u6a21\u578b\u8bc4\u4f30\u3002\u5728R\u8bed\u8a00\u4e2d\uff0c<code>summary()<\/code>\u51fd\u6570\u63d0\u4f9b\u4e86\u4e00\u4e2a\u5168\u9762\u7684\u6a21\u578b\u8bc4\u4f30\u62a5\u544a\uff0cPython\u5219\u6839\u636e\u4f7f\u7528\u7684\u5e93\u800c\u6709\u4e0d\u540c\u7684\u8bc4\u4f30\u65b9\u6cd5\u3002\u56de\u5f52\u5206\u6790\u7684\u6838\u5fc3\u5728\u4e8e\u7406\u89e3\u6a21\u578b\u7684\u7b26\u5408\u5ea6\u3001\u7cfb\u6570\u7684\u663e\u8457\u6027\u4ee5\u53ca\u9884\u6d4b\u80fd\u529b\u3002<\/p>\n<\/p>\n<p><h3>\u7cfb\u6570\u89e3\u91ca<\/h3>\n<\/p>\n<p><p>\u5728\u6700\u5c0f\u4e8c\u4e58\u56de\u5f52\u6a21\u578b\u4e2d\uff0c\u7cfb\u6570\u53cd\u6620\u4e86\u81ea\u53d8\u91cf\u548c\u56e0\u53d8\u91cf\u4e4b\u95f4\u7684\u7ebf\u6027\u5173\u7cfb\u3002\u6b63\u7cfb\u6570\u8868\u793a\u6b63\u76f8\u5173\uff0c\u8d1f\u7cfb\u6570\u8868\u793a\u8d1f\u76f8\u5173\uff0c\u7cfb\u6570\u7684\u5927\u5c0f\u8868\u793a\u53d8\u5316\u7684\u654f\u611f\u5ea6\u3002<\/p>\n<\/p>\n<p><h3>\u6a21\u578b\u7b26\u5408\u5ea6<\/h3>\n<\/p>\n<p><p>\u6a21\u578b\u7b26\u5408\u5ea6\u901a\u5e38\u901a\u8fc7\u51b3\u5b9a\u7cfb\u6570\uff08(R^2)\uff09\u6765\u8bc4\u4f30\uff0c\u8fd9\u4e2a\u503c\u5ea6\u91cf\u4e86\u6a21\u578b\u89e3\u91ca\u7684\u53d8\u5f02\u91cf\u5360\u603b\u53d8\u5f02\u91cf\u7684\u6bd4\u4f8b\u3002\u63a5\u8fd11\u7684(R^2)\u503c\u8868\u793a\u6a21\u578b\u62df\u5408\u5f97\u5f88\u597d\u3002<\/p>\n<\/p>\n<p><h2>\u56db\u3001\u8fdb\u9636\u5e94\u7528\u548c\u6311\u6218<\/h2>\n<\/p>\n<p><p>\u5728\u638c\u63e1\u4e86\u57fa\u7840\u7684\u6700\u5c0f\u4e8c\u4e58\u56de\u5f52\u5206\u6790\u540e\uff0c\u4f60\u53ef\u80fd\u4f1a\u9047\u5230\u66f4\u590d\u6742\u7684\u5e94\u7528\u573a\u666f\uff0c\u6bd4\u5982\u5904\u7406\u591a\u5143\u7ebf\u6027\u56de\u5f52\u3001\u9762\u5bf9\u975e\u7ebf\u6027\u5173\u7cfb\u3001\u6216\u662f\u89e3\u51b3\u6570\u636e\u4e2d\u7684\u5f02\u65b9\u5dee\u6027\u95ee\u9898\u7b49\u3002<\/p>\n<\/p>\n<p><h3>\u591a\u5143\u7ebf\u6027\u56de\u5f52<\/h3>\n<\/p>\n<p><p>\u5728\u6709\u591a\u4e2a\u81ea\u53d8\u91cf\u7684\u60c5\u5f62\u4e0b\uff0c\u53ef\u4ee5\u901a\u8fc7\u589e\u52a0\u66f4\u591a\u7684\u81ea\u53d8\u91cf\u5230\u6a21\u578b\u4e2d\u6765\u8fdb\u884c\u591a\u5143\u7ebf\u6027\u56de\u5f52\u5206\u6790\u3002\u8fd9\u4f7f\u5f97\u6a21\u578b\u66f4\u4e3a\u590d\u6742\uff0c\u4f46\u4e5f\u80fd\u66f4\u7cbe\u7ec6\u5730\u63ed\u793a\u53d8\u91cf\u4e4b\u95f4\u7684\u76f8\u4e92\u4f5c\u7528\u3002<\/p>\n<\/p>\n<p><h3>\u975e\u7ebf\u6027\u56de\u5f52<\/h3>\n<\/p>\n<p><p>\u5f53\u5173\u7cfb\u4e0d\u662f\u4e25\u683c\u7684\u7ebf\u6027\u65f6\uff0c\u53ef\u4ee5\u9009\u62e9\u975e\u7ebf\u6027\u56de\u5f52\u6a21\u578b\u3002\u5728R\u8bed\u8a00\u548cPython\u4e2d\uff0c\u90fd\u6709\u76f8\u5e94\u7684\u51fd\u6570\u548c\u5e93\u652f\u6301\u975e\u7ebf\u6027\u6a21\u578b\u7684\u62df\u5408\u3002<\/p>\n<\/p>\n<p><p>\u968f\u7740\u6570\u636e\u5206\u6790\u6280\u672f\u7684\u53d1\u5c55\uff0c\u6700\u5c0f\u4e8c\u4e58\u6cd5\u7684\u5e94\u7528\u548c\u5b9e\u73b0\u65b9\u6cd5\u4e0d\u65ad\u6f14\u8fdb\u3002\u65e0\u8bba\u662f\u5728R\u8bed\u8a00\u8fd8\u662fPython\u4e2d\uff0c\u719f\u7ec3\u638c\u63e1\u6700\u5c0f\u4e8c\u4e58\u6cd5\u5bf9\u6570\u636e\u79d1\u5b66\u5bb6\u548c\u7edf\u8ba1\u5206\u6790\u5e08\u6765\u8bf4\u90fd\u662f\u975e\u5e38\u91cd\u8981\u7684\u6280\u80fd\u3002\u901a\u8fc7\u4e0d\u65ad\u5b9e\u8df5\u548c\u5b66\u4e60\uff0c\u4f60\u5c06\u80fd\u591f\u66f4\u6df1\u5165\u5730\u7406\u89e3\u6570\u636e\uff0c\u5e76\u8fd0\u7528\u5408\u9002\u7684\u6280\u672f\u89e3\u51b3\u5b9e\u9645\u95ee\u9898\u3002<\/p>\n<\/p>\n<h2><strong>\u76f8\u5173\u95ee\u7b54FAQs\uff1a<\/strong><\/h2>\n<p><strong>1. \u4ec0\u4e48\u662f\u6700\u5c0f\u4e00\u4e58\u6cd5\u56de\u5f52\u4ee5\u53ca\u5b83\u5728R\u8bed\u8a00\uff08\u6216Python\uff09\u4e2d\u7684\u5e94\u7528\uff1f<\/strong><\/p>\n<p>\u6700\u5c0f\u4e00\u4e58\u6cd5\u56de\u5f52\u662f\u4e00\u79cd\u5e38\u89c1\u7684\u56de\u5f52\u5206\u6790\u65b9\u6cd5\uff0c\u5b83\u901a\u8fc7\u6700\u5c0f\u5316\u8bef\u5dee\u7684\u5e73\u65b9\u548c\u6765\u62df\u5408\u6570\u636e\uff0c\u5e76\u627e\u5230\u6700\u4f73\u7684\u7ebf\u6027\u5173\u7cfb\u3002\u5728R\u8bed\u8a00\uff08\u6216Python\uff09\u4e2d\uff0c\u6211\u4eec\u53ef\u4ee5\u4f7f\u7528\u5185\u7f6e\u51fd\u6570\u6216\u7b2c\u4e09\u65b9\u8f6f\u4ef6\u5305\u6765\u5b9e\u73b0\u6700\u5c0f\u4e00\u4e58\u6cd5\u56de\u5f52\u3002\u5728R\u8bed\u8a00\u4e2d\uff0c\u53ef\u4ee5\u4f7f\u7528lm()\u51fd\u6570\u6765\u8fdb\u884c\u666e\u901a\u6700\u5c0f\u4e8c\u4e58\u6cd5\u56de\u5f52\uff0c\u5728Python\u4e2d\uff0c\u53ef\u4ee5\u4f7f\u7528statsmodels\u6216scikit-learn\u5e93\u4e2d\u7684\u7ebf\u6027\u56de\u5f52\u51fd\u6570\u3002<\/p>\n<p><strong>2. \u5982\u4f55\u5728R\u8bed\u8a00\uff08\u6216Python\uff09\u4e2d\u4f7f\u7528\u6700\u5c0f\u4e00\u4e58\u6cd5\u5b9e\u73b0\u591a\u53d8\u91cf\u56de\u5f52\uff1f<\/strong><\/p>\n<p>\u5728\u4f7f\u7528\u6700\u5c0f\u4e00\u4e58\u6cd5\u8fdb\u884c\u591a\u53d8\u91cf\u56de\u5f52\u65f6\uff0c\u6211\u4eec\u9700\u8981\u5c06\u81ea\u53d8\u91cf\uff08\u7279\u5f81\uff09\u5b58\u50a8\u5728\u4e00\u4e2a\u77e9\u9635\u4e2d\uff0c\u5e76\u5c06\u56e0\u53d8\u91cf\uff08\u76ee\u6807\u53d8\u91cf\uff09\u5b58\u50a8\u5728\u4e00\u4e2a\u5411\u91cf\u4e2d\u3002\u5728R\u8bed\u8a00\u4e2d\uff0c\u53ef\u4ee5\u4f7f\u7528lm()\u51fd\u6570\uff0c\u5e76\u6307\u5b9a\u591a\u4e2a\u81ea\u53d8\u91cf\u6765\u8fdb\u884c\u591a\u53d8\u91cf\u56de\u5f52\u3002\u5728Python\u4e2d\uff0c\u53ef\u4ee5\u4f7f\u7528statsmodels\u6216scikit-learn\u5e93\u4e2d\u7684\u7ebf\u6027\u56de\u5f52\u51fd\u6570\uff0c\u5e76\u4f20\u9012\u5305\u542b\u591a\u4e2a\u81ea\u53d8\u91cf\u7684\u7279\u5f81\u77e9\u9635\u3002<\/p>\n<p><strong>3. \u5982\u4f55\u8bc4\u4f30\u6700\u5c0f\u4e00\u4e58\u6cd5\u56de\u5f52\u6a21\u578b\u5728R\u8bed\u8a00\uff08\u6216Python\uff09\u4e2d\u7684\u6027\u80fd\uff1f<\/strong><\/p>\n<p>\u5728\u8bc4\u4f30\u6700\u5c0f\u4e00\u4e58\u6cd5\u56de\u5f52\u6a21\u578b\u7684\u6027\u80fd\u65f6\uff0c\u6211\u4eec\u901a\u5e38\u4f7f\u7528\u5404\u79cd\u7edf\u8ba1\u6307\u6807\u6765\u8861\u91cf\u6a21\u578b\u7684\u62df\u5408\u4f18\u5ea6\u3002\u5e38\u89c1\u7684\u8bc4\u4f30\u6307\u6807\u5305\u62ec\u5747\u65b9\u8bef\u5dee\uff08Mean Squared Error, MSE\uff09\u3001\u5747\u65b9\u6839\u8bef\u5dee\uff08Root Mean Squared Error, RMSE\uff09\u3001\u51b3\u5b9a\u7cfb\u6570\uff08Coefficient of Determination, R^2\uff09\u7b49\u3002\u5728R\u8bed\u8a00\u4e2d\uff0c\u53ef\u4ee5\u4f7f\u7528summary()\u51fd\u6570\u6765\u83b7\u53d6\u56de\u5f52\u6a21\u578b\u7684\u6027\u80fd\u6307\u6807\u3002\u5728Python\u4e2d\uff0c\u53ef\u4ee5\u4f7f\u7528\u53ef\u89c6\u5316\u5de5\u5177\u5982matplotlib\u548cseaborn\u6765\u7ed8\u5236\u62df\u5408\u56fe\u4ee5\u53ca\u8ba1\u7b97\u6027\u80fd\u6307\u6807\u3002<\/p>\n","protected":false},"excerpt":{"rendered":"\u5728\u5904\u7406\u6570\u636e\u5206\u6790\u548c\u7edf\u8ba1\u5efa\u6a21\u95ee\u9898\u65f6\uff0c\u6700\u5c0f\u4e8c\u4e58\u6cd5\uff08Least Squares Method\uff09\u662f\u4e00\u79cd\u5e7f\u6cdb\u5e94\u7528\u7684\u6280\u672f\uff0c\u5b83 [&hellip;]","protected":false},"author":3,"featured_media":176884,"comment_status":"closed","ping_status":"","sticky":false,"template":"","format":"standard","meta":{"_acf_changed":false,"footnotes":""},"categories":[37],"tags":[],"acf":[],"_links":{"self":[{"href":"https:\/\/docs.pingcode.com\/wp-json\/wp\/v2\/posts\/176877"}],"collection":[{"href":"https:\/\/docs.pingcode.com\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/docs.pingcode.com\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/docs.pingcode.com\/wp-json\/wp\/v2\/users\/3"}],"replies":[{"embeddable":true,"href":"https:\/\/docs.pingcode.com\/wp-json\/wp\/v2\/comments?post=176877"}],"version-history":[{"count":0,"href":"https:\/\/docs.pingcode.com\/wp-json\/wp\/v2\/posts\/176877\/revisions"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/docs.pingcode.com\/wp-json\/wp\/v2\/media\/176884"}],"wp:attachment":[{"href":"https:\/\/docs.pingcode.com\/wp-json\/wp\/v2\/media?parent=176877"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/docs.pingcode.com\/wp-json\/wp\/v2\/categories?post=176877"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/docs.pingcode.com\/wp-json\/wp\/v2\/tags?post=176877"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}