{"id":1316,"date":"2023-03-25T10:12:45","date_gmt":"2023-03-25T02:12:45","guid":{"rendered":""},"modified":"2023-03-25T10:12:45","modified_gmt":"2023-03-25T02:12:45","slug":"\u5206\u6790\u65f6\u95f4\u5e8f\u5217\u6570\u636e","status":"publish","type":"post","link":"https:\/\/bianchenghao6.com\/1316.html","title":{"rendered":"\u5206\u6790\u65f6\u95f4\u5e8f\u5217\u6570\u636e"},"content":{"rendered":"


\n <\/head>
\n <\/p>\n

\n

\u5206\u6790\u65f6\u95f4\u5e8f\u5217\u6570\u636e<\/h1>\n

\u5206\u6790\u65f6\u95f4\u5e8f\u5217\u6570\u636e\u8be6\u7ec6\u64cd\u4f5c\u6559\u7a0b<\/span>\n <\/div>\n

\n \u9884\u6d4b\u7ed9\u5b9a\u8f93\u5165\u5e8f\u5217\u4e2d\u7684\u4e0b\u4e00\u4e2a\u662f\u673a\u5668\u5b66\u4e60\u4e2d\u7684\u53e6\u4e00\u4e2a\u91cd\u8981\u6982\u5ff5\u3002 \u672c\u7ae0\u4e3a\u60a8\u63d0\u4f9b\u6709\u5173\u5206\u6790\u65f6\u95f4\u5e8f\u5217\u6570\u636e\u7684\u8be6\u7ec6\u8bf4\u660e\u3002\n <\/div>\n

\u65f6\u95f4\u5e8f\u5217\u6570\u636e\u4ecb\u7ecd<\/h2>\n
\n \u65f6\u95f4\u5e8f\u5217\u6570\u636e\u8868\u793a\u5904\u4e8e\u4e00\u7cfb\u5217\u7279\u5b9a\u65f6\u95f4\u95f4\u9694\u7684\u6570\u636e\u3002 \u5982\u679c\u6211\u4eec\u60f3\u5728\u673a\u5668\u5b66\u4e60\u4e2d\u6784\u5efa\u5e8f\u5217\u9884\u6d4b\uff0c\u90a3\u4e48\u5fc5\u987b\u5904\u7406\u8fde\u7eed\u7684\u6570\u636e\u548c\u65f6\u95f4\u3002 \u7cfb\u5217\u6570\u636e\u662f\u8fde\u7eed\u6570\u636e\u7684\u6458\u8981\u3002 \u6570\u636e\u6392\u5e8f\u662f\u987a\u5e8f\u6570\u636e\u7684\u4e00\u4e2a\u91cd\u8981\u7279\u5f81\u3002\n <\/div>\n
\n \u5e8f\u5217\u5206\u6790\u6216\u65f6\u95f4\u5e8f\u5217\u5206\u6790\u7684\u57fa\u672c\u6982\u5ff5<\/strong>\n <\/div>\n
\n \u5e8f\u5217\u5206\u6790\u6216\u65f6\u95f4\u5e8f\u5217\u5206\u6790\u662f\u57fa\u4e8e\u5148\u524d\u89c2\u5bdf\u5230\u7684\u9884\u6d4b\u7ed9\u5b9a\u8f93\u5165\u5e8f\u5217\u4e2d\u7684\u4e0b\u4e00\u4e2a\u3002 \u9884\u6d4b\u53ef\u4ee5\u662f\u4efb\u4f55\u53ef\u80fd\u63a5\u4e0b\u6765\u7684\u4e8b\u60c5:\u7b26\u53f7\uff0c\u6570\u5b57\uff0c\u6b21\u65e5\u5929\u6c14\uff0c\u4e0b\u4e00\u4e2a\u6f14\u8bb2\u7b49\u3002\u5e8f\u5217\u5206\u6790\u5728\u8bf8\u5982\u80a1\u7968\u5e02\u573a\u5206\u6790\uff0c\u5929\u6c14\u9884\u62a5\u548c\u4ea7\u54c1\u63a8\u8350\u7b49\u5e94\u7528\u4e2d\u975e\u5e38\u6709\u7528\u3002\n <\/div>\n
\n \u5b9e\u4f8b<\/strong>\n <\/div>\n
\n \u8003\u8651\u4e0b\u9762\u7684\u4f8b\u5b50\u6765\u7406\u89e3\u5e8f\u5217\u9884\u6d4b\u3002 \u8fd9\u91ccA\uff0cB\uff0cC\uff0cD\u662f\u7ed9\u5b9a\u503c\uff0c\u5e76\u4e14\u5fc5\u987b\u4f7f\u7528\u5e8f\u5217\u9884\u6d4b\u6a21\u578b\u9884\u6d4b\u503cE\u3002\n <\/div>\n
\n \u5206\u6790\u65f6\u95f4\u5e8f\u5217\u6570\u636e_https:\/\/bianchenghao6.com_\u3010\u4eba\u5de5\u667a\u80fd\u6559\u7a0b\u3011_\u7b2c1\u5f20\n <\/div>\n

\u5b89\u88c5\u6709\u7528\u7684\u5305<\/h2>\n
\n \u5bf9\u4e8e\u4f7f\u7528Python\u8fdb\u884c\u65f6\u95f4\u5e8f\u5217\u6570\u636e\u5206\u6790\uff0c\u6211\u4eec\u9700\u8981\u5b89\u88c5\u4ee5\u4e0b\u8f6f\u4ef6\u5305 -\n <\/div>\n
\n Pandas<\/strong>\n <\/div>\n
\n Pandas\u662f\u4e00\u4e2a\u5f00\u6e90\u7684BSD\u8bb8\u53ef\u5e93\uff0c\u5b83\u4e3aPython\u63d0\u4f9b\u4e86\u9ad8\u6027\u80fd\uff0c\u7b80\u4fbf\u7684\u6570\u636e\u7ed3\u6784\u4f7f\u7528\u548c\u6570\u636e\u5206\u6790\u5de5\u5177\u3002\n <\/div>\n
\n \u6709\u5173Pandas\u6559\u7a0b\uff0c\u8bf7\u8bbf\u95ee\u4ee5\u4e0b\u7f51\u5740:
\n https:\/\/www.lidihuo.com\/pandas\/pandas-index.html\n <\/div>\n
\n \u4f7f\u7528\u4ee5\u4e0b\u547d\u4ee4\u5b89\u88c5Pandas -\n <\/div>\n
\n
 # Filename : example.py<\/span>
# Copyright : 2020 By Lidihuo<\/span>
# Author by : www.lidihuo.com<\/span>
# Date : 2020-08-26<\/span>
pip install pandas
<\/span><\/code><\/pre>\n<\/p><\/div>\n
\n \u5982\u679c\u60a8\u4f7f\u7528\u7684\u662fAnaconda\u5e76\u5e0c\u671b\u4f7f\u7528conda\u8f6f\u4ef6\u5305\u7ba1\u7406\u5668\u8fdb\u884c\u5b89\u88c5\uff0c\u90a3\u4e48\u53ef\u4ee5\u4f7f\u7528\u4ee5\u4e0b\u547d\u4ee4 -\n <\/div>\n
\n
 # Filename : example.py<\/span>
# Copyright : 2020 By Lidihuo<\/span>
# Author by : www.lidihuo.com<\/span>
# Date : 2020-08-26<\/span>
conda install -c anaconda pandas
<\/span><\/code><\/pre>\n<\/p><\/div>\n
\n hmmlearn<\/strong>\n <\/div>\n
\n \u5b83\u662f\u4e00\u4e2a\u5f00\u6e90BSD\u8bb8\u53ef\u7684\u5e93\uff0c\u5b83\u7531\u7b80\u5355\u7684\u7b97\u6cd5\u548c\u6a21\u578b\u7ec4\u6210\uff0c\u7528\u4e8e\u5b66\u4e60Python\u4e2d\u7684\u9690\u9a6c\u5c14\u53ef\u592b\u6a21\u578b(HMM)\u3002 \u4f7f\u7528\u4ee5\u4e0b\u547d\u4ee4\u5b89\u88c5\u5b83 -\n <\/div>\n
\n
 # Filename : example.py<\/span>
# Copyright : 2020 By Lidihuo<\/span>
# Author by : www.lidihuo.com<\/span>
# Date : 2020-08-26<\/span>
pip install hmmlearn
<\/span><\/code><\/pre>\n<\/p><\/div>\n
\n \u5982\u679c\u60a8\u4f7f\u7528\u7684\u662fAnaconda\u5e76\u5e0c\u671b\u4f7f\u7528conda\u8f6f\u4ef6\u5305\u7ba1\u7406\u5668\u8fdb\u884c\u5b89\u88c5\uff0c\u90a3\u4e48\u53ef\u4ee5\u4f7f\u7528\u4ee5\u4e0b\u547d\u4ee4 -\n <\/div>\n
\n
 # Filename : example.py<\/span>
# Copyright : 2020 By Lidihuo<\/span>
# Author by : www.lidihuo.com<\/span>
# Date : 2020-08-26<\/span>
conda install -c anaconda hmmlearn
<\/span><\/code><\/pre>\n<\/p><\/div>\n
\n PyStruct<\/strong>\n <\/div>\n
\n \u5b83\u662f\u4e00\u4e2a\u7ed3\u6784\u5316\u7684\u5b66\u4e60\u548c\u9884\u6d4b\u5e93\u3002 \u5728PyStruct\u4e2d\u5b9e\u73b0\u7684\u5b66\u4e60\u7b97\u6cd5\u5177\u6709\u8bf8\u5982\u6761\u4ef6\u968f\u673a\u573a(CRF)\uff0c\u6700\u5927\u503c - \u9a6c\u5c14\u79d1\u592b\u968f\u673a\u7f51\u7edc(M3N)\u6216\u7ed3\u6784\u652f\u6301\u5411\u91cf\u673a\u7b49\u540d\u79f0\u3002\u4f7f\u7528\u4ee5\u4e0b\u547d\u4ee4\u6765\u5b89\u88c5\u5b83 -\n <\/div>\n
\n
 # Filename : example.py<\/span>
# Copyright : 2020 By Lidihuo<\/span>
# Author by : www.lidihuo.com<\/span>
# Date : 2020-08-26<\/span>
pip install pystruct
<\/span><\/code><\/pre>\n<\/p><\/div>\n
\n CVXOPT<\/strong>\n <\/div>\n
\n \u5b83\u7528\u4e8e\u57fa\u4e8ePython\u7f16\u7a0b\u8bed\u8a00\u7684\u51f8\u4f18\u5316\u3002 \u5b83\u4e5f\u662f\u4e00\u4e2a\u514d\u8d39\u7684\u8f6f\u4ef6\u5305\u3002 \u4f7f\u7528\u4ee5\u4e0b\u547d\u4ee4\u6765\u5b89\u88c5\u5b83 -\n <\/div>\n
\n
 # Filename : example.py<\/span>
# Copyright : 2020 By Lidihuo<\/span>
# Author by : www.lidihuo.com<\/span>
# Date : 2020-08-26<\/span>
pip install cvxopt
<\/span><\/code><\/pre>\n<\/p><\/div>\n
\n \u5982\u679c\u60a8\u4f7f\u7528\u7684\u662fAnaconda\u5e76\u5e0c\u671b\u4f7f\u7528conda\u8f6f\u4ef6\u5305\u7ba1\u7406\u5668\u8fdb\u884c\u5b89\u88c5\uff0c\u90a3\u4e48\u53ef\u4ee5\u4f7f\u7528\u4ee5\u4e0b\u547d\u4ee4 -\n <\/div>\n
\n
 # Filename : example.py<\/span>
# Copyright : 2020 By Lidihuo<\/span>
# Author by : www.lidihuo.com<\/span>
# Date : 2020-08-26<\/span>
conda install -c anaconda cvdoxt
<\/span><\/code><\/pre>\n<\/p><\/div>\n

Pandas:\u4ece\u65f6\u95f4\u5e8f\u5217\u6570\u636e\u4e2d\u5904\u7406\uff0c\u5206\u5272\u548c\u63d0\u53d6\u7edf\u8ba1\u4fe1\u606f<\/h2>\n
\n \u5982\u679c\u5fc5\u987b\u4f7f\u7528\u65f6\u95f4\u5e8f\u5217\u6570\u636e\uff0cPandas\u662f\u4e00\u4e2a\u975e\u5e38\u6709\u7528\u7684\u5de5\u5177\u3002 \u5728Pandas\u7684\u5e2e\u52a9\u4e0b\uff0c\u53ef\u4ee5\u6267\u884c\u4ee5\u4e0b\u64cd\u4f5c -\n <\/div>\n

\u4f7f\u7528pd.date_range\u5305\u521b\u5efa\u4e00\u7cfb\u5217\u65e5\u671f<\/span>
\n \u901a\u8fc7\u4f7f\u7528pd.Series\u5305\u5bf9\u5e26\u6709\u65e5\u671f\u6570\u636e\u8fdb\u884c\u7d22\u5f15<\/span>
\n \u4f7f\u7528ts.resample\u5305\u6267\u884c\u91cd\u65b0\u91c7\u6837<\/span>
\n \u6539\u53d8\u9891\u7387<\/span> <\/p>\n

\n \u793a\u4f8b<\/strong>\n <\/div>\n
\n \u4ee5\u4e0b\u793a\u4f8b\u663e\u793a\u4f7f\u7528Pandas\u5904\u7406\u548c\u5206\u5272\u65f6\u95f4\u5e8f\u5217\u6570\u636e\u3002 \u8bf7\u6ce8\u610f\uff0c\u8fd9\u91cc\u4f7f\u7528\u6708\u5ea6\u5317\u6781\u6d9b\u52a8\u6570\u636e\uff0c\u53ef\u4ee5\u4ecemonthly.ao.index.b50.current.ascii\u4e0b\u8f7d\u5e76\u53ef\u4ee5\u8f6c\u6362\u4e3a\u6587\u672c\u683c\u5f0f\u3002\n <\/div>\n
\n \u5904\u7406\u65f6\u95f4\u5e8f\u5217\u6570\u636e<\/strong>\n <\/div>\n
\n \u8981\u5904\u7406\u65f6\u95f4\u5e8f\u5217\u6570\u636e\uff0c\u60a8\u5fc5\u987b\u6267\u884c\u4ee5\u4e0b\u6b65\u9aa4 -\n <\/div>\n
\n \u7b2c1\u6b65<\/strong> \uff0c\u5bfc\u5165\u4ee5\u4e0b\u8f6f\u4ef6\u5305 -\n <\/div>\n
\n
 # Filename : example.py<\/span>
# Copyright : 2020 By Lidihuo<\/span>
# Author by : www.lidihuo.com<\/span>
# Date : 2020-08-26<\/span>
import <\/span>numpy as <\/span>np
import <\/span>matplotlib.pyplot as <\/span>plt
import <\/span>pandas <\/span>as <\/span>pd
<\/span><\/code><\/pre>\n<\/p><\/div>\n
\n \u63a5\u4e0b\u6765\uff0c\u5b9a\u4e49\u4e00\u4e2a\u51fd\u6570\uff0c\u5b83\u5c06\u4ece\u8f93\u5165\u6587\u4ef6\u4e2d\u8bfb\u53d6\u6570\u636e\uff0c\u5982\u4ee5\u4e0b\u4ee3\u7801\u6240\u793a -\n <\/div>\n
\n
 # Filename : example.py<\/span>
# Copyright : 2020 By Lidihuo<\/span>
# Author by : www.lidihuo.com<\/span>
# Date : 2020-08-26<\/span>
def <\/span>read_data(input_file):
   input_data = np.loadtxt<\/span>(input_file, delimiter = None)
<\/span><\/code><\/pre>\n<\/p><\/div>\n
\n \u73b0\u5728\uff0c\u5c06\u8fd9\u4e9b\u6570\u636e\u8f6c\u6362\u4e3a\u65f6\u95f4\u5e8f\u5217\u3002 \u4e3a\u6b64\uff0c\u8bf7\u521b\u5efa\u65f6\u95f4\u5e8f\u5217\u7684\u65e5\u671f\u8303\u56f4\u3002 \u5728\u8fd9\u4e2a\u4f8b\u5b50\u4e2d\uff0c\u6211\u4eec\u4fdd\u7559\u4e00\u4e2a\u6708\u7684\u6570\u636e\u9891\u7387\u3002 \u6587\u4ef6\u4e2d\u662f\u5b58\u50a8\u4ece1950\u5e741\u6708\u5f00\u59cb\u7684\u6570\u636e\u3002\n <\/div>\n
\n
 # Filename : example.py<\/span>
# Copyright : 2020 By Lidihuo<\/span>
# Author by : www.lidihuo.com<\/span>
# Date : 2020-08-26<\/span>
dates = pd.date_range<\/span>('1950-01'<\/span>, periods = input_data.shape[0], freq = 'M'<\/span>)
<\/span><\/code><\/pre>\n<\/p><\/div>\n
\n \u5728\u8fd9\u4e00\u6b65\u4e2d\uff0c\u5728Pandas Series\u7684\u5e2e\u52a9\u4e0b\u521b\u5efa\u65f6\u95f4\u5e8f\u5217\u6570\u636e\uff0c\u5982\u4e0b\u6240\u793a -\n <\/div>\n
\n
 # Filename : example.py<\/span>
# Copyright : 2020 By Lidihuo<\/span>
# Author by : www.lidihuo.com<\/span>
# Date : 2020-08-26<\/span>
output = pd.Series<\/span>(input_data[:, index], index = dates)
return <\/span>output
if <\/span>__name__=='__main__'<\/span>:
<\/span><\/code><\/pre>\n<\/p><\/div>\n
\n \u5982\u4e0b\u6240\u793a\uff0c\u6307\u5b9a\u8f93\u5165\u6587\u4ef6\u7684\u8def\u5f84 -\n <\/div>\n
\n
 # Filename : example.py<\/span>
# Copyright : 2020 By Lidihuo<\/span>
# Author by : www.lidihuo.com<\/span>
# Date : 2020-08-26<\/span>
input_file = \"\/Users\/admin\/AO.txt\"<\/span>
<\/span><\/code><\/pre>\n<\/p><\/div>\n
\n \u73b0\u5728\uff0c\u5c06\u5217\u8f6c\u6362\u4e3a\u65f6\u95f4\u5e8f\u5217\u683c\u5f0f\uff0c\u5982\u4e0b\u6240\u793a -\n <\/div>\n
\n
 # Filename : example.py<\/span>
# Copyright : 2020 By Lidihuo<\/span>
# Author by : www.lidihuo.com<\/span>
# Date : 2020-08-26<\/span>
timeseries = read_data(input_file)
<\/span><\/code><\/pre>\n<\/p><\/div>\n
\n \u6700\u540e\uff0c\u4f7f\u7528\u663e\u793a\u7684\u547d\u4ee4\u7ed8\u5236\u5e76\u53ef\u89c6\u5316\u6570\u636e -\n <\/div>\n
\n
 # Filename : example.py<\/span>
# Copyright : 2020 By Lidihuo<\/span>
# Author by : www.lidihuo.com<\/span>
# Date : 2020-08-26<\/span>
plt.figure<\/span>()
timeseries.plot<\/span>()
plt.show<\/span>()
<\/span><\/code><\/pre>\n<\/p><\/div>\n
\n \u89c2\u5bdf\u5982\u4e0b\u56fe\u6240\u793a -\n <\/div>\n
\n \u5206\u6790\u65f6\u95f4\u5e8f\u5217\u6570\u636e_https:\/\/bianchenghao6.com_\u3010\u4eba\u5de5\u667a\u80fd\u6559\u7a0b\u3011_\u7b2c2\u5f20\n <\/div>\n
\n \u5206\u6790\u65f6\u95f4\u5e8f\u5217\u6570\u636e_https:\/\/bianchenghao6.com_\u3010\u4eba\u5de5\u667a\u80fd\u6559\u7a0b\u3011_\u7b2c3\u5f20\n <\/div>\n
\n \u5207\u7247\u65f6\u95f4\u5e8f\u5217\u6570\u636e<\/strong>\u5207\u7247\u6d89\u53ca\u4ec5\u68c0\u7d22\u65f6\u95f4\u5e8f\u5217\u6570\u636e\u7684\u4e00\u90e8\u5206\u3002 \u4f5c\u4e3a\u793a\u4f8b\u7684\u4e00\u90e8\u5206\uff0c\u6211\u4eec\u4ec5\u57281980\u5e74\u52301990\u5e74\u95f4\u5bf9\u6570\u636e\u8fdb\u884c\u5206\u5272\u3002\u8bf7\u6ce8\u610f\u4ee5\u4e0b\u6267\u884c\u6b64\u4efb\u52a1\u7684\u4ee3\u7801 -\n <\/div>\n
\n
 # Filename : example.py<\/span>
# Copyright : 2020 By Lidihuo<\/span>
# Author by : www.lidihuo.com<\/span>
# Date : 2020-08-26<\/span>
timeseries['1980'<\/span>:'1990'<\/span>].plot<\/span>()
   <matplotlib.axes._subplots.AxesSubplot at 0xa0e4b00>
plt.show<\/span>()
<\/span><\/code><\/pre>\n<\/p><\/div>\n
\n \u5f53\u60a8\u8fd0\u884c\u5207\u7247\u65f6\u95f4\u5e8f\u5217\u6570\u636e\u7684\u4ee3\u7801\u65f6\uff0c\u53ef\u4ee5\u89c2\u5bdf\u4e0b\u56fe\u6240\u793a\u7684\u56fe\u5f62 -\n <\/div>\n
\n \u5206\u6790\u65f6\u95f4\u5e8f\u5217\u6570\u636e_https:\/\/bianchenghao6.com_\u3010\u4eba\u5de5\u667a\u80fd\u6559\u7a0b\u3011_\u7b2c4\u5f20\n <\/div>\n

\u4ece\u65f6\u95f4\u5e8f\u5217\u6570\u636e\u4e2d\u63d0\u53d6\u7edf\u8ba1\u4fe1\u606f<\/h2>\n
\n \u5982\u679c\u9700\u8981\u5f97\u51fa\u4e00\u4e9b\u91cd\u8981\u7ed3\u8bba\uff0c\u9700\u8981\u4ece\u4e00\u4e2a\u7ed9\u5b9a\u7684\u6570\u636e\u4e2d\u63d0\u53d6\u4e00\u4e9b\u7edf\u8ba1\u6570\u636e\u3002 \u5e73\u5747\u503c\uff0c\u65b9\u5dee\uff0c\u76f8\u5173\u6027\uff0c\u6700\u5927\u503c\u548c\u6700\u5c0f\u503c\u662f\u8fd9\u4e9b\u7edf\u8ba1\u4e2d\u7684\u4e00\u90e8\u5206\u3002 \u5982\u679c\u60a8\u60f3\u4ece\u7ed9\u5b9a\u7684\u65f6\u95f4\u5e8f\u5217\u6570\u636e\u4e2d\u63d0\u53d6\u6b64\u7c7b\u7edf\u8ba1\u4fe1\u606f\uff0c\u5219\u53ef\u4ee5\u4f7f\u7528\u4ee5\u4e0b\u4ee3\u7801 -\n <\/div>\n
\n \u5e73\u5747\u503c<\/strong>\n <\/div>\n
\n \u53ef\u4ee5\u4f7f\u7528mean()\u51fd\u6570\u6765\u67e5\u627e\u5e73\u5747\u503c\uff0c\u5982\u4e0b\u6240\u793a -\n <\/div>\n
\n
 # Filename : example.py<\/span>
# Copyright : 2020 By Lidihuo<\/span>
# Author by : www.lidihuo.com<\/span>
# Date : 2020-08-26<\/span>
timeseries.mean<\/span>()
<\/span><\/code><\/pre>\n<\/p><\/div>\n
\n \u4f8b\u5b50\u4ee3\u7801\u7684\u8f93\u51fa\u662f -\n <\/div>\n
\n
 # Filename : example.py<\/span>
# Copyright : 2020 By Lidihuo<\/span>
# Author by : www.lidihuo.com<\/span>
# Date : 2020-08-26<\/span>
-0.11143128165238671
<\/span><\/code><\/pre>\n<\/p><\/div>\n
\n \u6700\u5927\u503c<\/strong>\n <\/div>\n
\n \u53ef\u4ee5\u4f7f\u7528max()\u51fd\u6570\u6765\u67e5\u627e\u6700\u5927\u503c\uff0c\u5982\u4e0b\u6240\u793a -\n <\/div>\n
\n
 # Filename : example.py<\/span>
# Copyright : 2020 By Lidihuo<\/span>
# Author by : www.lidihuo.com<\/span>
# Date : 2020-08-26<\/span>
timeseries.max<\/span>()
<\/span><\/code><\/pre>\n<\/p><\/div>\n
\n \u90a3\u4e48\u5728\u8ba8\u8bba\u7684\u4f8b\u5b50\u4e2d\u89c2\u5bdf\u7684\u8f93\u51fa\u662f -\n <\/div>\n
\n
 # Filename : example.py<\/span>
# Copyright : 2020 By Lidihuo<\/span>
# Author by : www.lidihuo.com<\/span>
# Date : 2020-08-26<\/span>
3.4952999999999999
<\/span><\/code><\/pre>\n<\/p><\/div>\n
\n \u6700\u5c0f\u503c<\/strong>\n <\/div>\n
\n \u53ef\u4ee5\u4f7f\u7528min()\u51fd\u6570\u6765\u67e5\u627e\u6700\u5c0f\u503c\uff0c\u5982\u4e0b\u6240\u793a -\n <\/div>\n
\n
 # Filename : example.py<\/span>
# Copyright : 2020 By Lidihuo<\/span>
# Author by : www.lidihuo.com<\/span>
# Date : 2020-08-26<\/span>
timeseries.min<\/span>()
<\/span><\/code><\/pre>\n<\/p><\/div>\n
\n \u90a3\u4e48\u5728\u8ba8\u8bba\u7684\u4f8b\u5b50\u4e2d\u89c2\u5bdf\u7684\u8f93\u51fa\u662f -\n <\/div>\n
\n
 # Filename : example.py<\/span>
# Copyright : 2020 By Lidihuo<\/span>
# Author by : www.lidihuo.com<\/span>
# Date : 2020-08-26<\/span>
-4.2656999999999998
<\/span><\/code><\/pre>\n<\/p><\/div>\n
\n \u4e00\u6b21\u6027\u83b7\u5f97\u6240\u6709<\/strong>\n <\/div>\n
\n \u5982\u679c\u60a8\u60f3\u4e00\u6b21\u8ba1\u7b97\u6240\u6709\u7edf\u8ba1\u6570\u636e\uff0c\u5219\u53ef\u4ee5\u4f7f\u7528describe()\u51fd\u6570\uff0c\u5982\u4e0b\u6240\u793a -\n <\/div>\n
\n
 # Filename : example.py<\/span>
# Copyright : 2020 By Lidihuo<\/span>
# Author by : www.lidihuo.com<\/span>
# Date : 2020-08-26<\/span>
timeseries.describe<\/span>()
<\/span><\/code><\/pre>\n<\/p><\/div>\n
\n \u90a3\u4e48\u89c2\u5bdf\u4e0a\u9762\u4f8b\u5b50\u7684\u8f93\u51fa\u662f -\n <\/div>\n
\n
 # Filename : example.py<\/span>
# Copyright : 2020 By Lidihuo<\/span>
# Author by : www.lidihuo.com<\/span>
# Date : 2020-08-26<\/span>
count 817.000000
mean -0.111431
std 1.003151
min <\/span> -4.265700
25% -0.649430
50% -0.042744
75% 0.475720
max 3.495300
dtype: float64
<\/span><\/code><\/pre>\n<\/p><\/div>\n
\n \u91cd\u65b0\u53d6\u6837<\/strong>\n <\/div>\n
\n \u53ef\u4ee5\u5c06\u6570\u636e\u91cd\u65b0\u91c7\u6837\u5230\u4e0d\u540c\u7684\u65f6\u95f4\u9891\u7387\u3002 \u6267\u884c\u91cd\u65b0\u91c7\u6837\u7684\u4e24\u4e2a\u53c2\u6570\u662f -\n <\/div>\n

\u65f6\u95f4\u6bb5<\/span>
\n \u65b9\u6cd5<\/span> <\/p>\n

\n \u4f7f\u7528mean()\u91cd\u65b0\u91c7\u6837<\/strong>\n <\/div>\n
\n \u4ee5\u4e0b\u4ee3\u7801\u4f7f\u7528mean()\u65b9\u6cd5\u91cd\u65b0\u91c7\u6837\u6570\u636e\uff0c\u8fd9\u662f\u9ed8\u8ba4\u65b9\u6cd5 -\n <\/div>\n
\n
 # Filename : example.py<\/span>
# Copyright : 2020 By Lidihuo<\/span>
# Author by : www.lidihuo.com<\/span>
# Date : 2020-08-26<\/span>
timeseries_mm = timeseries.resample<\/span>(\"A\"<\/span>).mean<\/span>()
timeseries_mm.plot<\/span>(style = 'g--'<\/span>)
plt.show<\/span>()
<\/span><\/code><\/pre>\n<\/p><\/div>\n
\n \u7136\u540e\uff0c\u53ef\u4ee5\u89c2\u5bdf\u4e0b\u9762\u4f7f\u7528mean()\u91cd\u91c7\u6837\u8f93\u51fa\u7684\u56fe\u5f62 -
\n \u5206\u6790\u65f6\u95f4\u5e8f\u5217\u6570\u636e_https:\/\/bianchenghao6.com_\u3010\u4eba\u5de5\u667a\u80fd\u6559\u7a0b\u3011_\u7b2c5\u5f20\n <\/div>\n
\n \u4f7f\u7528median()\u91cd\u65b0\u91c7\u6837<\/strong>\n <\/div>\n
\n \u4f7f\u7528\u4ee5\u4e0b\u4ee3\u7801\u4f7f\u7528median()\u65b9\u6cd5\u91cd\u65b0\u91c7\u6837\u6570\u636e -\n <\/div>\n
\n
 # Filename : example.py<\/span>
# Copyright : 2020 By Lidihuo<\/span>
# Author by : www.lidihuo.com<\/span>
# Date : 2020-08-26<\/span>
timeseries_mm = timeseries.resample<\/span>(\"A\"<\/span>).median<\/span>()
timeseries_mm.plot<\/span>()
plt.show<\/span>()
<\/span><\/code><\/pre>\n<\/p><\/div>\n
\n \u7136\u540e\uff0c\u89c2\u5bdf\u4e0b\u9762\u7684\u56fe\u5f62\u662f\u4f7f\u7528median()\u91cd\u65b0\u91c7\u6837\u7684\u8f93\u51fa -\n <\/div>\n
\n \u5206\u6790\u65f6\u95f4\u5e8f\u5217\u6570\u636e_https:\/\/bianchenghao6.com_\u3010\u4eba\u5de5\u667a\u80fd\u6559\u7a0b\u3011_\u7b2c6\u5f20\n <\/div>\n
\n \u6eda\u52a8\u5e73\u5747\u503c<\/strong>\n <\/div>\n
\n \u4f7f\u7528\u4e0b\u9762\u7684\u4ee3\u7801\u6765\u8ba1\u7b97\u6eda\u52a8(\u79fb\u52a8)\u7684\u5e73\u5747\u503c -\n <\/div>\n
\n
 # Filename : example.py<\/span>
# Copyright : 2020 By Lidihuo<\/span>
# Author by : www.lidihuo.com<\/span>
# Date : 2020-08-26<\/span>
timeseries.rolling<\/span>(window = 12, center = False<\/span>).mean<\/span>().plot<\/span>(style = '-g'<\/span>)
plt.show<\/span>()
<\/span><\/code><\/pre>\n<\/p><\/div>\n
\n \u7136\u540e\uff0c\u89c2\u5bdf\u6eda\u52a8(\u79fb\u52a8)\u5e73\u5747\u503c\u7684\u8f93\u51fa\u56fe\u8868 -\n <\/div>\n
\n \u5206\u6790\u65f6\u95f4\u5e8f\u5217\u6570\u636e_https:\/\/bianchenghao6.com_\u3010\u4eba\u5de5\u667a\u80fd\u6559\u7a0b\u3011_\u7b2c7\u5f20\n <\/div>\n

\u9690\u9a6c\u5c14\u53ef\u592b\u6a21\u578b(HMM)\u5206\u6790\u987a\u5e8f\u6570\u636e<\/h2>\n
\n HMM\u662f\u4e00\u79cd\u7edf\u8ba1\u6a21\u578b\uff0c\u5e7f\u6cdb\u7528\u4e8e\u65f6\u95f4\u5e8f\u5217\u80a1\u5e02\u5206\u6790\uff0c\u5065\u5eb7\u68c0\u67e5\u548c\u8bed\u97f3\u8bc6\u522b\u7b49\u5177\u6709\u5ef6\u7eed\u6027\u548c\u53ef\u6269\u5c55\u6027\u7684\u6570\u636e\u3002 \u672c\u8282\u8be6\u7ec6\u4ecb\u7ecd\u4f7f\u7528\u9690\u9a6c\u5c14\u53ef\u592b\u6a21\u578b(HMM)\u5206\u6790\u987a\u5e8f\u6570\u636e\u3002\n <\/div>\n

\u9690\u9a6c\u5c14\u53ef\u592b\u6a21\u578b(HMM)<\/h2>\n
\n HMM\u662f\u4e00\u4e2a\u57fa\u4e8e\u9a6c\u5c14\u53ef\u592b\u94fe\u6982\u5ff5\u7684\u968f\u673a\u6a21\u578b\uff0c\u5b83\u57fa\u4e8e\u672a\u6765\u7edf\u8ba1\u91cf\u7684\u6982\u7387\u4ec5\u53d6\u51b3\u4e8e\u5f53\u524d\u8fc7\u7a0b\u72b6\u6001\u800c\u975e\u5176\u4e4b\u524d\u7684\u4efb\u4f55\u72b6\u6001\u7684\u5047\u8bbe\u3002 \u4f8b\u5982\uff0c\u5f53\u6254\u786c\u5e01\u65f6\uff0c\u4e0d\u80fd\u8bf4\u7b2c\u4e94\u6b21\u629b\u63b7\u7684\u7ed3\u679c\u662f\u6b63\u9762\u3002 \u8fd9\u662f\u56e0\u4e3a\u786c\u5e01\u6ca1\u6709\u4efb\u4f55\u8bb0\u5fc6\uff0c\u4e0b\u4e00\u4e2a\u7ed3\u679c\u4e0d\u4f9d\u8d56\u4e8e\u4ee5\u524d\u7684\u7ed3\u679c\u3002\n <\/div>\n
\n \u5728\u6570\u5b66\u4e0a\uff0cHMM\u7531\u4ee5\u4e0b\u53d8\u91cf\u7ec4\u6210 -\n <\/div>\n
\n \u72b6\u6001(S)<\/strong>\u5b83\u662fHMM\u4e2d\u5b58\u5728\u7684\u4e00\u7ec4\u9690\u85cf\u6216\u6f5c\u5728\u72b6\u6001\u3002 \u5b83\u7531S\u8868\u793a\u3002\n <\/div>\n
\n \u8f93\u51fa\u7b26\u53f7(O)<\/strong>\u5b83\u662fHMM\u4e2d\u5b58\u5728\u7684\u4e00\u7ec4\u53ef\u80fd\u7684\u8f93\u51fa\u7b26\u53f7\u3002 \u5b83\u7531O\u8868\u793a\u3002\n <\/div>\n
\n \u72b6\u6001\u8f6c\u79fb\u6982\u7387\u77e9\u9635(A)<\/strong>\u8fd9\u662f\u4ece\u4e00\u4e2a\u72b6\u6001\u8fc7\u6e21\u5230\u5176\u4ed6\u72b6\u6001\u7684\u53ef\u80fd\u6027\u3002 \u5b83\u7531A\u8868\u793a\u3002\n <\/div>\n
\n \u89c2\u6d4b\u53d1\u5c04\u6982\u7387\u77e9\u9635(B)<\/strong>\u5b83\u662f\u5728\u7279\u5b9a\u72b6\u6001\u4e0b\u53d1\u5c04\/\u89c2\u6d4b\u7b26\u53f7\u7684\u6982\u7387\u3002 \u5b83\u7531B\u8868\u793a\u3002\n <\/div>\n
\n \u5148\u9a8c\u6982\u7387\u77e9\u9635(\u03a0)<\/strong>\u8fd9\u662f\u4ece\u7cfb\u7edf\u7684\u5404\u79cd\u72b6\u6001\u5f00\u59cb\u5904\u4e8e\u7279\u5b9a\u72b6\u6001\u7684\u6982\u7387\u3002 \u5b83\u7531\u03a0\u8868\u793a\u3002\u56e0\u6b64\uff0cHMM\u53ef\u4ee5\u88ab\u5b9a\u4e49\u4e3a\u03bb=(S\uff0cO\uff0cA\uff0cB\uff0c\u03c0)\uff0c\u5176\u4e2d\uff0c\n <\/div>\n

S = {s1,s2,\u2026,sN}\u662f\u4e00\u7ec4N\u4e2a\u53ef\u80fd\u7684\u72b6\u6001\uff0c<\/span>
\n O = {o1\uff0co2\uff0c\u2026\uff0coM}\u662f\u4e00\u7ec4M\u4e2a\u53ef\u80fd\u7684\u89c2\u5bdf\u7b26\u53f7\uff0c<\/span>
\n A\u662fN\u00d7N\u72b6\u6001\u8f6c\u79fb\u6982\u7387\u77e9\u9635(TPM)\uff0c<\/span>
\n B\u662fN <\/span>
\n <\/body>
\n<\/html><\/p>\n","protected":false},"excerpt":{"rendered":"\u5206\u6790\u65f6\u95f4\u5e8f\u5217\u6570\u636ezh-cn","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[137],"tags":[],"class_list":["post-1316","post","type-post","status-publish","format-standard","hentry","category-rgznjc1"],"_links":{"self":[{"href":"https:\/\/bianchenghao6.com\/wp-json\/wp\/v2\/posts\/1316"}],"collection":[{"href":"https:\/\/bianchenghao6.com\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/bianchenghao6.com\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/bianchenghao6.com\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/bianchenghao6.com\/wp-json\/wp\/v2\/comments?post=1316"}],"version-history":[{"count":0,"href":"https:\/\/bianchenghao6.com\/wp-json\/wp\/v2\/posts\/1316\/revisions"}],"wp:attachment":[{"href":"https:\/\/bianchenghao6.com\/wp-json\/wp\/v2\/media?parent=1316"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/bianchenghao6.com\/wp-json\/wp\/v2\/categories?post=1316"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/bianchenghao6.com\/wp-json\/wp\/v2\/tags?post=1316"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}