{"id":855,"date":"2025-01-11T11:52:24","date_gmt":"2025-01-11T03:52:24","guid":{"rendered":"https:\/\/www.laixuexila.com\/?p=855"},"modified":"2025-01-11T11:52:24","modified_gmt":"2025-01-11T03:52:24","slug":"python%e5%b8%b8%e7%94%a8%e6%95%b0%e6%8d%ae%e5%88%86%e6%9e%90%e5%ba%93%e5%a4%a7%e5%85%a8%ef%bc%9a%e6%9c%80%e5%8f%97%e6%ac%a2%e8%bf%8e%e7%9a%84%e5%b7%a5%e5%85%b7%e4%b8%8e%e5%ba%93","status":"publish","type":"post","link":"https:\/\/www.laixuexila.com\/index.php\/2025\/01\/11\/python%e5%b8%b8%e7%94%a8%e6%95%b0%e6%8d%ae%e5%88%86%e6%9e%90%e5%ba%93%e5%a4%a7%e5%85%a8%ef%bc%9a%e6%9c%80%e5%8f%97%e6%ac%a2%e8%bf%8e%e7%9a%84%e5%b7%a5%e5%85%b7%e4%b8%8e%e5%ba%93\/","title":{"rendered":"Python\u5e38\u7528\u6570\u636e\u5206\u6790\u5e93\u5927\u5168\uff1a\u6700\u53d7\u6b22\u8fce\u7684\u5de5\u5177\u4e0e\u5e93"},"content":{"rendered":"\n<blockquote class=\"wp-block-quote is-layout-flow wp-block-quote-is-layout-flow\">\n<p class=\"wp-block-paragraph\">Python\u7684\u6570\u636e\u5206\u6790\u5e93\u79cd\u7c7b\u7e41\u591a\uff0c\u6db5\u76d6\u4e86\u4ece\u6570\u636e\u5904\u7406\u3001\u5206\u6790\u5230\u53ef\u89c6\u5316\u3001\u673a\u5668\u5b66\u4e60\u7b49\u591a\u4e2a\u65b9\u9762\u3002\u5728\u9009\u62e9\u5de5\u5177\u65f6\uff0c\u6839\u636e\u5177\u4f53\u7684\u9700\u6c42\u548c\u4efb\u52a1\u9009\u62e9\u5408\u9002\u7684\u5e93\u81f3\u5173\u91cd\u8981\u3002\u4f8b\u5982\uff0c\u5bf9\u4e8e\u7b80\u5355\u7684\u7edf\u8ba1\u5206\u6790\uff0cPandas\u548cNumPy\u5df2\u7ecf\u8db3\u591f\uff1b\u800c\u5bf9\u4e8e\u590d\u6742\u7684\u673a\u5668\u5b66\u4e60\u548c\u6df1\u5ea6\u5b66\u4e60\u4efb\u52a1\uff0c\u5219\u53ef\u4ee5\u9009\u62e9Scikit-learn\u3001TensorFlow\u7b49\u5e93\u3002\u968f\u7740Python\u6570\u636e\u79d1\u5b66\u9886\u57df\u7684\u4e0d\u65ad\u53d1\u5c55\uff0c\u8fd9\u4e9b\u5de5\u5177\u5c06\u4e0d\u65ad\u6f14\u8fdb\uff0c\u63d0\u4f9b\u66f4\u5f3a\u5927\u7684\u529f\u80fd\u548c\u66f4\u7b80\u6d01\u7684\u63a5\u53e3\u3002<\/p>\n<\/blockquote>\n\n\n\n<hr class=\"wp-block-separator has-alpha-channel-opacity\"\/>\n\n\n\n<h4 class=\"wp-block-heading\">1. \u5f15\u8a00<\/h4>\n\n\n\n<p class=\"wp-block-paragraph\">\u968f\u7740\u5927\u6570\u636e\u548c\u4eba\u5de5\u667a\u80fd\u7684\u53d1\u5c55\uff0c\u6570\u636e\u5206\u6790\u6210\u4e3a\u5404\u884c\u5404\u4e1a\u7684\u6838\u5fc3\u9700\u6c42\u4e4b\u4e00\u3002\u65e0\u8bba\u662f\u4f01\u4e1a\u8fd0\u8425\u51b3\u7b56\u3001\u79d1\u5b66\u7814\u7a76\u3001\u91d1\u878d\u6295\u8d44\uff0c\u8fd8\u662f\u5e02\u573a\u8425\u9500\uff0c\u6570\u636e\u5206\u6790\u90fd\u626e\u6f14\u7740\u91cd\u8981\u89d2\u8272\u3002Python\uff0c\u4f5c\u4e3a\u4e00\u79cd\u7b80\u5355\u6613\u5b66\u4e14\u529f\u80fd\u5f3a\u5927\u7684\u7f16\u7a0b\u8bed\u8a00\uff0c\u5df2\u7ecf\u6210\u4e3a\u6570\u636e\u79d1\u5b66\u5bb6\u548c\u5206\u6790\u5e08\u9996\u9009\u7684\u5de5\u5177\u3002<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">Python\u7684\u53d7\u6b22\u8fce\u7a0b\u5ea6\u5f97\u76ca\u4e8e\u5176\u4e30\u5bcc\u7684\u5e93\u548c\u5de5\u5177\uff0c\u8fd9\u4e9b\u5e93\u53ef\u4ee5\u5e2e\u52a9\u5f00\u53d1\u8005\u5feb\u901f\u8fdb\u884c\u6570\u636e\u5904\u7406\u3001\u5206\u6790\u548c\u53ef\u89c6\u5316\u3002\u5728\u8fd9\u7bc7\u6587\u7ae0\u4e2d\uff0c\u6211\u4eec\u5c06\u6df1\u5165\u89e3\u6790Python\u5e38\u7528\u7684\u51e0\u4e2a\u6570\u636e\u5206\u6790\u5e93\uff0c\u5e2e\u52a9\u4f60\u9009\u62e9\u6700\u9002\u5408\u7684\u5de5\u5177\u8fdb\u884c\u6570\u636e\u5206\u6790\u3002<\/p>\n\n\n\n<h4 class=\"wp-block-heading\">2. NumPy\uff1a\u57fa\u7840\u7684\u79d1\u5b66\u8ba1\u7b97\u5e93<\/h4>\n\n\n\n<p class=\"wp-block-paragraph\"><strong>NumPy<\/strong> \u662fPython\u4e2d\u6700\u57fa\u7840\u4e5f\u662f\u6700\u91cd\u8981\u7684\u79d1\u5b66\u8ba1\u7b97\u5e93\u4e4b\u4e00\u3002\u5b83\u4e3aPython\u63d0\u4f9b\u4e86\u4e00\u4e2a\u5f3a\u5927\u7684\u591a\u7ef4\u6570\u7ec4\u5bf9\u8c61 <code>ndarray<\/code>\uff0c\u5e76\u4e14\u63d0\u4f9b\u4e86\u4e30\u5bcc\u7684\u6570\u5b66\u3001\u903b\u8f91\u548c\u968f\u673a\u6570\u751f\u6210\u529f\u80fd\u3002<\/p>\n\n\n\n<ul class=\"wp-block-list\">\n<li><strong>NumPy\u7684\u6838\u5fc3\u529f\u80fd<\/strong>\uff1aNumPy\u6700\u5e38\u7528\u7684\u529f\u80fd\u662f\u6570\u7ec4\u5904\u7406\uff0c\u63d0\u4f9b\u4e86\u9ad8\u6548\u7684\u77e9\u9635\u8fd0\u7b97\uff0c\u5e76\u4e14\u652f\u6301\u5927\u91cf\u7684\u6570\u5b66\u51fd\u6570\uff0c\u5982\u77e9\u9635\u4e58\u6cd5\u3001\u7ebf\u6027\u4ee3\u6570\u8fd0\u7b97\u3001\u5085\u91cc\u53f6\u53d8\u6362\u7b49\u3002<\/li>\n\n\n\n<li><strong>\u6570\u7ec4\u64cd\u4f5c<\/strong>\uff1aNumPy\u63d0\u4f9b\u7684 <code>ndarray<\/code> \u5bf9\u8c61\u652f\u6301\u5feb\u901f\u7684\u6570\u7ec4\u5207\u7247\u3001\u7d22\u5f15\u3001\u5e7f\u64ad\u7b49\u64cd\u4f5c\uff0c\u8fd9\u4f7f\u5f97\u6570\u636e\u5206\u6790\u53d8\u5f97\u9ad8\u6548\u4e14\u7075\u6d3b\u3002<\/li>\n\n\n\n<li><strong>\u5927\u89c4\u6a21\u6570\u636e\u5904\u7406<\/strong>\uff1aNumPy\u7279\u522b\u9002\u7528\u4e8e\u5927\u89c4\u6a21\u6570\u636e\u7684\u5904\u7406\uff0c\u56e0\u5176\u9ad8\u6548\u7684\u5185\u5b58\u7ba1\u7406\u548c\u64cd\u4f5c\u6027\u80fd\uff0c\u80fd\u591f\u5904\u7406\u767e\u4e07\u7ea7\u6570\u636e\u96c6\uff0c\u800c\u4e0d\u50cfPython\u539f\u751f\u7684\u5217\u8868\u90a3\u6837\u6d88\u8017\u5927\u91cf\u5185\u5b58\u548c\u65f6\u95f4\u3002<\/li>\n<\/ul>\n\n\n\n<pre class=\"wp-block-code\"><code>import numpy as np\n# \u521b\u5efa\u4e00\u4e2a\u6570\u7ec4\narr = np.array(&#91;1, 2, 3, 4, 5])\nprint(arr * 2)  # \u6bcf\u4e2a\u5143\u7d20\u90fd\u4e58\u4ee52<\/code><\/pre>\n\n\n\n<h4 class=\"wp-block-heading\">3. Pandas\uff1a\u5f3a\u5927\u7684\u6570\u636e\u5904\u7406\u4e0e\u5206\u6790\u5de5\u5177<\/h4>\n\n\n\n<p class=\"wp-block-paragraph\"><strong>Pandas<\/strong> \u662fPython\u4e2d\u6700\u6d41\u884c\u7684\u6570\u636e\u5904\u7406\u548c\u5206\u6790\u5e93\uff0c\u7279\u522b\u9002\u7528\u4e8e\u7ed3\u6784\u5316\u6570\u636e\u3002\u5b83\u4e3b\u8981\u901a\u8fc7\u4e24\u4e2a\u6570\u636e\u7ed3\u6784 <code>Series<\/code> \u548c <code>DataFrame<\/code> \u6765\u5b58\u50a8\u548c\u64cd\u4f5c\u6570\u636e\u3002<\/p>\n\n\n\n<ul class=\"wp-block-list\">\n<li><strong>\u57fa\u672c\u6570\u636e\u7ed3\u6784<\/strong>\uff1a<\/li>\n\n\n\n<li><strong>Series<\/strong>\uff1a\u4e00\u7ef4\u6570\u7ec4\uff0c\u5e26\u6807\u7b7e\u7684\u6570\u7ec4\uff0c\u53ef\u4ee5\u5b58\u50a8\u6574\u6570\u3001\u6d6e\u70b9\u6570\u3001\u5b57\u7b26\u4e32\u7b49\u7c7b\u578b\u7684\u6570\u636e\u3002<\/li>\n\n\n\n<li><strong>DataFrame<\/strong>\uff1a\u4e8c\u7ef4\u6570\u7ec4\uff08\u8868\u683c\uff09\uff0c\u6bcf\u4e00\u5217\u53ef\u4ee5\u662f\u4e0d\u540c\u7684\u6570\u636e\u7c7b\u578b\u3002<\/li>\n\n\n\n<li><strong>\u52a0\u8f7d\u4e0e\u6e05\u7406\u6570\u636e<\/strong>\uff1a<br>Pandas\u652f\u6301\u4ece\u5404\u79cd\u683c\u5f0f\u7684\u6587\u4ef6\uff08\u5982CSV\u3001Excel\u3001SQL\u7b49\uff09\u4e2d\u52a0\u8f7d\u6570\u636e\uff0c\u5e76\u4e14\u63d0\u4f9b\u4e86\u5f3a\u5927\u7684\u6570\u636e\u6e05\u7406\u529f\u80fd\uff0c\u5982\u7f3a\u5931\u503c\u5904\u7406\u3001\u91cd\u590d\u503c\u5220\u9664\u3001\u6570\u636e\u7c7b\u578b\u8f6c\u6362\u7b49\u3002<\/li>\n\n\n\n<li><strong>\u6570\u636e\u900f\u89c6\u4e0e\u805a\u5408<\/strong>\uff1a<br>Pandas\u63d0\u4f9b\u4e86\u7c7b\u4f3cSQL\u7684 <code>groupby<\/code>\u3001<code>pivot<\/code> \u7b49\u529f\u80fd\uff0c\u80fd\u591f\u9ad8\u6548\u5730\u8fdb\u884c\u6570\u636e\u5206\u7ec4\u548c\u805a\u5408\u5206\u6790\u3002<\/li>\n<\/ul>\n\n\n\n<pre class=\"wp-block-code\"><code>import pandas as pd\n# \u521b\u5efa\u4e00\u4e2aDataFrame\ndata = {'Name': &#91;'Alice', 'Bob', 'Charlie'], 'Age': &#91;25, 30, 35]}\ndf = pd.DataFrame(data)\nprint(df)<\/code><\/pre>\n\n\n\n<h4 class=\"wp-block-heading\">4. Matplotlib\uff1a\u6570\u636e\u53ef\u89c6\u5316\u7684\u57fa\u7840\u5e93<\/h4>\n\n\n\n<p class=\"wp-block-paragraph\"><strong>Matplotlib<\/strong> \u662fPython\u4e2d\u6700\u57fa\u7840\u7684\u7ed8\u56fe\u5e93\uff0c\u53ef\u4ee5\u5e2e\u52a9\u7528\u6237\u751f\u6210\u5404\u79cd\u9759\u6001\u3001\u52a8\u6001\u548c\u4ea4\u4e92\u5f0f\u7684\u56fe\u8868\u3002<\/p>\n\n\n\n<ul class=\"wp-block-list\">\n<li><strong>\u57fa\u7840\u56fe\u8868\u7ed8\u5236<\/strong>\uff1aMatplotlib\u652f\u6301\u591a\u79cd\u56fe\u8868\u7c7b\u578b\uff0c\u5982\u7ebf\u56fe\u3001\u67f1\u72b6\u56fe\u3001\u6563\u70b9\u56fe\u3001\u997c\u56fe\u7b49\u3002\u5b83\u975e\u5e38\u9002\u5408\u7ed8\u5236\u5404\u79cd\u57fa\u7840\u6570\u636e\u53ef\u89c6\u5316\u56fe\u8868\u3002<\/li>\n\n\n\n<li><strong>\u5b9a\u5236\u5316<\/strong>\uff1aMatplotlib\u63d0\u4f9b\u4e86\u4e30\u5bcc\u7684API\uff0c\u53ef\u4ee5\u5bf9\u56fe\u8868\u7684\u5404\u4e2a\u90e8\u5206\u8fdb\u884c\u5b9a\u5236\uff0c\u5982\u56fe\u4f8b\u3001\u6807\u9898\u3001\u6807\u7b7e\u3001\u5750\u6807\u8f74\u7b49\u3002<\/li>\n\n\n\n<li><strong>\u96c6\u6210\u4e0e\u4ea4\u4e92<\/strong>\uff1aMatplotlib\u4e0eJupyter Notebook\u9ad8\u5ea6\u96c6\u6210\uff0c\u53ef\u4ee5\u5728Notebook\u4e2d\u4ea4\u4e92\u5f0f\u5730\u663e\u793a\u56fe\u8868\u3002<\/li>\n<\/ul>\n\n\n\n<pre class=\"wp-block-code\"><code>import matplotlib.pyplot as plt\nimport numpy as np\n# \u521b\u5efa\u6570\u636e\nx = np.linspace(0, 10, 100)\ny = np.sin(x)\n# \u7ed8\u5236\u56fe\u8868\nplt.plot(x, y)\nplt.title('Sine Wave')\nplt.xlabel('X')\nplt.ylabel('Y')\nplt.show()<\/code><\/pre>\n\n\n\n<h4 class=\"wp-block-heading\">5. Seaborn\uff1a\u9ad8\u7ea7\u6570\u636e\u53ef\u89c6\u5316\u5e93<\/h4>\n\n\n\n<p class=\"wp-block-paragraph\"><strong>Seaborn<\/strong> \u662f\u57fa\u4e8eMatplotlib\u7684\u9ad8\u7ea7\u53ef\u89c6\u5316\u5e93\uff0c\u63d0\u4f9b\u4e86\u66f4\u4e3a\u7b80\u6d01\u7684\u63a5\u53e3\u548c\u66f4\u7f8e\u89c2\u7684\u56fe\u8868\u98ce\u683c\u3002<\/p>\n\n\n\n<ul class=\"wp-block-list\">\n<li><strong>\u7edf\u8ba1\u56fe\u8868\u7ed8\u5236<\/strong>\uff1aSeaborn\u4e13\u6ce8\u4e8e\u7edf\u8ba1\u6570\u636e\u7684\u53ef\u89c6\u5316\uff0c\u80fd\u591f\u975e\u5e38\u65b9\u4fbf\u5730\u7ed8\u5236\u70ed\u529b\u56fe\u3001\u7bb1\u7ebf\u56fe\u3001\u56de\u5f52\u56fe\u7b49\u3002<\/li>\n\n\n\n<li><strong>\u96c6\u6210Pandas\u6570\u636e\u7ed3\u6784<\/strong>\uff1aSeaborn\u4e0ePandas\u7684 <code>DataFrame<\/code> \u6570\u636e\u7ed3\u6784\u6709\u5f88\u597d\u7684\u517c\u5bb9\u6027\uff0c\u53ef\u4ee5\u76f4\u63a5\u4f20\u5165 <code>DataFrame<\/code> \u8fdb\u884c\u7ed8\u56fe\u3002<\/li>\n\n\n\n<li><strong>\u8272\u5f69\u7ba1\u7406\u4e0e\u4e3b\u9898<\/strong>\uff1aSeaborn\u63d0\u4f9b\u4e86\u8bb8\u591a\u9884\u8bbe\u7684\u8272\u5f69\u8c03\u8272\u677f\u548c\u56fe\u8868\u6837\u5f0f\uff0c\u53ef\u4ee5\u5e2e\u52a9\u7528\u6237\u66f4\u8f7b\u677e\u5730\u521b\u5efa\u7f8e\u89c2\u7684\u56fe\u8868\u3002<\/li>\n<\/ul>\n\n\n\n<pre class=\"wp-block-code\"><code>import seaborn as sns\n# \u4f7f\u7528Seaborn\u7ed8\u5236\u56de\u5f52\u56fe\nsns.set(style=\"whitegrid\")\ntips = sns.load_dataset(\"tips\")\nsns.regplot(x=\"total_bill\", y=\"tip\", data=tips)\nplt.show()<\/code><\/pre>\n\n\n\n<h4 class=\"wp-block-heading\">6. SciPy\uff1a\u7528\u4e8e\u79d1\u5b66\u8ba1\u7b97\u7684\u5e93<\/h4>\n\n\n\n<p class=\"wp-block-paragraph\"><strong>SciPy<\/strong> \u662f\u4e00\u4e2a\u5f00\u6e90\u7684Python\u5e93\uff0c\u4e13\u95e8\u7528\u4e8e\u6570\u5b66\u3001\u79d1\u5b66\u548c\u5de5\u7a0b\u8ba1\u7b97\uff0c\u5c24\u5176\u662f\u4e0e\u6570\u503c\u79ef\u5206\u3001\u4f18\u5316\u3001\u4fe1\u53f7\u5904\u7406\u7b49\u76f8\u5173\u7684\u529f\u80fd\u3002<\/p>\n\n\n\n<ul class=\"wp-block-list\">\n<li><strong>\u4e0eNumPy\u7ed3\u5408\u4f7f\u7528<\/strong>\uff1aSciPy\u5efa\u7acb\u5728NumPy\u4e4b\u4e0a\uff0c\u63d0\u4f9b\u4e86\u5927\u91cf\u7684\u9ad8\u7ea7\u6570\u5b66\u548c\u79d1\u5b66\u8ba1\u7b97\u529f\u80fd\uff0c\u5982\u79ef\u5206\u3001\u4f18\u5316\u3001\u63d2\u503c\u7b49\u3002<\/li>\n\n\n\n<li><strong>\u7edf\u8ba1\u5206\u6790<\/strong>\uff1aSciPy\u63d0\u4f9b\u4e86\u4e30\u5bcc\u7684\u7edf\u8ba1\u5206\u5e03\u3001\u5047\u8bbe\u68c0\u9a8c\u3001\u968f\u673a\u6570\u751f\u6210\u7b49\u529f\u80fd\u3002<\/li>\n<\/ul>\n\n\n\n<pre class=\"wp-block-code\"><code>from scipy import stats\n# \u8fdb\u884ct\u68c0\u9a8c\ndata1 = &#91;1, 2, 3, 4, 5]\ndata2 = &#91;6, 7, 8, 9, 10]\nt_stat, p_value = stats.ttest_ind(data1, data2)\nprint(f\"T-statistic: {t_stat}, P-value: {p_value}\")<\/code><\/pre>\n\n\n\n<h4 class=\"wp-block-heading\">7. Scikit-learn\uff1a\u673a\u5668\u5b66\u4e60\u4e0e\u6570\u636e\u5efa\u6a21<\/h4>\n\n\n\n<p class=\"wp-block-paragraph\"><strong>Scikit-learn<\/strong> \u662fPython\u4e2d\u6700\u53d7\u6b22\u8fce\u7684\u673a\u5668\u5b66\u4e60\u5e93\uff0c\u5b83\u63d0\u4f9b\u4e86\u4e30\u5bcc\u7684\u673a\u5668\u5b66\u4e60\u7b97\u6cd5\u548c\u5de5\u5177\uff0c\u80fd\u591f\u7528\u4e8e\u5206\u7c7b\u3001\u56de\u5f52\u3001\u805a\u7c7b\u7b49\u4efb\u52a1\u3002<\/p>\n\n\n\n<ul class=\"wp-block-list\">\n<li><strong>\u673a\u5668\u5b66\u4e60\u7b97\u6cd5<\/strong>\uff1a\u5305\u62ec\u7ebf\u6027\u56de\u5f52\u3001\u652f\u6301\u5411\u91cf\u673a\u3001\u51b3\u7b56\u6811\u3001KNN\u3001\u968f\u673a\u68ee\u6797\u3001\u805a\u7c7b\u7b97\u6cd5\u7b49\u3002<\/li>\n\n\n\n<li><strong>\u6570\u636e\u9884\u5904\u7406<\/strong>\uff1aScikit-learn\u63d0\u4f9b\u4e86\u6570\u636e\u9884\u5904\u7406\u5de5\u5177\uff0c\u5982\u6807\u51c6\u5316\u3001\u5f52\u4e00\u5316\u3001\u7f3a\u5931\u503c\u586b\u8865\u3001\u7279\u5f81\u9009\u62e9\u7b49\u3002<\/li>\n\n\n\n<li><strong>\u6a21\u578b\u8bc4\u4f30\u4e0e\u9009\u62e9<\/strong>\uff1a\u63d0\u4f9b\u4e86\u4ea4\u53c9\u9a8c\u8bc1\u3001\u7f51\u683c\u641c\u7d22\u7b49\u5de5\u5177\u6765\u9009\u62e9\u548c\u8bc4\u4f30\u6a21\u578b\u3002<\/li>\n<\/ul>\n\n\n\n<pre class=\"wp-block-code\"><code>from sklearn.ensemble import RandomForestClassifier\nfrom sklearn.model_selection import train_test_split\nfrom sklearn.datasets import load_iris\n\n# \u52a0\u8f7d\u6570\u636e\u96c6\niris = load_iris()\nX, y = iris.data, iris.target\nX_train, X_test, y_train, y_test = train_test_split(X, y, test_size=0.3)\n\n# \u8bad\u7ec3\u6a21\u578b\nmodel = RandomForestClassifier()\nmodel.fit(X_train, y_train)\nprint(f\"Accuracy: {model.score(X_test, y_test)}\")<\/code><\/pre>\n\n\n\n<h4 class=\"wp-block-heading\">8. Statsmodels\uff1a\u7edf\u8ba1\u5efa\u6a21\u4e0e\u56de\u5f52\u5206\u6790<\/h4>\n\n\n\n<p class=\"wp-block-paragraph\"><strong>Statsmodels<\/strong> \u662f\u7528\u4e8e\u7edf\u8ba1\u5efa\u6a21\u548c\u6570\u636e\u5206\u6790\u7684Python\u5e93\uff0c\u7279\u522b\u9002\u7528\u4e8e\u56de\u5f52\u5206\u6790\u3001\u65f6\u95f4\u5e8f\u5217\u5206\u6790\u548c\u5047\u8bbe\u68c0\u9a8c\u3002<\/p>\n\n\n\n<ul class=\"wp-block-list\">\n<li><strong>\u56de\u5f52\u5206\u6790<\/strong>\uff1a\u652f\u6301\u7ebf\u6027\u56de\u5f52\u3001\u5e7f\u4e49\u7ebf\u6027\u56de\u5f52\u3001\u5cad\u56de\u5f52\u3001Lasso\u56de\u5f52\u7b49\u3002<\/li>\n\n\n\n<li><strong>\u65f6\u95f4\u5e8f\u5217\u5206\u6790<\/strong>\uff1aStatsmodels\u63d0\u4f9b\u4e86\u5f3a\u5927\u7684\u65f6\u95f4\u5e8f\u5217\u5efa\u6a21\u529f\u80fd\uff0c\u5982ARIMA\u3001GARCH\u7b49\u6a21\u578b\u3002<\/li>\n\n\n\n<li><strong>\u5047\u8bbe\u68c0\u9a8c<\/strong>\uff1a\u63d0\u4f9b\u4e86\u591a\u79cd\u5047\u8bbe\u68c0\u9a8c\u65b9\u6cd5\uff0c\u5982t\u68c0\u9a8c\u3001\u5361\u65b9\u68c0\u9a8c\u7b49\u3002<\/li>\n<\/ul>\n\n\n\n<pre class=\"wp-block-code\"><code>import statsmodels.api as sm\n# \u52a0\u8f7d\u793a\u4f8b\u6570\u636e\u96c6\ndata = sm.datasets.get_rdataset('mtcars').data\nX = data&#91;&#91;'mpg', 'hp']]\nX = sm.add_constant(X)  # \u52a0\u4e0a\u5e38\u6570\u9879\ny = data&#91;'qsec']\nmodel = sm.OLS(y, X)\nresults = model.fit()\nprint(results.summary())<\/code><\/pre>\n\n\n\n<h4 class=\"wp-block-heading\">9. OpenCV\uff1a\u8ba1\u7b97\u673a\u89c6\u89c9\u5206\u6790<\/h4>\n\n\n\n<p class=\"wp-block-paragraph\"><strong>OpenCV<\/strong> \u662f\u4e00\u4e2a\u5e7f\u6cdb\u5e94\u7528\u4e8e\u8ba1\u7b97\u673a\u89c6\u89c9\u9886\u57df\u7684\u5e93\uff0c\u80fd\u591f\u5904\u7406\u56fe\u50cf\u548c\u89c6\u9891\u6570\u636e\uff0c\u652f\u6301\u56fe\u50cf\u8bc6\u522b\u3001\u76ee\u6807\u8ddf\u8e2a\u3001\u56fe\u50cf\u5904\u7406\u7b49\u4efb\u52a1\u3002<\/p>\n\n\n\n<ul class=\"wp-block-list\">\n<li><strong>\u56fe\u50cf\u5904\u7406<\/strong>\uff1aOpenCV\u63d0\u4f9b\u4e86\u4e30\u5bcc\u7684\u56fe\u50cf\u5904\u7406\u529f\u80fd\uff0c\u5982\u6ee4\u6ce2\u3001\u8fb9\u7f18\u68c0\u6d4b\u3001\u7279\u5f81\u5339\u914d\u7b49\u3002<\/li>\n\n\n\n<li><strong>\u8ba1\u7b97\u673a\u89c6\u89c9\u5e94\u7528<\/strong>\uff1aOpenCV\u5e7f\u6cdb\u5e94\u7528\u4e8e\u56fe\u50cf\u8bc6\u522b\u3001\u76ee\u6807\u8ddf\u8e2a\u3001\u4eba\u8138\u68c0\u6d4b\u7b49\u9886\u57df\u3002<\/li>\n<\/ul>\n\n\n\n<pre class=\"wp-block-code\"><code>import cv2\n# \u52a0\u8f7d\u56fe\u50cf\nimage = cv2.imread('image.jpg')\n# \u8f6c\u4e3a\u7070\u5ea6\u56fe\ngray_image = cv2.cvtColor(image, cv2.COLOR_BGR2GRAY)\ncv2.imshow('Gray Image', gray_image)\ncv2.waitKey(0)\ncv2.destroyAllWindows()<\/code><\/pre>\n\n\n\n<p class=\"wp-block-paragraph\"><\/p>\n\n\n\n<p class=\"wp-block-paragraph\">\u638c\u63e1\u8fd9\u4e9b\u5e38\u7528\u5e93\u5c06\u5927\u5927\u63d0\u9ad8\u4f60\u7684\u6570\u636e\u5206\u6790\u6548\u7387\uff0c\u4f7f\u4f60\u5728\u5b9e\u9645\u9879\u76ee\u4e2d\u6e38\u5203\u6709\u4f59\u3002<\/p>\n","protected":false},"excerpt":{"rendered":"<p>Python\u7684\u6570\u636e\u5206\u6790\u5e93\u79cd\u7c7b\u7e41\u591a\uff0c\u6db5\u76d6\u4e86\u4ece\u6570\u636e\u5904\u7406\u3001\u5206\u6790\u5230\u53ef\u89c6\u5316\u3001\u673a\u5668\u5b66\u4e60\u7b49\u591a\u4e2a\u65b9\u9762\u3002\u5728\u9009\u62e9\u5de5\u5177\u65f6\uff0c\u6839\u636e\u5177\u4f53\u7684 [&hellip;]<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[54],"tags":[],"class_list":["post-855","post","type-post","status-publish","format-standard","hentry","category-python"],"_links":{"self":[{"href":"https:\/\/www.laixuexila.com\/index.php\/wp-json\/wp\/v2\/posts\/855","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/www.laixuexila.com\/index.php\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.laixuexila.com\/index.php\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.laixuexila.com\/index.php\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/www.laixuexila.com\/index.php\/wp-json\/wp\/v2\/comments?post=855"}],"version-history":[{"count":1,"href":"https:\/\/www.laixuexila.com\/index.php\/wp-json\/wp\/v2\/posts\/855\/revisions"}],"predecessor-version":[{"id":856,"href":"https:\/\/www.laixuexila.com\/index.php\/wp-json\/wp\/v2\/posts\/855\/revisions\/856"}],"wp:attachment":[{"href":"https:\/\/www.laixuexila.com\/index.php\/wp-json\/wp\/v2\/media?parent=855"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.laixuexila.com\/index.php\/wp-json\/wp\/v2\/categories?post=855"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.laixuexila.com\/index.php\/wp-json\/wp\/v2\/tags?post=855"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}