{"id":1446,"date":"2024-09-21T07:50:00","date_gmt":"2024-09-20T23:50:00","guid":{"rendered":"https:\/\/blog.laoyulaoyu.top\/?p=1446"},"modified":"2024-09-18T23:01:55","modified_gmt":"2024-09-18T15:01:55","slug":"%e8%82%a1%e4%bb%b7%e9%a2%84%e6%b5%8b%ef%bc%8c%e9%9d%9e%e7%ba%bf%e6%80%a7%e7%9a%84%e6%b3%a8%e6%84%8f%e5%8a%9b%e6%9b%b4%e5%a5%bd%ef%bc%9f","status":"publish","type":"post","link":"https:\/\/laoyulaoyu.com\/index.php\/2024\/09\/21\/%e8%82%a1%e4%bb%b7%e9%a2%84%e6%b5%8b%ef%bc%8c%e9%9d%9e%e7%ba%bf%e6%80%a7%e7%9a%84%e6%b3%a8%e6%84%8f%e5%8a%9b%e6%9b%b4%e5%a5%bd%ef%bc%9f\/","title":{"rendered":"\u80a1\u4ef7\u9884\u6d4b\uff0c\u975e\u7ebf\u6027\u7684\u6ce8\u610f\u529b\u66f4\u597d\uff1f"},"content":{"rendered":"\n<p><a href=\"https:\/\/www.laoyulaoyu.com\/\" target=\"_blank\" rel=\"noreferrer noopener\">\u4f5c\u8005\uff1a\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-large\"><img decoding=\"async\" src=\"https:\/\/www.laoyulaoyu.com\/wp-content\/uploads\/2024\/09\/CASHOUTFINAL-1024x482.jpeg\" alt=\"\" class=\"wp-image-1859\"\/><\/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><mark style=\"background-color:rgba(0, 0, 0, 0)\" class=\"has-inline-color has-vivid-cyan-blue-color\">\u672c\u6587\u63a2\u8ba8\u4e86\u5728 transformer \u6a21\u578b\u4e2d\u4f7f\u7528\u975e\u7ebf\u6027\u6ce8\u610f\u529b\u6765\u9884\u6d4b\u80a1\u7968\u4ef7\u683c\u7684\u6982\u5ff5\u3002<\/mark>\u6211\u4eec\u8ba8\u8bba\u4e86\u9ece\u66fc\u7a7a\u95f4\u548c\u5e0c\u5c14\u4f2f\u7279\u7a7a\u95f4\u7b49\u975e\u7ebf\u6027\u7a7a\u95f4\u7684\u6570\u5b66\u57fa\u7840\uff0c\u89e3\u91ca\u4e86\u4e3a\u4ec0\u4e48\u975e\u7ebf\u6027\u5efa\u6a21\u53ef\u80fd\u662f\u6709\u5229\u7684\uff0c\u5e76\u63d0\u4f9b\u4e86\u5728\u4ee3\u7801\u4e2d\u5b9e\u73b0\u8fd9\u79cd\u65b9\u6cd5\u7684\u5206\u6b65\u6307\u5357\u3002<\/pre>\n<\/blockquote>\n\n\n\n<p>\u8fd1\u5e74\u6765\uff0cTransformer \u7684\u4f7f\u7528\u5f7b\u5e95\u6539\u53d8\u4e86\u81ea\u7136\u8bed\u8a00\u5904\u7406\uff0c\u5e76\u8d8a\u6765\u8d8a\u591a\u5730\u6539\u53d8\u4e86\u5176\u4ed6\u5404\u79cd\u9886\u57df\uff0c\u4f8b\u5982<strong>\u65f6\u95f4\u5e8f\u5217\u5206\u6790\u548c\u80a1\u7968\u4ef7\u683c\u9884\u6d4b<\/strong>\u3002\u4f20\u7edf\u7684 transformer \u67b6\u6784\u4f9d\u8d56\u4e8e\u7ebf\u6027\u70b9\u79ef\u6ce8\u610f\u529b\u673a\u5236\uff0c\u8be5\u673a\u5236\u9002\u7528\u4e8e\u8bb8\u591a\u4efb\u52a1\u3002\u4f46\u662f\uff0c\u8fd9\u79cd\u7ebf\u6027\u65b9\u6cd5\u53ef\u80fd\u65e0\u6cd5\u6355\u83b7\u67d0\u4e9b\u6570\u636e\u96c6\uff08\u4f8b\u5982\u80a1\u7968\u4ef7\u683c\uff09\u4e2d\u5173\u7cfb\u7684\u5168\u90e8\u590d\u6742\u6027\uff0c\u5176\u4e2d\u975e\u7ebf\u6027\u4f9d\u8d56\u5173\u7cfb\u548c\u590d\u6742\u6a21\u5f0f\u66f4\u4e3a\u666e\u904d\u3002<\/p>\n\n\n\n<h3 class=\"wp-block-heading\"><strong>\u4e00\u3001\u4e86\u89e3\u975e\u7ebf\u6027\u7a7a\u95f4\uff1a\u9ece\u66fc\u7a7a\u95f4\u548c\u5e0c\u5c14\u4f2f\u7279\u7a7a\u95f4<\/strong><\/h3>\n\n\n\n<p>\u4e3a\u4e86\u7406\u89e3\u4e3a\u4ec0\u4e48\u975e\u7ebf\u6027\u6ce8\u610f\u529b\u673a\u5236\u53ef\u80fd\u6709\u7528\uff0c\u6211\u4eec\u9700\u8981\u6df1\u5165\u7814\u7a76\u51e0\u4f55\u548c\u6cdb\u51fd\u5206\u6790\u7684\u4e00\u4e9b\u57fa\u672c\u6982\u5ff5\u3002\u8ba9\u6211\u4eec\u4ece\u673a\u5668\u5b66\u4e60\u4e2d\u5e38\u7528\u7684\u6b27\u51e0\u91cc\u5f97\u7a7a\u95f4\u4e0e\u9ece\u66fc\u7a7a\u95f4\u548c\u5e0c\u5c14\u4f2f\u7279\u7a7a\u95f4\u7b49\u66f4\u590d\u6742\u7684\u7a7a\u95f4\u4e4b\u95f4\u7684\u533a\u522b\u5f00\u59cb\u3002<\/p>\n\n\n\n<p><strong>1. \u6b27\u51e0\u91cc\u5f97\u7a7a\u95f4<\/strong><\/p>\n\n\n\n<p>\u6b27\u51e0\u91cc\u5f97\u7a7a\u95f4\u662f\u6211\u4eec\u5728\u521d\u7b49\u51e0\u4f55\u5b66\u4e2d\u5b66\u4e60\u7684\u719f\u6089\u7684\u5e73\u9762\u7a7a\u95f4\u3002\u6b64\u7a7a\u95f4\u4e2d\u7684\u8ddd\u79bb\u4f7f\u7528\u6b27\u51e0\u91cc\u5f97\u8ddd\u79bb\u516c\u5f0f\u8fdb\u884c\u6d4b\u91cf\uff0c\u70b9\u79ef\u7528\u4e8e\u6d4b\u91cf\u5411\u91cf\u4e4b\u95f4\u7684\u76f8\u4f3c\u6027\u3002\u5728\u4f20\u7edf\u7684 transformer \u4e2d\uff0c\u6ce8\u610f\u529b\u673a\u5236\u5728\u8fd9\u4e2a\u6b27\u51e0\u91cc\u5f97\u7a7a\u95f4\u4e2d\u8fd0\u884c\u3002<\/p>\n\n\n\n<p><strong>2. \u9ece\u66fc\u7a7a\u95f4<\/strong><\/p>\n\n\n\n<p>\u9ece\u66fc\u7a7a\u95f4\u662f\u5141\u8bb8\u66f2\u7387\u7684\u6b27\u51e0\u91cc\u5f97\u7a7a\u95f4\u7684\u6cdb\u5316\u3002\u5728\u9ece\u66fc\u7a7a\u95f4\u4e2d\uff0c\u6d4b\u91cf\u8ddd\u79bb\u548c\u89d2\u5ea6\u7684\u5ea6\u91cf\u53ef\u80fd\u56e0\u70b9\u800c\u5f02\uff0c\u4ece\u800c\u5141\u8bb8\u7a7a\u95f4\u4ee5\u590d\u6742\u7684\u65b9\u5f0f\u5f2f\u66f2\u3002\u8fd9\u79cd\u66f2\u7387\u4f7f\u6211\u4eec\u80fd\u591f\u5bf9\u66f4\u590d\u6742\u7684\u5173\u7cfb\u548c\u4f9d\u8d56\u5173\u7cfb\u8fdb\u884c\u5efa\u6a21\uff0c\u800c\u8fd9\u4e9b\u5173\u7cfb\u548c\u4f9d\u8d56\u5173\u7cfb\u5728\u5e73\u5766\u7684\u7ebf\u6027\u7a7a\u95f4\u4e2d\u65e0\u6cd5\u5145\u5206\u6355\u83b7\u3002<\/p>\n\n\n\n<p><strong>3. \u5e0c\u5c14\u4f2f\u7279\u7a7a\u95f4<\/strong><\/p>\n\n\n\n<p>\u5e0c\u5c14\u4f2f\u7279\u7a7a\u95f4\u662f\u6b27\u51e0\u91cc\u5f97\u7a7a\u95f4\u7684\u65e0\u9650\u7ef4\u6cdb\u5316\uff0c\u914d\u5907\u4e86\u4e00\u4e2a\u5b8c\u6574\u7684\u5185\u79ef\u3002\u5b83\u662f\u6cdb\u51fd\u5206\u6790\u548c\u91cf\u5b50\u529b\u5b66\u4e2d\u7684\u4e00\u4e2a\u57fa\u672c\u6982\u5ff5\uff0c\u4e3a\u7406\u89e3\u5177\u6709\u6f5c\u5728\u65e0\u9650\u7ef4\u5ea6\u7684\u7a7a\u95f4\u63d0\u4f9b\u4e86\u4e00\u4e2a\u6846\u67b6\u3002\u5f53\u6211\u4eec\u4f7f\u7528\u6838\u65b9\u6cd5\uff08\u5982 Gaussian \u6216 Radial Basis Function \u5185\u6838\uff09\u65f6\uff0c\u6211\u4eec\u4f1a\u5c06\u6570\u636e\u4ece\u6709\u9650\u7ef4\u6b27\u51e0\u91cc\u5f97\u7a7a\u95f4\u9690\u5f0f\u6620\u5c04\u5230\u65e0\u9650\u7ef4\u5e0c\u5c14\u4f2f\u7279\u7a7a\u95f4\u3002<\/p>\n\n\n\n<h3 class=\"wp-block-heading\"><strong>\u4e8c\u3001\u4e3a\u4ec0\u4e48\u975e\u7ebf\u6027\u6ce8\u610f\u529b\u53ef\u80fd\u662f\u4e00\u4e2a\u597d\u4e3b\u610f<\/strong><\/h3>\n\n\n\n<p>\u80a1\u7968\u4ef7\u683c\u9884\u6d4b\u672c\u8d28\u4e0a\u662f\u975e\u7ebf\u6027\u7684\u3002\u4ef7\u683c\u53d7\u591a\u79cd\u56e0\u7d20\u5f71\u54cd\uff0c\u5305\u62ec\u7ecf\u6d4e\u6307\u6807\u3001\u65b0\u95fb\u4e8b\u4ef6\u3001\u6295\u8d44\u8005\u60c5\u7eea\u548c\u5e02\u573a\u5fae\u89c2\u7ed3\u6784\u3002\u8fd9\u4e9b\u5173\u7cfb\u901a\u5e38\u662f\u590d\u6742\u7684\u3001\u975e\u7ebf\u6027\u7684\u548c\u9ad8\u7ef4\u7684\u3002\u901a\u8fc7\u4f7f\u7528\u975e\u7ebf\u6027\u6ce8\u610f\u529b\u673a\u5236\uff0c\u6211\u4eec\u53ef\u4ee5\u5c06\u8f93\u5165\u6570\u636e\u6620\u5c04\u5230\u66f4\u9ad8\u7ef4\u7684\u7a7a\u95f4\uff0c\u5728\u90a3\u91cc\u8fd9\u4e9b\u590d\u6742\u7684\u5173\u7cfb\u53ef\u80fd\u4f1a\u53d8\u5f97\u66f4\u52a0\u7ebf\u6027\u4e14\u66f4\u5bb9\u6613\u5efa\u6a21\u3002<\/p>\n\n\n\n<p>\u4ece\u672c\u8d28\u4e0a\u8bb2\uff0c\u4f7f\u7528\u975e\u7ebf\u6027\u6ce8\u610f\u529b\u6709\u52a9\u4e8e\uff1a<\/p>\n\n\n\n<p><strong>&#8211; \u6355\u83b7\u6570\u636e\u4e2d\u590d\u6742\u7684\u975e\u7ebf\u6027\u4f9d\u8d56\u5173\u7cfb\u3002<br>&#8211; \u63d0\u4f9b\u66f4\u4e30\u5bcc\u7684\u6570\u636e\u70b9\u4e4b\u95f4\u5173\u7cfb\u8868\u793a\u5f62\u5f0f\uff0c\u4ece\u800c\u6709\u53ef\u80fd\u63d0\u9ad8\u9884\u6d4b\u6027\u80fd\u3002<br>&#8211; \u5229\u7528\u5185\u6838\u51fd\u6570\u63d0\u4f9b\u7684\u5230\u66f4\u9ad8\u7ef4\u5ea6\u7684\u9690\u5f0f\u6620\u5c04\uff0c\u4f7f\u6211\u4eec\u80fd\u591f\u53d1\u73b0\u7ebf\u6027\u65b9\u6cd5\u53ef\u80fd\u9057\u6f0f\u7684\u6a21\u5f0f\u3002<\/strong><\/p>\n\n\n\n<h3 class=\"wp-block-heading\"><strong>\u4e09\u3001\u5177\u6709\u975e\u7ebf\u6027\u6ce8\u610f\u529b\u7684 Transformer<\/strong><\/h3>\n\n\n\n<p>\u4e3a\u4e86\u5b9e\u73b0\u5177\u6709\u975e\u7ebf\u6027\u6ce8\u610f\u529b\u7684 transformer \u6a21\u578b\uff0c\u6211\u4eec\u5f15\u5165\u4e86\u4e00\u79cd\u57fa\u4e8e\u5185\u6838\u7684\u81ea\u5b9a\u4e49\u6ce8\u610f\u529b\u673a\u5236\u3002\u4f20\u7edf\u7684 transformer \u4f7f\u7528\u70b9\u79ef\u6ce8\u610f\u529b\uff0c\u8fd9\u662f inputs \u7684\u7ebf\u6027\u51fd\u6570\u3002\u6211\u4eec\u7684\u975e\u7ebf\u6027\u6ce8\u610f\u529b\u673a\u5236\u4f7f\u7528\u6838\u51fd\u6570\uff08\u4f8b\u5982 Gaussian \u6216 Radial Basis Function \u5185\u6838\uff09\u6765\u8ba1\u7b97\u6ce8\u610f\u529b\u5206\u6570\u3002<\/p>\n\n\n\n<p>\u975e\u7ebf\u6027\u6ce8\u610f\u529b\u673a\u5236\uff1a<\/p>\n\n\n\n<p>1. \u5185\u6838\u6ce8\u610f\u529b\u5c42<\/p>\n\n\n\n<p>KernelAttention \u7c7b\u4f7f\u7528\u67e5\u8be2 \uff08Q\uff09 \u548c\u952e \uff08K\uff09 \u77e9\u9635\u4e4b\u95f4\u7684\u6b27\u51e0\u91cc\u5f97\u8ddd\u79bb\u8ba1\u7b97\u6210\u5bf9\u8ddd\u79bb\u77e9\u9635\u3002\u7136\u540e\u4f7f\u7528\u9ad8\u65af\u6838\u8f6c\u6362\u6b64\u8ddd\u79bb\uff0c\u8be5\u6838\u5c06\u6570\u636e\u6620\u5c04\u5230\u66f4\u9ad8\u7ef4\u7684\u7a7a\u95f4\u3002\u7ed3\u679c\u662f\u53cd\u6620\u6570\u636e\u4e2d\u975e\u7ebf\u6027\u5173\u7cfb\u7684\u6ce8\u610f\u529b\u6743\u91cd\u77e9\u9635\u3002<\/p>\n\n\n\n<p>2. \u7ebf\u6027\u6ce8\u610f\u529b\u5c42<\/p>\n\n\n\n<p>\u4e3a\u4e86\u8fdb\u884c\u6bd4\u8f83\uff0c\u6211\u4eec\u8fd8\u4f7f\u7528 PyTorch \u7684\u5185\u7f6e MultiheadAttention \u7c7b\u5b9e\u73b0\u4e86\u6807\u51c6\u7684\u7ebf\u6027\u6ce8\u610f\u529b\u673a\u5236\u3002\u8be5\u5c42\u5bf9 inputs \u6267\u884c\u4f20\u7edf\u7684\u70b9\u79ef\u5173\u6ce8\u3002<\/p>\n\n\n\n<p>3. Transformer Decoder \u6a21\u578b<\/p>\n\n\n\n<p>transformer \u89e3\u7801\u5668\u6a21\u578b\u88ab\u8bbe\u8ba1\u4e3a\u63a5\u53d7\u7ebf\u6027\u548c\u975e\u7ebf\u6027\u6ce8\u610f\u529b\u673a\u5236\uff0c\u5141\u8bb8\u6211\u4eec\u76f4\u63a5\u6bd4\u8f83\u5b83\u4eec\u7684\u6709\u6548\u6027\u3002\u8f93\u5165\u5e8f\u5217\u9996\u5148\u901a\u8fc7\u7ebf\u6027\u5c42\u5c06\u5176\u8f6c\u6362\u4e3a\u6240\u9700\u7684\u7ef4\u6570\uff0c\u7136\u540e\u662f\u9009\u5b9a\u7684\u6ce8\u610f\u529b\u673a\u5236\uff0c\u6700\u540e\u662f\u53e6\u4e00\u4e2a\u7ebf\u6027\u5c42\u6765\u8f93\u51fa\u9884\u6d4b\u3002<\/p>\n\n\n\n<h3 class=\"wp-block-heading\"><strong>\u56db\u3001\u4ee3\u7801\u89e3\u91ca<\/strong><\/h3>\n\n\n\n<p>\u4ee3\u7801\u5b9e\u73b0\u5305\u62ec\u6570\u636e\u52a0\u8f7d\u3001\u9884\u5904\u7406\u3001\u6a21\u578b\u5b9a\u4e49\u3001\u8bad\u7ec3\u548c\u8bc4\u4f30\u3002\u4ee5\u4e0b\u662f\u5173\u952e\u7ec4\u4ef6\uff1a<\/p>\n\n\n\n<p>1. \u6570\u636e\u51c6\u5907\uff1a\u6211\u4eec\u4f7f\u7528 yfinance \u5e93\u4e0b\u8f7d Reliance Industries \u7684\u5386\u53f2\u80a1\u7968\u6570\u636e\u3002\u4f7f\u7528 MinMaxScaler \u5bf9\u6570\u636e\u8fdb\u884c\u9884\u5904\u7406\u548c\u89c4\u8303\u5316\u3002<\/p>\n\n\n\n<p>2. \u5e8f\u5217\u521b\u5efa\uff1a\u4f7f\u7528\u6ed1\u52a8\u7a97\u53e3\u65b9\u6cd5\u521b\u5efa\u8f93\u5165\u5e8f\u5217\u548c\u76f8\u5e94\u7684\u6807\u7b7e\u4ee5\u8fdb\u884c\u8bad\u7ec3\u3002<\/p>\n\n\n\n<p>3. \u6a21\u578b\u67b6\u6784\uff1aTransformerDecoder \u7c7b\u5b9a\u4e49\u4e86\u7ebf\u6027\u548c\u975e\u7ebf\u6027\u6ce8\u610f\u529b\u673a\u5236\u7684\u9009\u9879\u3002<strong>KernelAttention \u7c7b\u4f7f\u7528 Gaussian \u5185\u6838\u5b9e\u73b0\u975e\u7ebf\u6027\u6ce8\u610f\u529b<\/strong>\u3002<\/p>\n\n\n\n<p>4. \u8bad\u7ec3\u548c\u8bc4\u4f30\uff1a\u5b9e\u73b0\u4e86\u4e00\u4e2a train_model \u51fd\u6570\u6765\u8bad\u7ec3\u548c\u8bc4\u4f30\u7ebf\u6027\u548c\u975e\u7ebf\u6027\u6ce8\u610f\u529b\u6a21\u578b\u3002\u8be5\u51fd\u6570\u8ba1\u7b97\u8bad\u7ec3\u96c6\u548c\u6d4b\u8bd5\u96c6\u7684\u635f\u5931\u3001\u5e73\u5747\u7edd\u5bf9\u8bef\u5dee \uff08MAE\uff09 \u548c\u5e73\u5747\u7edd\u5bf9\u767e\u5206\u6bd4\u8bef\u5dee \uff08MAPE\uff09\u3002<\/p>\n\n\n\n<p>5. \u53ef\u89c6\u5316\uff1amatplotlib \u7528\u4e8e\u7ed8\u5236\u635f\u5931\u66f2\u7ebf\u5e76\u6bd4\u8f83\u4e24\u4e2a\u6a21\u578b\u7684\u5b9e\u9645\u4ef7\u683c\u4e0e\u9884\u6d4b\u4ef7\u683c\u3002<\/p>\n\n\n\n<h3 class=\"wp-block-heading\"><strong>\u4e94\u3001\u7ed3\u679c<\/strong><\/h3>\n\n\n\n<p>\u975e\u7ebf\u6027\u6ce8\u610f\u529b\uff1a\u8bad\u7ec3\u96c6MAE\uff1a397.4294\uff0c\u8bad\u7ec3\u96c6 MAPE\uff1a23.40% \u975e\u7ebf\u6027\u6ce8\u610f\u529b\uff1a\u6d4b\u8bd5\u96c6 MAE\uff1a39.6702\uff0c\u6d4b\u8bd5\u96c6 MAPE\uff1a1.69%<\/p>\n\n\n\n<p>\u7ebf\u6027\u6ce8\u610f\u529b\uff1a\u8bad\u7ec3\u96c6 MAE\uff1a397.2669\uff0c\u8bad\u7ec3\u96c6 MAPE\uff1a23.18% \u7ebf\u6027\u6ce8\u610f\u529b\uff1a\u6d4b\u8bd5\u96c6 MAE\uff1a48.4979\uff0c\u6d4b\u8bd5\u96c6 MAPE\uff1a2.07%<\/p>\n\n\n\n<p>\u5728\u8bad\u7ec3\u96c6\u4e2d<\/p>\n\n\n\n<figure class=\"wp-block-image size-full\"><img decoding=\"async\" src=\"https:\/\/www.laoyulaoyu.com\/wp-content\/uploads\/2024\/09\/\u5fae\u4fe1\u56fe\u7247_20240909213549.png\" alt=\"\" class=\"wp-image-1860\"\/><\/figure>\n\n\n\n<p>\u5728\u6d4b\u8bd5\u96c6\u4e0a<\/p>\n\n\n\n<figure class=\"wp-block-image size-full\"><img decoding=\"async\" src=\"https:\/\/www.laoyulaoyu.com\/wp-content\/uploads\/2024\/09\/\u5fae\u4fe1\u56fe\u7247_20240909213450.png\" alt=\"\" class=\"wp-image-1861\"\/><\/figure>\n\n\n\n<p><\/p>\n\n\n\n<h3 class=\"wp-block-heading\"><strong>\u516d\u3001\u7ed3\u8bba<\/strong><\/h3>\n\n\n\n<p>\u901a\u8fc7\u5b9e\u73b0\u5177\u6709\u975e\u7ebf\u6027\u6ce8\u610f\u529b\u7684 transformer\uff0c\u4e0e\u7ebf\u6027\u6ce8\u610f\u529b\u673a\u5236\u76f8\u6bd4\uff0c\u6211\u4eec\u6709\u53ef\u80fd\u5728\u80a1\u7968\u4ef7\u683c\u6570\u636e\u4e2d\u6355\u83b7\u66f4\u590d\u6742\u7684\u6a21\u5f0f\u3002\u6211\u4eec\u7684\u5b9e\u9a8c\u7ed3\u679c\u63d0\u4f9b\u4e86\u4e24\u79cd\u65b9\u6cd5\u4e4b\u95f4\u7684\u6bd4\u8f83\uff0c\u5c55\u793a\u4e86\u975e\u7ebf\u6027\u6ce8\u610f\u529b\u5982\u4f55\u5728\u635f\u5931\u3001MAE \u548c MAPE \u65b9\u9762\u63d0\u4f9b\u66f4\u597d\u7684\u6027\u80fd\u3002<\/p>\n\n\n\n<p>\u8fd9\u79cd\u65b9\u6cd5\u5c55\u793a\u4e86\u4ece\u9ece\u66fc\u51e0\u4f55\u548c\u6cdb\u51fd\u5206\u6790\u5230\u91d1\u878d\u65f6\u95f4\u5e8f\u5217\u9884\u6d4b\u7684\u6982\u5ff5\u7684\u5b9e\u9645\u5e94\u7528\u3002\u901a\u8fc7\u5229\u7528\u975e\u7ebf\u6027\u6ce8\u610f\u529b\u673a\u5236\uff0c\u6211\u4eec\u4e3a\u91d1\u878d\u4ee5\u5916\u7684\u5404\u4e2a\u9886\u57df\u7684\u590d\u6742\u5173\u7cfb\u5efa\u6a21\u5f00\u8f9f\u4e86\u65b0\u7684\u53ef\u80fd\u6027\u3002\u6b64\u5904\u4ecb\u7ecd\u7684\u4ee3\u7801\u548c\u65b9\u6cd5\u53ef\u4f5c\u4e3a\u8fdb\u4e00\u6b65\u63a2\u7d22\u548c\u5b9e\u9a8c\u7684\u8d77\u70b9\u3002\u7814\u7a76\u4eba\u5458\u548c\u4ece\u4e1a\u8005\u53ef\u4ee5\u57fa\u4e8e\u6b64\u6846\u67b6\u5f00\u53d1\u66f4\u590d\u6742\u7684\u6a21\u578b\u3001\u5408\u5e76\u5176\u4ed6\u529f\u80fd\u6216\u5c06\u7c7b\u4f3c\u6280\u672f\u5e94\u7528\u4e8e\u5176\u4ed6\u65f6\u95f4\u5e8f\u5217\u9884\u6d4b\u4efb\u52a1\u3002\u968f\u7740\u6211\u4eec\u4e0d\u65ad\u7a81\u7834\u673a\u5668\u5b66\u4e60\u548c\u4eba\u5de5\u667a\u80fd\u7684\u754c\u9650\uff0c\u5c06\u9ad8\u7ea7\u6570\u5b66\u6982\u5ff5\u4e0e\u5b9e\u9645\u5b9e\u73b0\u76f8\u7ed3\u5408\u5bf9\u4e8e\u5f00\u53d1\u66f4\u5f3a\u5927\u3001\u66f4\u51c6\u786e\u7684\u9884\u6d4b\u6a21\u578b\u81f3\u5173\u91cd\u8981\u3002<\/p>\n\n\n\n<h3 class=\"wp-block-heading\"><strong>\u4e03\u3001\u4ee3\u7801<\/strong><\/h3>\n\n\n\n<pre class=\"wp-block-code\"><code>import yfinance as yf\nimport numpy as np\nimport pandas as pd\nfrom sklearn.preprocessing import MinMaxScaler\nimport matplotlib.pyplot as plt\nimport torch\nfrom torch.utils.data import DataLoader, Dataset\nimport torch.nn as nn\nimport torch.nn.functional as F\n\n# Load Reliance historical data\ndata = yf.download('RELIANCE.NS', start='2020-01-01', end='2023-01-01')\n\n# Preprocess data\ndata = data&#91;&#91;'Close']].dropna()  # Keep only the 'Close' price and drop any missing values\n\n# Normalize the data\nscaler = MinMaxScaler(feature_range=(0, 1))\ndata&#91;'Close'] = scaler.fit_transform(data&#91;'Close'].values.reshape(-1, 1))\n\n# Create sliding window sequences\ndef create_sequences(data, window_size):\n    sequences = &#91;]\n    labels = &#91;]\n    for i in range(len(data) - window_size):\n        sequences.append(data&#91;i:i + window_size])\n        labels.append(data&#91;i + window_size])\n    return np.array(sequences), np.array(labels)\n\nwindow_size = 30  # Sliding window size of 30 days\nX, y = create_sequences(data&#91;'Close'].values, window_size)\ntrain_size = int(0.8 * len(X))  # 80% for training\nX_train, X_test = X&#91;:train_size], X&#91;train_size:]\ny_train, y_test = y&#91;:train_size], y&#91;train_size:]\n\n# Convert data to PyTorch tensors\nX_train_tensor = torch.tensor(X_train, dtype=torch.float32).unsqueeze(-1)  # Shape: (batch_size, seq_len, 1)\ny_train_tensor = torch.tensor(y_train, dtype=torch.float32).unsqueeze(-1)  # Shape: (batch_size, 1)\nX_test_tensor = torch.tensor(X_test, dtype=torch.float32).unsqueeze(-1)    # Shape: (batch_size, seq_len, 1)\ny_test_tensor = torch.tensor(y_test, dtype=torch.float32).unsqueeze(-1)    # Shape: (batch_size, 1)\n\n# Create PyTorch Dataset and DataLoader\nclass TimeSeriesDataset(Dataset):\n    def __init__(self, X, y):\n        self.X = X\n        self.y = y\n\n    def __len__(self):\n        return len(self.X)\n\n    def __getitem__(self, idx):\n        return self.X&#91;idx], self.y&#91;idx]\n\ntrain_dataset = TimeSeriesDataset(X_train_tensor, y_train_tensor)\ntest_dataset = TimeSeriesDataset(X_test_tensor, y_test_tensor)\ntrain_loader = DataLoader(train_dataset, batch_size=32, shuffle=True)\ntest_loader = DataLoader(test_dataset, batch_size=32, shuffle=False)\n\n# Define a custom kernel attention layer\nclass KernelAttention(nn.Module):\n    def __init__(self, d_model):\n        super(KernelAttention, self).__init__()\n        self.d_model = d_model\n        self.query_layer = nn.Linear(d_model, d_model)\n        self.key_layer = nn.Linear(d_model, d_model)\n        self.value_layer = nn.Linear(d_model, d_model)\n\n    def forward(self, query, key, value):\n        # Ensure correct tensor shapes for debugging\n        print(f\"Query shape: {query.shape}, Key shape: {key.shape}, Value shape: {value.shape}\")\n\n        # Apply linear transformations\n        Q = self.query_layer(query)\n        K = self.key_layer(key)\n        V = self.value_layer(value)\n\n        print(f\"Transformed Q shape: {Q.shape}, K shape: {K.shape}, V shape: {V.shape}\")\n\n        # Compute pairwise distances and apply Gaussian kernel\n        pairwise_distances = torch.cdist(Q, K, p=2)  # Compute pairwise Euclidean distance\n        kernel_weights = torch.exp(-pairwise_distances ** 2 \/ (2 * 0.5 ** 2))  # Gaussian kernel\n\n        # Apply softmax to obtain attention weights\n        attention_weights = F.softmax(kernel_weights, dim=-1)\n        print(f\"Attention weights shape: {attention_weights.shape}\")\n\n        # Ensure V has shape (batch_size, seq_len, d_model)\n        V = V.view(V.shape&#91;0], -1, self.d_model)  # Reshape V to (batch_size, seq_len, d_model)\n\n        # Compute attention output\n        output = torch.bmm(attention_weights, V)  # Shape: (batch_size, seq_len, d_model)\n        print(f\"Attention output shape: {output.shape}\")\n\n        return output\n\n# Define the Transformer Decoder model with Kernel Attention\nclass TransformerDecoder(nn.Module):\n    def __init__(self, window_size, d_model, output_dim):\n        super(TransformerDecoder, self).__init__()\n        self.kernel_attention = KernelAttention(d_model)\n        self.fc1 = nn.Linear(window_size, d_model)\n        self.fc2 = nn.Linear(d_model, output_dim)\n\n    def forward(self, x):\n        # Reshape input for linear layer\n        x = x.view(x.size(0), -1)  # Flatten from (batch_size, seq_len, 1) to (batch_size, seq_len)\n        x = self.fc1(x)\n        print(f\"Input to kernel attention shape: {x.shape}\")\n\n        # Reshape x to match expected attention input shape\n        x = x.view(x.size(0), -1, self.kernel_attention.d_model)  # Shape: (batch_size, seq_len, d_model)\n        x = self.kernel_attention(x, x, x)  # Self-attention\n        x = F.relu(x)\n        x = torch.mean(x, dim=1)  # Reduce to get fixed output size\n        output = self.fc2(x)\n        print(f\"Model output shape: {output.shape}\")\n\n        return output\n\n# Instantiate the model\nd_model = 64  # Embedding dimension\noutput_dim = 1\nmodel = TransformerDecoder(window_size, d_model, output_dim)\n\n# Define loss and optimizer\ncriterion = nn.MSELoss()\noptimizer = torch.optim.Adam(model.parameters(), lr=0.001)\n\n# Training loop\nepochs = 20\nfor epoch in range(epochs):\n    model.train()\n    total_loss = 0\n    for X_batch, y_batch in train_loader:\n        optimizer.zero_grad()\n        output = model(X_batch)\n        loss = criterion(output, y_batch)\n        loss.backward()\n        optimizer.step()\n        total_loss += loss.item()\n\n    print(f\"Epoch {epoch+1}\/{epochs}, Training Loss: {total_loss \/ len(train_loader)}\")\n\n# Evaluate on test data\nmodel.eval()\ntest_loss = 0\npredictions = &#91;]\nwith torch.no_grad():\n    for X_batch, y_batch in test_loader:\n        output = model(X_batch)\n        loss = criterion(output, y_batch)\n        test_loss += loss.item()\n        predictions.append(output.numpy())\n\nprint(f\"Test Loss: {test_loss \/ len(test_loader)}\")\n\n# Convert predictions back to original scale\npredictions = np.concatenate(predictions).flatten()\ny_test_actual = scaler.inverse_transform(y_test.reshape(-1, 1)).flatten()\npredictions_actual = scaler.inverse_transform(predictions.reshape(-1, 1)).flatten()\n\n# Plotting\nplt.figure(figsize=(10, 6))\nplt.plot(range(len(y_test_actual)), y_test_actual, label='Actual Prices')\nplt.plot(range(len(predictions_actual)), predictions_actual, label='Predicted Prices')\nplt.xlabel('Time')\nplt.ylabel('Price')\nplt.title('Actual vs Predicted Prices for Reliance')\nplt.legend()\nplt.show()\n\nimport yfinance as yf\nimport numpy as np\nimport pandas as pd\nfrom sklearn.preprocessing import MinMaxScaler\nimport matplotlib.pyplot as plt\nimport torch\nfrom torch.utils.data import DataLoader, Dataset\nimport torch.nn as nn\nimport torch.nn.functional as F\n\n# Load Reliance historical data\ndata = yf.download('RELIANCE.NS', start='2020-01-01', end='2023-01-01')\n\n# Preprocess data\ndata = data&#91;&#91;'Close']].dropna()  # Keep only the 'Close' price and drop any missing values\n\n# Normalize the data\nscaler = MinMaxScaler(feature_range=(0, 1))\ndata&#91;'Close'] = scaler.fit_transform(data&#91;'Close'].values.reshape(-1, 1))\n\n# Create sliding window sequences\ndef create_sequences(data, window_size):\n    sequences = &#91;]\n    labels = &#91;]\n    for i in range(len(data) - window_size):\n        sequences.append(data&#91;i:i + window_size])\n        labels.append(data&#91;i + window_size])\n    return np.array(sequences), np.array(labels)\n\nwindow_size = 30  # Sliding window size of 30 days\nX, y = create_sequences(data&#91;'Close'].values, window_size)\ntrain_size = int(0.8 * len(X))  # 80% for training\nX_train, X_test = X&#91;:train_size], X&#91;train_size:]\ny_train, y_test = y&#91;:train_size], y&#91;train_size:]\n\n# Convert data to PyTorch tensors\nX_train_tensor = torch.tensor(X_train, dtype=torch.float32).unsqueeze(-1)  # Shape: (batch_size, seq_len, 1)\ny_train_tensor = torch.tensor(y_train, dtype=torch.float32).unsqueeze(-1)  # Shape: (batch_size, 1)\nX_test_tensor = torch.tensor(X_test, dtype=torch.float32).unsqueeze(-1)    # Shape: (batch_size, seq_len, 1)\ny_test_tensor = torch.tensor(y_test, dtype=torch.float32).unsqueeze(-1)    # Shape: (batch_size, 1)\n\n# Create PyTorch Dataset and DataLoader\nclass TimeSeriesDataset(Dataset):\n    def __init__(self, X, y):\n        self.X = X\n        self.y = y\n\n    def __len__(self):\n        return len(self.X)\n\n    def __getitem__(self, idx):\n        return self.X&#91;idx], self.y&#91;idx]\n\ntrain_dataset = TimeSeriesDataset(X_train_tensor, y_train_tensor)\ntest_dataset = TimeSeriesDataset(X_test_tensor, y_test_tensor)\ntrain_loader = DataLoader(train_dataset, batch_size=32, shuffle=True)\ntest_loader = DataLoader(test_dataset, batch_size=32, shuffle=False)\n\n# Define a custom kernel attention layer\nclass KernelAttention(nn.Module):\n    def __init__(self, d_model):\n        super(KernelAttention, self).__init__()\n        self.d_model = d_model\n        self.query_layer = nn.Linear(d_model, d_model)\n        self.key_layer = nn.Linear(d_model, d_model)\n        self.value_layer = nn.Linear(d_model, d_model)\n\n    def forward(self, query, key, value):\n        # Apply linear transformations\n        Q = self.query_layer(query)\n        K = self.key_layer(key)\n        V = self.value_layer(value)\n\n        # Compute pairwise distances and apply Gaussian kernel\n        pairwise_distances = torch.cdist(Q, K, p=2)  # Compute pairwise Euclidean distance\n        kernel_weights = torch.exp(-pairwise_distances ** 2 \/ (2 * 0.5 ** 2))  # Gaussian kernel\n\n        # Apply softmax to obtain attention weights\n        attention_weights = F.softmax(kernel_weights, dim=-1)\n\n        # Ensure V has shape (batch_size, seq_len, d_model)\n        V = V.view(V.shape&#91;0], -1, self.d_model)  # Reshape V to (batch_size, seq_len, d_model)\n\n        # Compute attention output\n        output = torch.bmm(attention_weights, V)  # Shape: (batch_size, seq_len, d_model)\n\n        return output\n\n# Define the Linear Attention layer for comparison\nclass LinearAttention(nn.Module):\n    def __init__(self, d_model):\n        super(LinearAttention, self).__init__()\n        self.d_model = d_model\n        self.attention = nn.MultiheadAttention(embed_dim=d_model, num_heads=1)\n\n    def forward(self, query, key, value):\n        query = query.permute(1, 0, 2)  # Rearrange for attention layer (seq_len, batch_size, d_model)\n        key = key.permute(1, 0, 2)\n        value = value.permute(1, 0, 2)\n\n        # Perform standard multi-head self-attention\n        output, _ = self.attention(query, key, value)\n        output = output.permute(1, 0, 2)  # Rearrange back to (batch_size, seq_len, d_model)\n        return output\n\n# Define the Transformer Decoder model with both attentions\nclass TransformerDecoder(nn.Module):\n    def __init__(self, window_size, d_model, output_dim, attention_type='nonlinear'):\n        super(TransformerDecoder, self).__init__()\n        if attention_type == 'nonlinear':\n            self.attention_layer = KernelAttention(d_model)\n        elif attention_type == 'linear':\n            self.attention_layer = LinearAttention(d_model)\n        else:\n            raise ValueError(\"Unsupported attention type. Choose either 'linear' or 'nonlinear'.\")\n\n        self.fc1 = nn.Linear(window_size, d_model)\n        self.fc2 = nn.Linear(d_model, output_dim)\n\n    def forward(self, x):\n        # Reshape input for linear layer\n        x = x.view(x.size(0), -1)  # Flatten from (batch_size, seq_len, 1) to (batch_size, seq_len)\n        x = self.fc1(x)\n\n        # Reshape x to match expected attention input shape\n        x = x.view(x.size(0), -1, self.attention_layer.d_model)  # Shape: (batch_size, seq_len, d_model)\n        x = self.attention_layer(x, x, x)  # Attention mechanism\n        x = F.relu(x)\n        x = torch.mean(x, dim=1)  # Reduce to get fixed output size\n        output = self.fc2(x)\n\n        return output\n\n# Train and evaluate both models\ndef train_model(attention_type):\n    # Instantiate the model\n    d_model = 64  # Embedding dimension\n    output_dim = 1\n    model = TransformerDecoder(window_size, d_model, output_dim, attention_type=attention_type)\n\n    # Define loss and optimizer\n    criterion = nn.MSELoss()\n    optimizer = torch.optim.Adam(model.parameters(), lr=0.001)\n\n    # Training loop\n    epochs = 20\n    train_losses = &#91;]\n    test_losses = &#91;]\n\n    for epoch in range(epochs):\n        model.train()\n        total_loss = 0\n        for X_batch, y_batch in train_loader:\n            optimizer.zero_grad()\n            output = model(X_batch)\n            loss = criterion(output, y_batch)\n            loss.backward()\n            optimizer.step()\n            total_loss += loss.item()\n        train_losses.append(total_loss \/ len(train_loader))\n        print(f\"Epoch {epoch+1}\/{epochs} ({attention_type}), Training Loss: {train_losses&#91;-1]}\")\n\n        # Evaluate on test data\n        model.eval()\n        test_loss = 0\n        with torch.no_grad():\n            for X_batch, y_batch in test_loader:\n                output = model(X_batch)\n                loss = criterion(output, y_batch)\n                test_loss += loss.item()\n        test_losses.append(test_loss \/ len(test_loader))\n        print(f\"Epoch {epoch+1}\/{epochs} ({attention_type}), Test Loss: {test_losses&#91;-1]}\")\n\n    # Get predictions for train and test data\n    model.eval()\n    train_predictions = &#91;]\n    test_predictions = &#91;]\n\n    with torch.no_grad():\n        for X_batch, _ in train_loader:\n            train_output = model(X_batch)\n            train_predictions.append(train_output.numpy())\n\n        for X_batch, _ in test_loader:\n            test_output = model(X_batch)\n            test_predictions.append(test_output.numpy())\n\n    train_predictions = np.concatenate(train_predictions).flatten()\n    test_predictions = np.concatenate(test_predictions).flatten()\n\n    # Convert predictions back to original scale\n    y_train_actual = scaler.inverse_transform(y_train.reshape(-1, 1)).flatten()\n    y_test_actual = scaler.inverse_transform(y_test.reshape(-1, 1)).flatten()\n    train_predictions_actual = scaler.inverse_transform(train_predictions.reshape(-1, 1)).flatten()\n    test_predictions_actual = scaler.inverse_transform(test_predictions.reshape(-1, 1)).flatten()\n\n    # Calculate MAE and MAPE\n    mae_train = np.mean(np.abs(y_train_actual - train_predictions_actual))\n    mae_test = np.mean(np.abs(y_test_actual - test_predictions_actual))\n    mape_train = np.mean(np.abs((y_train_actual - train_predictions_actual) \/ y_train_actual)) * 100\n    mape_test = np.mean(np.abs((y_test_actual - test_predictions_actual) \/ y_test_actual)) * 100\n\n    print(f\"Train MAE ({attention_type}): {mae_train:.4f}, Train MAPE ({attention_type}): {mape_train:.2f}%\")\n    print(f\"Test MAE ({attention_type}): {mae_test:.4f}, Test MAPE ({attention_type}): {mape_test:.2f}%\")\n\n    return train_losses, test_losses, y_train_actual, train_predictions_actual, y_test_actual, test_predictions_actual, mae_train, mape_train, mae_test, mape_test\n\n# Train and evaluate nonlinear attention\ntrain_losses_nonlinear, test_losses_nonlinear, y_train_actual, train_predictions_actual_nonlinear, y_test_actual, test_predictions_actual_nonlinear, mae_train_nonlinear, mape_train_nonlinear, mae_test_nonlinear, mape_test_nonlinear = train_model('nonlinear')\n\n# Train and evaluate linear attention\ntrain_losses_linear, test_losses_linear, _, train_predictions_actual_linear, _, test_predictions_actual_linear, mae_train_linear, mape_train_linear, mae_test_linear, mape_test_linear = train_model('linear')\n\n# Plot the loss curves for both models\nplt.figure(figsize=(10, 6))\nplt.plot(train_losses_nonlinear, label='Training Loss (Nonlinear Attention)')\nplt.plot(test_losses_nonlinear, label='Test Loss (Nonlinear Attention)')\nplt.plot(train_losses_linear, label='Training Loss (Linear Attention)')\nplt.plot(test_losses_linear, label='Test Loss (Linear Attention)')\nplt.xlabel('Epochs')\nplt.ylabel('Loss')\nplt.title('Training and Test Loss Curves for Nonlinear and Linear Attention')\nplt.legend()\nplt.show()\n\n# Plot predictions for both models\nplt.figure(figsize=(10, 6))\nplt.plot(range(len(y_train_actual)), y_train_actual, label='Actual Train Prices')\nplt.plot(range(len(train_predictions_actual_nonlinear)), train_predictions_actual_nonlinear, label='Predicted Train Prices (Nonlinear)')\nplt.plot(range(len(train_predictions_actual_linear)), train_predictions_actual_linear, label='Predicted Train Prices (Linear)')\nplt.xlabel('Time')\nplt.ylabel('Price')\nplt.title('Actual vs Predicted Prices for Reliance (Training Data)')\nplt.legend()\nplt.show()\n\nplt.figure(figsize=(10, 6))\nplt.plot(range(len(y_test_actual)), y_test_actual, label='Actual Test Prices')\nplt.plot(range(len(test_predictions_actual_nonlinear)), test_predictions_actual_nonlinear, label='Predicted Test Prices (Nonlinear)')\nplt.plot(range(len(test_predictions_actual_linear)), test_predictions_actual_linear, label='Predicted Test Prices (Linear)')\nplt.xlabel('Time')\nplt.ylabel('Price')\nplt.title('Actual vs Predicted Prices for Reliance (Test Data)')\nplt.legend()\nplt.show()\n\n# Print comparison of MAE and MAPE\nprint(f\"Nonlinear Attention: Train MAE: {mae_train_nonlinear:.4f}, Train MAPE: {mape_train_nonlinear:.2f}%\")\nprint(f\"Nonlinear Attention: Test MAE: {mae_test_nonlinear:.4f}, Test MAPE: {mape_test_nonlinear:.2f}%\")\nprint(f\"Linear Attention: Train MAE: {mae_train_linear:.4f}, Train MAPE: {mape_train_linear:.2f}%\")\nprint(f\"Linear Attention: Test MAE: {mae_test_linear:.4f}, Test MAPE: {mape_test_linear:.2f}%\")\n\n<\/code><\/pre>\n\n\n\n<p><\/p>\n\n\n\n<p><\/p>\n\n\n\n<p><\/p>\n\n\n\n<hr class=\"wp-block-separator has-alpha-channel-opacity\"\/>\n\n\n\n<p><\/p>\n\n\n\n<p><\/p>\n\n\n\n<p><\/p>\n\n\n\n<p class=\"has-text-align-center\"><strong><mark style=\"background-color:#ffffff\" class=\"has-inline-color has-cyan-bluish-gray-color\">\u672c<\/mark><\/strong><strong><mark style=\"background-color:#ffffff\" class=\"has-inline-color has-cyan-bluish-gray-color\">\u6587\u5185\u5bb9\u4ec5\u4ec5\u662f\u6280\u672f\u63a2\u8ba8\u548c\u5b66\u4e60\uff0c\u5e76\u4e0d\u6784\u6210\u4efb\u4f55\u6295\u8d44\u5efa\u8bae\u3002<\/mark><\/strong><\/p>\n\n\n\n<p class=\"has-text-align-center\"><strong><mark style=\"background-color:#ffffff\" class=\"has-inline-color has-cyan-bluish-gray-color\">\u8f6c\u53d1\u8bf7\u6ce8\u660e\u539f\u4f5c\u8005\u548c\u51fa\u5904\u3002<\/mark><\/strong><\/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\/09\/21\/%e8%82%a1%e4%bb%b7%e9%a2%84%e6%b5%8b%ef%bc%8c%e9%9d%9e%e7%ba%bf%e6%80%a7%e7%9a%84%e6%b3%a8%e6%84%8f%e5%8a%9b%e6%9b%b4%e5%a5%bd%ef%bc%9f\/\">Continue reading<span class=\"screen-reader-text\">\u80a1\u4ef7\u9884\u6d4b\uff0c\u975e\u7ebf\u6027\u7684\u6ce8\u610f\u529b\u66f4\u597d\uff1f<\/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-1446","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\/1446","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=1446"}],"version-history":[{"count":4,"href":"https:\/\/laoyulaoyu.com\/index.php\/wp-json\/wp\/v2\/posts\/1446\/revisions"}],"predecessor-version":[{"id":1523,"href":"https:\/\/laoyulaoyu.com\/index.php\/wp-json\/wp\/v2\/posts\/1446\/revisions\/1523"}],"wp:attachment":[{"href":"https:\/\/laoyulaoyu.com\/index.php\/wp-json\/wp\/v2\/media?parent=1446"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/laoyulaoyu.com\/index.php\/wp-json\/wp\/v2\/categories?post=1446"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/laoyulaoyu.com\/index.php\/wp-json\/wp\/v2\/tags?post=1446"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}