{"id":1739,"date":"2024-12-25T07:11:00","date_gmt":"2024-12-24T23:11:00","guid":{"rendered":"https:\/\/blog.laoyulaoyu.top\/?p=1739"},"modified":"2024-12-02T13:16:46","modified_gmt":"2024-12-02T05:16:46","slug":"%e6%b7%b1%e5%ba%a6%e5%ad%a6%e4%b9%a0%e5%8a%a9%e5%8a%9b%e8%82%a1%e5%b8%82%e9%a2%84%e6%b5%8b%ef%bc%9alstm%e3%80%81rnn%e5%92%8ccnn%e6%a8%a1%e5%9e%8b%e5%ae%9e%e6%88%98%e8%a7%a3%e6%9e%90","status":"publish","type":"post","link":"https:\/\/laoyulaoyu.com\/index.php\/2024\/12\/25\/%e6%b7%b1%e5%ba%a6%e5%ad%a6%e4%b9%a0%e5%8a%a9%e5%8a%9b%e8%82%a1%e5%b8%82%e9%a2%84%e6%b5%8b%ef%bc%9alstm%e3%80%81rnn%e5%92%8ccnn%e6%a8%a1%e5%9e%8b%e5%ae%9e%e6%88%98%e8%a7%a3%e6%9e%90\/","title":{"rendered":"\u6df1\u5ea6\u5b66\u4e60\u52a9\u529b\u80a1\u5e02\u9884\u6d4b\uff1aLSTM\u3001RNN\u548cCNN\u6a21\u578b\u5b9e\u6218\u89e3\u6790"},"content":{"rendered":"\n<p>\u4f5c\u8005\uff1a<a href=\"https:\/\/www.laoyulaoyu.com\/\" target=\"_blank\" rel=\"noreferrer noopener\">\u8001\u4f59\u635e\u9c7c<\/a><\/p>\n\n\n\n<p><strong><mark style=\"background-color:rgba(0, 0, 0, 0)\" class=\"has-inline-color has-cyan-bluish-gray-color\">\u539f\u521b\u4e0d\u6613\uff0c\u8f6c\u8f7d\u8bf7\u6807\u660e\u51fa\u5904\u53ca\u539f\u4f5c\u8005\u3002<\/mark><\/strong><\/p>\n\n\n\n<figure class=\"wp-block-image size-full\"><img decoding=\"async\" src=\"https:\/\/www.laoyulaoyu.com\/wp-content\/uploads\/2024\/12\/111203.png\" alt=\"\" class=\"wp-image-3191\"\/><\/figure>\n\n\n\n<blockquote class=\"wp-block-quote is-layout-flow wp-block-quote-is-layout-flow\">\n<pre class=\"wp-block-verse\"><strong>\u5199\u5728\u524d\u9762\u7684\u8bdd\uff1a<\/strong>\u4f17\u6240\u5468\u77e5\uff0c\u4f20\u7edf\u7684\u80a1\u7968\u9884\u6d4b\u6a21\u578b\u6709\u7740\u5404\u79cd\u5404\u6837\u7684\u5c40\u9650\u6027\u3002\u4f46\u5728\u6211\u7684\u6700\u65b0\u7814\u7a76\u4e2d\uff0c<mark style=\"background-color:rgba(0, 0, 0, 0)\" class=\"has-inline-color has-vivid-cyan-blue-color\">\u63a2\u7d22\u4e86\u4e00\u4e9b\u65b9\u6cd5\u6765\u9ad8\u6548\u9884\u6d4b\u80a1\u5e02\u8d70\u52bf\uff0c\u5373CNN\u3001RNN\u548cLSTM\u8fd9\u4e9b\u6df1\u5ea6\u5b66\u4e60\u6a21\u578b\u3002<\/mark>\u8fd9\u79cd\u65b9\u6cd5\u5728\u63ed\u793a\u91d1\u878d\u6570\u636e\u7684\u590d\u6742\u6027\u548c\u53d8\u5316\u8d8b\u52bf\u65b9\u9762\u53d6\u5f97\u4e86\u4e00\u4e9b\u6210\u6548\u3002\u5728\u672c\u6587\u4e2d\uff0c\u6211\u5c06\u5e26\u5927\u5bb6\u4e00\u6b65\u6b65\u4e86\u89e3\u5982\u4f55\u5229\u7528\u7279\u65af\u62c9\u80a1\u7968\u7684\u6848\u4f8b\uff0c\u901a\u8fc7\u8fd9\u4e9b\u6a21\u578b\u8fdb\u884c\u6570\u636e\u9884\u5904\u7406\u3001\u6a21\u578b\u6784\u5efa\u3001\u8bad\u7ec3\u548c\u9884\u6d4b\uff0c\u5e0c\u671b\u8fd9\u6837\u4e00\u4e2a\u65b0\u7684\u80a1\u5e02\u9884\u6d4b\u5de5\u5177\u6a21\u677f\uff0c\u80fd\u52a9\u529b\u60a8\u7684\u6295\u8d44\u51b3\u7b56\u3002<\/pre>\n<\/blockquote>\n\n\n\n<h2 class=\"wp-block-heading\"><strong>\u4e00\u3001\u80a1\u7968\u4ef7\u683c\u9884\u6d4b\u65b9\u6cd5\u7684\u95ee\u9898\u4e0e\u53d1\u5c55<\/strong><\/h2>\n\n\n\n<p>\u80a1\u7968\u5e02\u573a\uff0c\u5c24\u5176\u662f\u80a1\u7968\u4ef7\u683c\u9884\u6d4b\uff0c\u662f\u4e00\u4e2a\u5907\u53d7\u7814\u7a76\u4eba\u5458\u548c\u4ece\u4e1a\u4eba\u5458\u5173\u6ce8\u7684\u9886\u57df\u3002\u4f20\u7edf\u7684\u65f6\u95f4\u5e8f\u5217\u9884\u6d4b\u65b9\u6cd5\uff0c\u5982\u81ea\u56de\u5f52\uff08AR\uff09\u3001\u81ea\u56de\u5f52\u79fb\u52a8\u5e73\u5747\uff08ARMA\uff09\u548c\u81ea\u56de\u5f52\u7efc\u5408\u79fb\u52a8\u5e73\u5747\uff08ARIMA\uff09\u6a21\u578b\u5728\u8fd9\u65b9\u9762\u53d1\u6325\u4e86\u91cd\u8981\u4f5c\u7528\u3002\u8fd9\u4e9b\u65b9\u6cd5\u4f9d\u8d56\u4e8e\u9884\u5b9a\u4e49\u7684\u6570\u5b66\u516c\u5f0f\u6765\u6a21\u62df\u5355\u53d8\u91cf\u65f6\u95f4\u5e8f\u5217\uff0c\u7531\u4e8e\u5176\u7b80\u5355\u6027\u548c\u53ef\u89e3\u91ca\u6027\u800c\u88ab\u5e7f\u6cdb\u63a5\u53d7\u3002<\/p>\n\n\n<div class=\"wp-block-image\">\n<figure class=\"aligncenter size-full\"><img decoding=\"async\" src=\"https:\/\/www.laoyulaoyu.com\/wp-content\/uploads\/2024\/12\/image-1.png\" alt=\"\" class=\"wp-image-3192\"\/><\/figure>\n<\/div>\n\n\n<p>\u7136\u800c\uff0cAR\u3001ARMA \u548c ARIMA \u6709\u5176\u56fa\u6709\u7684\u5c40\u9650\u6027\uff0c\u56e0\u6b64\u4e0d\u9002\u5408\u6355\u6349\u91d1\u878d\u65f6\u95f4\u5e8f\u5217\u6570\u636e\u7684\u6f5c\u5728\u52a8\u6001\u7279\u5f81\u3002\u5176\u4e2d\u4e00\u4e2a\u9650\u5236\u662f\uff0c\u4e3a\u4e00\u4e2a\u65f6\u95f4\u5e8f\u5217\u786e\u5b9a\u7684\u6a21\u578b\u4e0d\u80fd\u5f88\u597d\u5730\u63a8\u5e7f\u5230\u5176\u4ed6\u65f6\u95f4\u5e8f\u5217\uff0c\u4ece\u800c\u964d\u4f4e\u4e86\u5176\u901a\u7528\u6027\u3002\u6b64\u5916\uff0c\u8fd9\u4e9b\u6a21\u578b\u96be\u4ee5\u8bc6\u522b\u6570\u636e\u4e2d\u8574\u542b\u7684\u590d\u6742\u6a21\u5f0f\uff0c\u9650\u5236\u4e86\u5176\u6709\u6548\u6027\u3002<\/p>\n\n\n\n<p>\u8fd1\u5e74\u6765\uff0c\u5377\u79ef\u795e\u7ecf\u7f51\u7edc\uff08CNN\uff09\u3001\u5faa\u73af\u795e\u7ecf\u7f51\u7edc\uff08RNN\uff09\u7b49\u5148\u8fdb\u7684\u673a\u5668\u5b66\u4e60\u6a21\u578b\u53ca\u5176\u53d8\u4f53\uff08\u5982\u957f\u77ed\u671f\u8bb0\u5fc6\uff08LSTM\uff09\uff09\u5f15\u8d77\u4e86\u5e7f\u6cdb\u5173\u6ce8\u3002\u8fd9\u4e9b\u6a21\u578b\u5229\u7528\u5176\u4ece\u5386\u53f2\u6570\u636e\u4e2d\u5b66\u4e60\u7684\u80fd\u529b\uff0c\u4e0d\u9700\u8981\u9884\u5b9a\u4e49\u7684\u65b9\u7a0b\u5f0f\uff0c\u56e0\u6b64\u975e\u5e38\u9002\u5408\u63ed\u793a\u9690\u85cf\u7684\u5173\u7cfb\u548c\u4f9d\u8d56\u6027\u3002\u5b83\u4eec\u5c06\u91d1\u878d\u6570\u636e\u5efa\u6a21\u4e3a\u591a\u7ef4\u95ee\u9898\uff0c\u4ece\u800c\u5b9e\u73b0\u4e86\u66f4\u51c6\u786e\u3001\u66f4\u7a33\u5065\u7684\u9884\u6d4b\u3002<\/p>\n\n\n\n<p>\u672c\u6587\u5c06\u63a2\u8ba8 CNN\u3001RNN \u548c\u57fa\u4e8e\u6ce8\u610f\u529b\u7684 LSTM \u5728\u9884\u6d4b\u7279\u65af\u62c9\u80a1\u7968\u4ef7\u683c\u4e2d\u7684\u5e94\u7528\u3002\u76ee\u7684\u662f\u5c55\u793a\u6bcf\u79cd\u65b9\u6cd5\u7684\u4f18\u7f3a\u70b9\uff0c\u5e76\u6df1\u5165\u63a2\u8ba8\u6df1\u5ea6\u5b66\u4e60\u6a21\u578b\u5982\u4f55\u8d85\u8d8a\u4f20\u7edf\u7ebf\u6027\u6a21\u578b\u3002<\/p>\n\n\n\n<h2 class=\"wp-block-heading\"><strong>\u4e8c\u3001\u4e3a\u4ec0\u4e48\u9009\u62e9\u7279\u65af\u62c9\u80a1\u7968\uff1f<\/strong><\/h2>\n\n\n\n<p>\u7279\u65af\u62c9\u516c\u53f8 (TSLA) \u662f\u6700\u5438\u5f15\u5206\u6790\u5e08\u548c\u6295\u8d44\u8005\u7684\u80a1\u7968\u4e4b\u4e00\uff0c\u662f\u8bc4\u4f30 LSTM\u3001RNN \u548c CNN \u7b49\u9ad8\u7ea7\u9884\u6d4b\u6a21\u578b\u6027\u80fd\u7684\u7406\u60f3\u9009\u62e9\u3002\u8be5\u516c\u53f8\u662f\u9ad8\u98ce\u9669\u3001\u9ad8\u56de\u62a5\u6295\u8d44\u7684\u4ee3\u8868\uff0c\u56e0\u5176\u6280\u672f\u521b\u65b0\u4ee5\u53ca\u56f4\u7ed5\u5176\u9886\u5bfc\u5730\u4f4d\u548c\u5e02\u573a\u52a8\u6001\u7684\u4e89\u8bae\u800c\u5907\u53d7\u5173\u6ce8\u3002<\/p>\n\n\n\n<p>\u8be5\u516c\u53f8\u521b\u59cb\u4eba\u57c3\u9686-\u9a6c\u65af\u514b\uff08Elon Musk\uff09\u662f\u79d1\u6280\u884c\u4e1a\u4e2d\u6700\u4e24\u6781\u5206\u5316\u7684\u4eba\u7269\u4e4b\u4e00\uff0c\u4ed6\u4e00\u76f4\u5728\u63a8\u52a8\u5bf9\u7279\u65af\u62c9\u4e1a\u7ee9\u7684\u731c\u6d4b\u3002\u4ed6\u652f\u6301\u5510\u7eb3\u5fb7-\u7279\u6717\u666e\u603b\u7edf\u53c2\u52a0 2024 \u5e74\u7f8e\u56fd\u5927\u9009\uff0c\u8fdb\u4e00\u6b65\u52a0\u5267\u4e86\u4e0d\u786e\u5b9a\u6027\uff0c\u52a0\u5267\u4e86\u8be5\u80a1\u7684\u6ce2\u52a8\u6027\uff0c\u5982\u4e0b\u56fe\u6240\u793a\u3002<\/p>\n\n\n<div class=\"wp-block-image\">\n<figure class=\"aligncenter size-full\"><img decoding=\"async\" src=\"https:\/\/www.laoyulaoyu.com\/wp-content\/uploads\/2024\/12\/image-2.png\" alt=\"\" class=\"wp-image-3193\"\/><\/figure>\n<\/div>\n\n\n<p>\u8fd9\u79cd\u731c\u6d4b\u6c34\u5e73\u52a0\u4e0a\u9a6c\u65af\u514b\u7684\u516c\u4f17\u5f62\u8c61\uff0c\u51f8\u663e\u4e86\u7279\u65af\u62c9\u4f5c\u4e3a\u65e8\u5728\u6355\u6349\u52a8\u6001\u5608\u6742\u6570\u636e\u7684\u6a21\u578b\u8bd5\u9a8c\u573a\u7684\u6f5c\u529b\u3002\u4ece 2010 \u5e74\u5230 2024 \u5e74\u7684\u6536\u76d8\u4ef7\u5c31\u8bf4\u660e\u4e86\u8fd9\u4e00\u70b9\u3002<\/p>\n\n\n<div class=\"wp-block-image\">\n<figure class=\"aligncenter size-full\"><img decoding=\"async\" src=\"https:\/\/www.laoyulaoyu.com\/wp-content\/uploads\/2024\/12\/image-3.png\" alt=\"\" class=\"wp-image-3194\"\/><\/figure>\n<\/div>\n\n\n<p><\/p>\n\n\n\n<h2 class=\"wp-block-heading\"><strong>\u4e09\u3001\u6570\u636e\u51c6\u5907<\/strong><\/h2>\n\n\n\n<p><\/p>\n\n\n\n<h3 class=\"wp-block-heading\"><strong>3.1 \u6570\u636e\u6536\u96c6<\/strong><\/h3>\n\n\n\n<p>\u6211\u4eec\u4f7f\u7528 yfinance \u5e93\u4e2d\u7684\u7279\u65af\u62c9\u5386\u53f2\u80a1\u4ef7\u6570\u636e\u3002<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>import yfinance as yf\nimport pandas as pd\n\ndef fetch_tesla_stock_data():\n    \"\"\"\n    Fetch Tesla's historical stock data from Yahoo Finance.\n\n    Returns:\n        pd.DataFrame: DataFrame containing adjusted close prices indexed by date.\n    \"\"\"\n    # Fetch data for Tesla (TSLA) from Yahoo Finance\n    ticker = \"TSLA\"\n    start_date = \"2010-01-01\"\n    end_date = \"2024-11-17\"\n    tesla = yf.download(ticker, start=start_date, end=end_date)\n\n    # Return a DataFrame with the adjusted close prices\n    tesla_data = tesla&#91;&#91;'Adj Close']].rename(columns={\"Adj Close\": \"adjClose\"})\n    tesla_data.index.name = \"date\"\n    return tesla_data\n\n# Fetch Tesla stock data\ntesla_data = fetch_tesla_stock_data()\n\n# Display the first few rows of data\nprint(tesla_data.head(10))<\/code><\/pre>\n\n\n\n<h3 class=\"wp-block-heading\"><strong>3.2 \u6570\u636e\u9884\u5904\u7406<\/strong><\/h3>\n\n\n\n<p>\u5f00\u53d1\u4e00\u4e2a\u9884\u5904\u7406\u7ba1\u9053\uff0c\u9996\u5148\u4f7f\u7528 MinMaxScaler \u5bf9\u7279\u65af\u62c9\u8c03\u6574\u540e\u7684\u6536\u76d8\u4ef7\u8fdb\u884c\u5f52\u4e00\u5316\u5904\u7406\u3002\u8fd9\u4e00\u6b65\u9aa4\u53ef\u786e\u4fdd\u6a21\u578b\u80fd\u6709\u6548\u5904\u7406\u6570\u636e\uff0c\u800c\u4e0d\u4f1a\u53d7\u5230\u539f\u59cb\u503c\u89c4\u6a21\u7684\u5f71\u54cd\u3002\u6211\u4eec\u8fd8\u4f7f\u7528\u6ed1\u52a8\u7a97\u53e3\u521b\u5efa\u5386\u53f2\u80a1\u7968\u4ef7\u683c\u5e8f\u5217\u3002\u6bcf\u4e2a\u6ed1\u52a8\u7a97\u53e3\u8de8\u8d8a 20 \u5929\uff08\u7a97\u53e3\u5927\u5c0f\uff09\u3002\u6700\u540e\uff0c\u6211\u4eec\u5c06\u6570\u636e\u91cd\u5851\u4e3a\u9002\u5408 LSTM\u3001RNN \u548c CNN \u7684\u683c\u5f0f\u3002\u91cd\u8981\u7684\u662f\uff0c\u6211\u4eec\u4e0d\u5bf9\u8bad\u7ec3\u548c\u6d4b\u8bd5\u6570\u636e\u8fdb\u884c\u6d17\u724c\uff0c\u4ee5\u4fdd\u7559\u80a1\u7968\u4ef7\u683c\u7684\u65f6\u95f4\u987a\u5e8f\u3002<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>import numpy as np\nimport pandas as pd\nfrom sklearn.preprocessing import MinMaxScaler\nfrom sklearn.metrics import mean_absolute_percentage_error\nfrom sklearn.model_selection import train_test_split\n# Define the window size and prediction time\nwindow_size = 20\nprediction_steps = 10\n# Function to create sequences\ndef create_sequences(data, window_size, prediction_steps):\nX = &#91;]\ny = &#91;]\nfor i in range(window_size, len(data) - prediction_steps):\nX.append(data&#91;i-window_size:i, 0]) # input sequence\ny.append(data&#91;i+prediction_steps-1, 0]) # target value (price at the next timestep)\nreturn np.array(X), np.array(y)\n# Fetch Tesla stock data\ndata = tesla_data&#91;&#91;'adjClose']].values\n# Normalize the data using MinMaxScaler\nscaler = MinMaxScaler(feature_range=(0, 1))\nscaled_data = scaler.fit_transform(data)\n# Create sequences for the model\nX, y = create_sequences(scaled_data, window_size, prediction_steps)\n# Reshape input data to be in the shape &#91;samples, time steps, features]\nX = X.reshape(X.shape&#91;0], X.shape&#91;1], 1)\n# Split the data into training and testing sets\nX_train, X_test, y_train, y_test = train_test_split(X, y, test_size=0.2, shuffle=False)\nprint(f\"Training data shape: {X_train.shape}\")\nprint(f\"Testing data shape: {X_test.shape}\")<\/code><\/pre>\n\n\n\n<h2 class=\"wp-block-heading\"><strong>\u56db\u3001\u4f7f\u7528\u6a21\u578b\u8fdb\u884c\u9884\u6d4b<\/strong><\/h2>\n\n\n\n<p><\/p>\n\n\n\n<h3 class=\"wp-block-heading\"><strong>4.1 \u4f7f\u7528 LSTM \u9884\u6d4b<\/strong><\/h3>\n\n\n\n<p>\u8be5\u6a21\u578b\u5305\u542b\u4e00\u4e2a\u81ea\u5b9a\u4e49\u6ce8\u610f\u529b\u5c42\uff0c\u4ee5\u589e\u5f3a\u5176\u6355\u6349\u7279\u65af\u62c9\u80a1\u7968\u4ef7\u683c\u4e2d\u5173\u952e\u65f6\u95f4\u6a21\u5f0f\u7684\u80fd\u529b\u3002\u8be5\u6a21\u578b\u7531 50 \u4e2a\u5355\u5143\u7ec4\u6210\uff0c\u7528\u4e8e\u9884\u5904\u7406\u8f93\u5165\u5e8f\u5217\uff0c\u5e76\u901a\u8fc7\u5185\u90e8\u8bb0\u5fc6\u673a\u5236\u4fdd\u7559\u91cd\u8981\u7684\u65f6\u95f4\u4f9d\u8d56\u6027\u3002\u6211\u4eec\u8fd8\u52a0\u5165\u4e86\u4e00\u4e2a\u5254\u9664\u5c42\uff0c\u901a\u8fc7\u5728\u8bad\u7ec3\u8fc7\u7a0b\u4e2d\u968f\u673a\u7981\u7528\u795e\u7ecf\u5143\u6765\u964d\u4f4e\u8fc7\u5ea6\u62df\u5408\u7684\u98ce\u9669\u3002\u8bad\u7ec3\u7ed3\u675f\u540e\uff0c\u6211\u4eec\u5c06\u6d4b\u8bd5\u6a21\u578b\u7684\u6027\u80fd\uff0c\u5e76\u7ed8\u5236\u5176\u9884\u6d4b\u7ed3\u679c\u4e0e\u5b9e\u9645\u80a1\u7968\u4ef7\u683c\u7684\u5bf9\u6bd4\u56fe\u3002<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>import numpy as np\nimport tensorflow as tf\nfrom keras.models import Sequential\nfrom keras.layers import LSTM, Dense, Dropout, Attention, Add, LayerNormalization, Layer\nfrom keras.callbacks import EarlyStopping\nfrom sklearn.preprocessing import MinMaxScaler\nfrom sklearn.metrics import mean_absolute_percentage_error\n\n# Define a custom attention layer\nclass AttentionLayer(Layer):\n    def __init__(self, **kwargs):\n        super(AttentionLayer, self).__init__(**kwargs)\n\n    def build(self, input_shape):\n        self.W = self.add_weight(shape=(input_shape&#91;2], input_shape&#91;2]), initializer='random_normal', trainable=True)\n        self.b = self.add_weight(shape=(input_shape&#91;1],), initializer='zeros', trainable=True)\n        super(AttentionLayer, self).build(input_shape)\n\n    def call(self, inputs):\n        q = tf.matmul(inputs, self.W)\n        a = tf.matmul(q, inputs, transpose_b=True)\n        attention_weights = tf.nn.softmax(a, axis=-1)\n        return tf.matmul(attention_weights, inputs)\n\n# LSTM model with attention and early stopping\ndef build_lstm_model_with_attention(input_shape):\n    model = Sequential()\n    model.add(LSTM(units=50, return_sequences=True, input_shape=input_shape))\n    model.add(Dropout(0.2))\n    \n    # Attention layer\n    model.add(AttentionLayer())\n    model.add(LayerNormalization())\n    \n    model.add(LSTM(units=50, return_sequences=False))\n    model.add(Dropout(0.2))\n    model.add(Dense(units=1))  # Output layer for prediction\n    \n    model.compile(optimizer='adam', loss='mean_squared_error')\n    return model\n\n\n# Build the LSTM model with attention\nmodel = build_lstm_model_with_attention(X_train.shape&#91;1:])\n\n# Implement EarlyStopping to prevent overfitting\nearly_stopping = EarlyStopping(monitor='val_loss', patience=10, restore_best_weights=True)\n\n# Train the model with EarlyStopping and 50 epochs\nhistory = model.fit(X_train, y_train, epochs=70, batch_size=32, validation_data=(X_test, y_test), callbacks=&#91;early_stopping])\n\n# Evaluate the model\npredicted_stock_price = model.predict(X_test)\npredicted_stock_price = scaler.inverse_transform(predicted_stock_price)\n\n# Inverse scale the actual stock prices\ny_test_scaled = scaler.inverse_transform(y_test.reshape(-1, 1))\n\n# Calculate MAPE\nmape = mean_absolute_percentage_error(y_test_scaled, predicted_stock_price)\nprint(f\"Mean Absolute Percentage Error (MAPE): {mape:.2f}%\")\n\n# Plot the results\nplt.figure(figsize=(10, 6))\nplt.plot(y_test_scaled, label=\"Actual Tesla Stock Price\", color='blue')\nplt.plot(predicted_stock_price, label=\"Predicted Tesla Stock Price\", color='red')\nplt.title('Tesla Stock Price Prediction with LSTM', fontsize=14)\nplt.xlabel('Time', fontsize=12)\nplt.ylabel('Scaled Stock Price (USD)', fontsize=12)\nplt.legend()\nplt.grid(True)\nplt.show()<\/code><\/pre>\n\n\n<div class=\"wp-block-image\">\n<figure class=\"aligncenter size-full\"><img decoding=\"async\" src=\"https:\/\/www.laoyulaoyu.com\/wp-content\/uploads\/2024\/12\/image-4.png\" alt=\"\" class=\"wp-image-3195\"\/><\/figure>\n<\/div>\n\n\n<p>\u8be5\u6a21\u578b\u4ece\u6570\u503c\u4e0a\u770b\u826f\u597d\uff0c\u5e73\u5747\u767e\u5206\u6bd4<strong>\u8bef\u5dee\u4e3a 0.17%<\/strong>\u3002<\/p>\n\n\n\n<h3 class=\"wp-block-heading\"><strong>4.2 \u4f7f\u7528 RNN\uff08\u9012\u5f52\u795e\u7ecf\u7f51\u7edc\uff09\u9884\u6d4b<\/strong><\/h3>\n\n\n\n<p>LSTM \u5728\u5904\u7406\u987a\u5e8f\u6570\u636e\u65b9\u9762\u8868\u73b0\u76f8\u5f53\u51fa\u8272\u3002\u7136\u540e\uff0c\u6211\u4eec\u6574\u5408\u4e86\u4e00\u4e2a RNN\uff0c\u4ee5\u68c0\u9a8c\u5b83\u662f\u5426\u80fd\u6355\u6349\u65f6\u95f4\u4f9d\u8d56\u6027\u3002\u6b64\u5916\uff0c\u6211\u4eec\u8fd8\u4f7f\u7528\u53cc\u5411 RNN \u6765\u8003\u8651\u8fc7\u53bb\u548c\u672a\u6765\u7684\u8f93\u5165\u3002<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>from keras.models import Sequential\nfrom keras.layers import SimpleRNN, Dense, Dropout\n\n# Define the RNN model\ndef build_rnn_model(input_shape):\n    model = Sequential()\n    model.add(SimpleRNN(units=50, return_sequences=True, input_shape=input_shape))\n    model.add(Dropout(0.2))\n    model.add(SimpleRNN(units=50, return_sequences=False))\n    model.add(Dropout(0.2))\n    model.add(Dense(units=1))  # Output layer for prediction\n    \n    model.compile(optimizer='adam', loss='mean_squared_error')\n    return model\n\n# Build the RNN model\nrnn_model = build_rnn_model(X_train.shape&#91;1:])\n\n# Train the model\nrnn_history = rnn_model.fit(X_train, y_train, epochs=70, batch_size=32, validation_data=(X_test, y_test))\n\n# Evaluate the model\npredicted_stock_price_rnn = rnn_model.predict(X_test)\npredicted_stock_price_rnn = scaler.inverse_transform(predicted_stock_price_rnn)\n\n# Inverse scale the actual stock prices\ny_test_scaled = scaler.inverse_transform(y_test.reshape(-1, 1))\n\n# Calculate MAPE for RNN\nmape_rnn = mean_absolute_percentage_error(y_test_scaled, predicted_stock_price_rnn)\nprint(f\"Mean Absolute Percentage Error (MAPE) for RNN: {mape_rnn:.2f}%\")\n# Plot the results for RNN model\nplt.figure(figsize=(12, 6))\nplt.plot(y_test_scaled, label=\"Actual Tesla Stock Price\", color='blue')\nplt.plot(predicted_stock_price_rnn, label=\"Predicted Tesla Stock Price\", color='red')\nplt.title('Tesla Stock Price Prediction with RNN', fontsize=14)\nplt.xlabel('Time', fontsize=12)\nplt.ylabel(' Scaled Stock Price (USD)', fontsize=12)\nplt.legend()\nplt.grid(True)\nplt.show()<\/code><\/pre>\n\n\n\n<p>\u4e0b\u56fe\u662fRNN \u7684\u9884\u6d4b\u7ed3\u679c\uff1a<\/p>\n\n\n<div class=\"wp-block-image\">\n<figure class=\"aligncenter size-full\"><img decoding=\"async\" src=\"https:\/\/www.laoyulaoyu.com\/wp-content\/uploads\/2024\/12\/image-5.png\" alt=\"\" class=\"wp-image-3196\"\/><\/figure>\n<\/div>\n\n\n<p>\u8fd9\u662f LSTM \u4e0e RNN\u7684\u6bd4\u8f83\u56fe\uff1a<\/p>\n\n\n<div class=\"wp-block-image\">\n<figure class=\"aligncenter size-full\"><img decoding=\"async\" src=\"https:\/\/www.laoyulaoyu.com\/wp-content\/uploads\/2024\/12\/image-6.png\" alt=\"\" class=\"wp-image-3197\"\/><\/figure>\n<\/div>\n\n\n<p>\u5982\u56fe\u6240\u793a\uff0c RNN \u6a21\u578b\u7684\u5e73\u5747\u7edd\u5bf9\u767e\u5206\u6bd4\u8bef\u5dee\u548c LSTM \u76f8\u8fd1\u3002<\/p>\n\n\n\n<h3 class=\"wp-block-heading\"><strong>4.3 \u4f7f\u7528 CNN\uff08\u5377\u79ef\u795e\u7ecf\u7f51\u7edc\uff09\u9884\u6d4b<\/strong><\/h3>\n\n\n\n<p>\u6700\u540e\uff0c\u6211\u4eec\u4f7f\u7528 CNN \u6765\u7814\u7a76\u5b83\u5728\u9884\u6d4b\u7279\u65af\u62c9\u80a1\u4ef7\u65b9\u9762\u7684\u8868\u73b0\u3002\u8be5\u6a21\u578b\u7684\u7ed3\u6784\u662f\u81ea\u52a8\u5b66\u4e60\u6570\u636e\u4e2d\u7684\u7a7a\u95f4\u5c42\u6b21\u548c\u6a21\u5f0f\u3002\u6211\u4eec\u5e94\u7528\u4e86\u591a\u4e2a\u5377\u79ef\u5c42\uff0c\u4f7f\u7528\u8fc7\u6ee4\u5668\u6765\u68c0\u6d4b\u8f93\u5165\u6570\u636e\u4e2d\u7684\u91cd\u8981\u7279\u5f81\u3002\u6b64\u5916\uff0c\u6211\u4eec\u8fd8\u4f7f\u7528\u6c60\u5316\u5c42\u6765\u964d\u4f4e\u7279\u5f81\u56fe\u7684\u7ef4\u5ea6\uff0c\u5e76\u4fdd\u7559\u6700\u91cd\u8981\u7684\u4fe1\u606f\u3002\u7531\u4e8e\u6211\u4eec\u4f7f\u7528\u5168\u8fde\u63a5\u5c42\uff0c\u56e0\u6b64\u8f93\u51fa\u662f\u9884\u6d4b\u672a\u6765\u80a1\u4ef7\u7684\u56de\u5f52\u503c\u3002<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>from keras.models import Sequential\nfrom keras.layers import Conv1D, MaxPooling1D, Flatten, Dense, Dropout, BatchNormalization\nfrom keras.callbacks import EarlyStopping,ReduceLROnPlateau\nfrom sklearn.metrics import mean_absolute_percentage_error\nfrom sklearn.preprocessing import MinMaxScaler\nfrom sklearn.model_selection import train_test_split\n\n\ndef build_cnn_model(input_shape):\n    model = Sequential()\n    model.add(Conv1D(filters=64, kernel_size=3, activation='relu', input_shape=input_shape))\n    model.add(BatchNormalization())\n    model.add(MaxPooling1D(pool_size=2))\n    \n    model.add(Conv1D(filters=64, kernel_size=3, activation='relu'))\n    model.add(BatchNormalization())\n    # Change pool_size to avoid reducing dimensions to zero\n    model.add(MaxPooling1D(pool_size=2))\n    \n    # Add a condition to avoid further reduction if dimensions are too small\n    model.add(Conv1D(filters=64, kernel_size=3, activation='relu'))\n    model.add(BatchNormalization())\n    model.add(MaxPooling1D(pool_size=1))  # Adjusted pool size\n    \n    model.add(Flatten())\n    model.add(Dropout(0.4))\n    model.add(Dense(units=100, activation='relu'))\n    model.add(Dropout(0.2))\n    model.add(Dense(units=1))  # Output layer for prediction\n\n    model.compile(optimizer='adam', loss='mean_squared_error')\n    return model\n\n\ncnn_model = build_cnn_model(X_train.shape&#91;1:])\nearly_stopping = EarlyStopping(monitor='val_loss', patience=30, restore_best_weights=True)\nreduce_lr = ReduceLROnPlateau(monitor='val_loss', factor=0.5, patience=10, min_lr=1e-6)\n\ncnn_history = cnn_model.fit(\n    X_train, y_train, \n    epochs=200, \n    batch_size=32, \n    validation_data=(X_test, y_test), \n    callbacks=&#91;early_stopping, reduce_lr]\n)\n\n\n# Build the CNN model\ncnn_model = build_cnn_model(X_train.shape&#91;1:])\n\n# Define EarlyStopping callback\nearly_stopping = EarlyStopping(monitor='val_loss', patience=30, restore_best_weights=True)\n\n# Train the model with early stopping and 100 epochs\ncnn_history = cnn_model.fit(X_train, y_train, epochs=100, batch_size=32, validation_data=(X_test, y_test), callbacks=&#91;early_stopping])\n\n# Evaluate the model\npredicted_stock_price_cnn = cnn_model.predict(X_test)\npredicted_stock_price_cnn = scaler.inverse_transform(predicted_stock_price_cnn)\n\n# Inverse scale the actual stock prices\ny_test_scaled = scaler.inverse_transform(y_test.reshape(-1, 1))\n\n# Calculate MAPE for CNN\nmape_cnn = mean_absolute_percentage_error(y_test_scaled, predicted_stock_price_cnn)\nprint(f\"Mean Absolute Percentage Error (MAPE) for CNN: {mape_cnn:.2f}%\")\n\n# Plot the results for CNN model\nplt.figure(figsize=(12, 6))\nplt.plot(y_test_scaled, label=\"Actual Tesla Stock Price\", color='blue')\nplt.plot(predicted_stock_price_cnn, label=\"Predicted Tesla Stock Price (CNN)\", color='red')\nplt.title('Tesla Stock Price Prediction with CNN', fontsize=14)\nplt.xlabel('Time', fontsize=12)\nplt.ylabel('Scaled Stock Price (USD)', fontsize=12)\nplt.legend()\nplt.grid(True)\nplt.show()<\/code><\/pre>\n\n\n\n<p>\u4e0b\u56fe\u662f CNN \u7684\u9884\u6d4b\u7ed3\u679c\uff1a<\/p>\n\n\n<div class=\"wp-block-image\">\n<figure class=\"aligncenter size-full\"><img decoding=\"async\" src=\"https:\/\/www.laoyulaoyu.com\/wp-content\/uploads\/2024\/12\/image-7.png\" alt=\"\" class=\"wp-image-3198\"\/><\/figure>\n<\/div>\n\n\n<p>\u8fd9\u662f CNN \u4e0eLSTM \u3001RNN\u7684\u6bd4\u8f83\u56fe\uff1a<\/p>\n\n\n\n<figure class=\"wp-block-image size-full\"><img decoding=\"async\" src=\"https:\/\/www.laoyulaoyu.com\/wp-content\/uploads\/2024\/12\/image-8.png\" alt=\"\" class=\"wp-image-3199\"\/><\/figure>\n\n\n\n<p>CNN \u6a21\u578b\u7684\u5e73\u5747\u7edd\u5bf9\u767e\u5206\u6bd4\u8bef\u5dee\u4e3a 0.14%\uff0c\u4f18\u4e8e LSTM \u548c RNN\u3002<\/p>\n\n\n\n<h3 class=\"wp-block-heading\"><strong>4.4 \u6bd4\u8f83\u7ed3\u679c<\/strong><\/h3>\n\n\n\n<p>\u4e09\u79cd\u6a21\u578b\u7684\u5e73\u5747\u7edd\u5bf9\u8bef\u5dee\u767e\u5206\u6bd4\u5982\u4e0b\uff1a<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>import matplotlib.pyplot as plt\nmape_scores = &#91;mape, mape_rnn, mape_cnn]\nmodels = &#91;'LSTM', 'RNN', 'CNN']\n# Create the bar chart\nplt.figure(figsize=(6, 4))\nplt.bar(models, mape_scores, color=&#91;'blue', 'green', 'orange'])\n# Add labels and title\nplt.title('MAPE Comparison for LSTM, RNN, and CNN', fontsize=14)\nplt.xlabel('Models', fontsize=12)\nplt.ylabel('MAPE (%)', fontsize=12)\n# Show the MAPE values on top of the bars\nfor i, v in enumerate(mape_scores):\nplt.text(i, v + 0.1, f'{v:.2f}%', fontsize=12)\n# Display the plot\nplt.show()<\/code><\/pre>\n\n\n\n<p>\u6027\u80fd\u6bd4\u8f83\u56fe\u5982\u4e0b\uff1a<\/p>\n\n\n\n<figure class=\"wp-block-image size-full\"><img decoding=\"async\" src=\"https:\/\/www.laoyulaoyu.com\/wp-content\/uploads\/2024\/12\/image-9.png\" alt=\"\" class=\"wp-image-3200\"\/><\/figure>\n\n\n\n<p>\u57fa\u4e8e\u6df1\u5ea6\u5b66\u4e60\u7684\u80a1\u7968\u9884\u6d4b\u65b9\u6cd5\u91c7\u7528\u4e09\u79cd\u4e0d\u540c\u7684\u795e\u7ecf\u67b6\u6784\uff0c\u80fd\u591f\u5f88\u597d\u5730\u6355\u6349\u9690\u85cf\u7684\u52a8\u6001\u53d8\u5316\u3002\u867d\u7136\u7279\u65af\u62c9\u80a1\u7968\u6ce2\u52a8\u6027\u5f88\u5927\uff0c\u4f46\u6211\u4eec\u7684\u6a21\u578b\u5b9e\u73b0\u4e86\u975e\u5e38\u4f4e\u7684\u5e73\u5747\u7edd\u5bf9\u767e\u5206\u6bd4\u8bef\u5dee\uff08MAPE\uff09\uff1aLSTM\u548cRNN \u90fd\u662f 0.17%\uff0cCNN \u4e3a 0.14%\u3002<\/p>\n\n\n\n<p>\u8fd9\u8bc1\u660e\u4e86\u6df1\u5ea6\u5b66\u4e60\u6a21\u578b\u80fd\u6709\u6548\u6355\u6349\u65f6\u95f4\u5dee\u548c\u9690\u85cf\u6a21\u5f0f\uff0c\u800c CNN \u80fd\u6709\u6548\u6355\u6349\u80a1\u7968\u4ef7\u683c\u7684\u7a81\u7136\u53d8\u5316\u548c\u8d8b\u52bf\u3002<\/p>\n\n\n\n<h2 class=\"wp-block-heading\"><strong>\u4e94\u3001\u89c2\u70b9\u603b\u7ed3<\/strong><\/h2>\n\n\n\n<ul class=\"wp-block-list\">\n<li><strong>\u4f20\u7edf\u65f6\u95f4\u5e8f\u5217\u9884\u6d4b\u6a21\u578b\u5b58\u5728\u5c40\u9650\u6027<\/strong>\uff1aAR\u3001ARMA \u548c ARIMA \u7b49\u4f20\u7edf\u6a21\u578b\u5728\u91d1\u878d\u6570\u636e\u7684\u9884\u6d4b\u4e2d\u8868\u73b0\u51fa\u6a21\u578b\u6cdb\u5316\u80fd\u529b\u5dee\u548c\u96be\u4ee5\u6355\u6349\u590d\u6742\u6a21\u5f0f\u7684\u95ee\u9898\u3002<\/li>\n\n\n\n<li><strong>\u6df1\u5ea6\u5b66\u4e60\u6a21\u578b\u5728\u80a1\u7968\u9884\u6d4b\u4e2d\u7684\u4f18\u52bf<\/strong>\uff1aCNN\u3001RNN \u548c LSTM \u7b49\u6df1\u5ea6\u5b66\u4e60\u6a21\u578b\u80fd\u591f\u4ece\u5386\u53f2\u6570\u636e\u4e2d\u81ea\u52a8\u5b66\u4e60\uff0c\u65e0\u9700\u9884\u8bbe\u7684\u6570\u5b66\u65b9\u7a0b\uff0c\u66f4\u9002\u5408\u5904\u7406\u91d1\u878d\u65f6\u95f4\u5e8f\u5217\u6570\u636e\u7684\u590d\u6742\u6027\u3002<\/li>\n\n\n\n<li><strong>\u7279\u65af\u62c9\u80a1\u7968\u7684\u7279\u6b8a\u6027<\/strong>\uff1a\u7279\u65af\u62c9\u80a1\u7968\u7684\u9ad8\u6ce2\u52a8\u6027\u548c\u4e0e\u5176\u76f8\u5173\u7684\u516c\u4f17\u5173\u6ce8\u5ea6\uff0c\u4f7f\u5176\u6210\u4e3a\u6d4b\u8bd5\u80a1\u7968\u9884\u6d4b\u6a21\u578b\u7684\u7406\u60f3\u6848\u4f8b\u3002<\/li>\n\n\n\n<li><strong>\u6a21\u578b\u6027\u80fd\u6bd4\u8f83<\/strong>\uff1a\u901a\u8fc7\u5bf9\u6bd4 LSTM\u3001RNN \u548c CNN \u6a21\u578b\u5728\u7279\u65af\u62c9\u80a1\u7968\u9884\u6d4b\u4e0a\u7684\u8868\u73b0\uff0c\u5f97\u51fa CNN \u6a21\u578b\u5728\u672c\u6b21\u5b9e\u9a8c\u4e2d\u5177\u6709\u6700\u4f73\u7684\u9884\u6d4b\u80fd\u529b\u3002<\/li>\n<\/ul>\n\n\n\n<p><strong>\u7cbe\u900910\u7bc7\u548c\u80a1\u7968\u9884\u6d4b\u76f8\u5173\u7684\u6587\u7ae0\u63a8\u8350\uff1a<\/strong><\/p>\n\n\n\n<ol class=\"wp-block-list\">\n<li><a href=\"https:\/\/mp.weixin.qq.com\/s\/0W3cmSkr0TthpOTLr3WWkw\" target=\"_blank\" rel=\"noreferrer noopener\">\u4ec5\u9700\u516b\u6b65\uff0c\u6253\u9020\u79c1\u4eba\u4e13\u5c5e\u667a\u80fd\u80a1\u7968<em>\u9884\u6d4b<\/em>\u6a21\u578b<\/a><\/li>\n\n\n\n<li><a href=\"https:\/\/mp.weixin.qq.com\/s\/s7HARXpSg3-0W5qw4qt_Zg\" target=\"_blank\" rel=\"noreferrer noopener\">\u624b\u628a\u624b\u6559\u4f1a\u4f60\u7528&nbsp;AI&nbsp;\u548c&nbsp;Python&nbsp;\u8fdb\u884c\u80a1\u7968\u4ea4\u6613<em>\u9884\u6d4b<\/em>\uff08\u5b8c\u6574\u4ee3\u7801\u5e72\u8d27\uff09<\/a><\/li>\n\n\n\n<li><a href=\"https:\/\/mp.weixin.qq.com\/s\/T1N1nT5Kze3jVPmTXUq5hQ\" target=\"_blank\" rel=\"noreferrer noopener\">\u63ed\u79d8\uff1a\u5982\u4f55\u7528\u601d\u60f3\u589e\u5f3a\u578bLSTM\u7f51\u7edc\u7cbe\u51c6<em>\u9884\u6d4b<\/em>\u80a1\u4ef7\uff1f<\/a><\/li>\n\n\n\n<li><a href=\"https:\/\/mp.weixin.qq.com\/s\/7wqZ9xWgXWZ9ap6MJk5ReQ\" target=\"_blank\" rel=\"noreferrer noopener\">\u9707\u60ca\u91d1\u878d\u754c\uff01\u4e09\u5927\u6df1\u5ea6\u5b66\u4e60\u6a21\u578b\u8054\u8882\uff0c\u7adf\u521b\u51fa66,941.5%\u9006\u5929\u56de\u62a5\u7387\uff01<\/a><\/li>\n\n\n\n<li><a href=\"https:\/\/mp.weixin.qq.com\/s\/zzuyd27tWrEOG_D6D3BZQw?token=1272703748&amp;lang=zh_CN\">\u7f8e\u56fd\u5927\u9009\u540e\uff0c\u7528HMM\u6a21\u578b\u505a\u7279\u65af\u62c9\u80a1\u4ef7\u6ce2\u52a8\u89e3\u6790<\/a><\/li>\n\n\n\n<li><a href=\"https:\/\/mp.weixin.qq.com\/s\/JmufBR4D2kSzTsPHHlTI0w\" target=\"_blank\" rel=\"noreferrer noopener\">\u4f7f\u7528\u5806\u53e0&nbsp;LSTM&nbsp;\u6a21\u578b<em>\u9884\u6d4b<\/em>\u5e02\u573a\u8d8b\u52bf<\/a><\/li>\n\n\n\n<li><a href=\"https:\/\/mp.weixin.qq.com\/s\/dOsr1LTpqXuqeG0wPP8_AA\" target=\"_blank\" rel=\"noreferrer noopener\">\u83b7\u5f97\u7b80\u8857\u5e02\u573a<em>\u9884\u6d4b<\/em>\u5927\u8d5b\u91d1\u724c\u7684<em>\u9884\u6d4b<\/em>\u7b56\u7565\u6a21\u578b<\/a><\/li>\n\n\n\n<li><a href=\"https:\/\/mp.weixin.qq.com\/s\/eOLq-hWnJE_JRYTuq-PkEQ\" target=\"_blank\" rel=\"noreferrer noopener\">\u878d\u5408\u7bc7\uff1a\u7528&nbsp;OpenAI&nbsp;o1&nbsp;\u8349\u8393\u6a21\u578b\u548c&nbsp;Python&nbsp;<em>\u9884\u6d4b<\/em>\u80a1\u5e02\u884c\u60c5<\/a><\/li>\n\n\n\n<li><a href=\"https:\/\/mp.weixin.qq.com\/s\/gW3DdYfnQXkdbc8usbRgDA\" target=\"_blank\" rel=\"noreferrer noopener\">\u3010Python\u65f6\u5e8f<em>\u9884\u6d4b<\/em>\u7cfb\u5217\u3011\u57fa\u4e8eLSTM\u5b9e\u73b0\u591a\u8f93\u5165\u591a\u8f93\u51fa\u5355\u6b65<em>\u9884\u6d4b<\/em>\uff08\u6848\u4f8b+\u6e90\u7801\uff09<\/a><\/li>\n\n\n\n<li><a href=\"https:\/\/mp.weixin.qq.com\/s\/Mkzr56Ht3wvi9jdu_yKPPw\" target=\"_blank\" rel=\"noreferrer noopener\">\u7528&nbsp;Python&nbsp;\u4e2d\u7684\u91cf\u5b50\u673a\u5668\u5b66\u4e60<em>\u9884\u6d4b<\/em>\u80a1\u7968\u4ef7\u683c<\/a><\/li>\n<\/ol>\n\n\n\n<p>\u8bf7\u5728\u6211\u516c\u4f17\u53f7\u6216\u535a\u5ba2\u4e2d\u641c\u7d22\u5173\u952e\u8bcd\u201d\u9884\u6d4b\u201c\uff0c\u83b7\u5f97\u66f4\u591a\u76f8\u5173\u6587\u7ae0\u3002<\/p>\n\n\n\n<p><\/p>\n\n\n\n<p><em>\u8c22\u8c22\u60a8\u9605\u8bfb\u5230\u6700\u540e\uff0c\u5e0c\u671b\u672c\u6587\u80fd\u7ed9\u60a8\u5e26\u6765\u65b0\u7684\u6536\u83b7\u3002\u795d\u60a8\u6295\u8d44\u987a\u5229\uff01\u5982\u679c\u5bf9\u6587\u4e2d\u7684\u5185\u5bb9\u6709\u4efb\u4f55\u7591\u95ee\uff0c\u8bf7\u7ed9\u6211\u7559\u8a00\uff0c\u5fc5\u590d\u3002<\/em><\/p>\n\n\n\n<hr class=\"wp-block-separator has-alpha-channel-opacity\"\/>\n\n\n\n<p class=\"has-text-align-center\" id=\"a1c6\">\u672c\u6587\u5185\u5bb9\u4ec5\u9650\u6280\u672f\u63a2\u8ba8\u548c\u5b66\u4e60\uff0c\u4e0d\u6784\u6210\u4efb\u4f55\u6295\u8d44\u5efa\u8bae\u3002<\/p>\n","protected":false},"excerpt":{"rendered":"<p>\u4f5c\u8005\uff1a\u8001\u4f59\u635e\u9c7c \u539f\u521b\u4e0d\u6613\uff0c\u8f6c\u8f7d\u8bf7\u6807\u660e\u51fa\u5904\u53ca\u539f\u4f5c\u8005\u3002&#8230;<\/p>\n<div class=\"more-link-wrapper\"><a class=\"more-link\" href=\"https:\/\/laoyulaoyu.com\/index.php\/2024\/12\/25\/%e6%b7%b1%e5%ba%a6%e5%ad%a6%e4%b9%a0%e5%8a%a9%e5%8a%9b%e8%82%a1%e5%b8%82%e9%a2%84%e6%b5%8b%ef%bc%9alstm%e3%80%81rnn%e5%92%8ccnn%e6%a8%a1%e5%9e%8b%e5%ae%9e%e6%88%98%e8%a7%a3%e6%9e%90\/\">Continue reading<span class=\"screen-reader-text\">\u6df1\u5ea6\u5b66\u4e60\u52a9\u529b\u80a1\u5e02\u9884\u6d4b\uff1aLSTM\u3001RNN\u548cCNN\u6a21\u578b\u5b9e\u6218\u89e3\u6790<\/span><\/a><\/div>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[2],"tags":[5,6],"class_list":["post-1739","post","type-post","status-publish","format-standard","hentry","category-aiinvest","tag-ai","tag-6","entry"],"_links":{"self":[{"href":"https:\/\/laoyulaoyu.com\/index.php\/wp-json\/wp\/v2\/posts\/1739","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/laoyulaoyu.com\/index.php\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/laoyulaoyu.com\/index.php\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/laoyulaoyu.com\/index.php\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/laoyulaoyu.com\/index.php\/wp-json\/wp\/v2\/comments?post=1739"}],"version-history":[{"count":2,"href":"https:\/\/laoyulaoyu.com\/index.php\/wp-json\/wp\/v2\/posts\/1739\/revisions"}],"predecessor-version":[{"id":1741,"href":"https:\/\/laoyulaoyu.com\/index.php\/wp-json\/wp\/v2\/posts\/1739\/revisions\/1741"}],"wp:attachment":[{"href":"https:\/\/laoyulaoyu.com\/index.php\/wp-json\/wp\/v2\/media?parent=1739"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/laoyulaoyu.com\/index.php\/wp-json\/wp\/v2\/categories?post=1739"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/laoyulaoyu.com\/index.php\/wp-json\/wp\/v2\/tags?post=1739"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}