基于改进LSTM模型的沪铜期货价格预测
Prediction of Shanghai Copper Futures Prices Using an Improved LSTM Model
苏耀华1
作者信息
摘要
相对于国内股票价格预测研究,国内大宗商品期货价格的预测研究相对较少.沪铜期货自上市以来其主力连续价格最高价为85500元/吨,最低价格为13670元/吨,对其投资风险可见一斑.本文选取沪铜期货1995年4月17日至2023年12月29日一共6992条的交易数据为测试样本,采用麻雀搜索算法(SSA)对长短期记忆模型(LSTM)进行超参数优化,并进行了优化前后的预测结果对比分析,结果显示:优化后的SSA-LSTM组合模型预测结果优于单独的LSTM模型,平均绝对误差MAE、均方根误差RMSE和平均绝对百分误差MAPE分别下降了16.46%、15.93%、16.98%.另外,从LSTM模型和SSA-LSTM组合模型的预测结果拟合图来看,两个模型的整体拟合效果较好,SSA-LSTM组合模型整体拟合效果优于LSTM模型;从拟合图局部可以清晰的看出,LSTM模型在价格峰值、峰谷的拟合效果要明显差于SSA-LSTM组合模型.无论是从拟合图的整体拟合效果还是局部的拟合效果分析,SSA-LSTM组合模型的拟合效果均优于LSTM模型,再次证明了麻雀搜索算法对LSTM模型的优化在沪铜期货这个标的有效性.
Abstract
Compared to domestic stock price prediction research,there is relatively less research on predicting domestic commodity futures prices.Since its listing,the main continuous price of Shanghai copper futures has reached a high of 85500 yuan/ton and a low of 13670 yuan/ton,indicating its investment risk.This article selects a total of 6992 trading data of Shanghai copper futures from April 17,1995 to December 29,2023 as the test sample.The sparrow search algorithm(SSA)is used to optimize the long short-term memory model(LSTM)hyperparameters,and the prediction results before and after optimization are compared and analyzed.The results show that:the optimized SSA-LSTM combination model has better prediction results than the individual LSTM model,with a decrease in mean absolute error(MAE),root mean square error(RMSE),and mean absolute percentage error(MAPE)of 16.46%,15.93%,and 16.98%,respectively.In addition,from the fitting graphs of the prediction results of the LSTM model and the SSA-LSTM combination model,it can be seen that the overall fitting effect of the two models is good,and the SSA-LSTM combination model has a better overall fitting effect than the LSTM model;From the specific section of the fitted graph,it can be clearly seen that the LSTM model has a significantly worse fitting effect on price peaks and valleys than the SSA-LSTM combination model.Whether analyzing the overall fitting effect or local fitting effect of the fitting graph,the SSA-LSTM combination model has a better fitting effect than the LSTM model,once again proving the effectiveness of the sparrow search algorithm in optimizing the LSTM model for Shanghai copper futures.
关键词
LSTM模型/麻雀搜索算法(SSA)/价格预测Key words
LSTM model/sparrow search algorithm(SSA)/price prediction引用本文复制引用
基金项目
青海民族大学2024年研究生创新项目(65M2024083)
出版年
2024