Prediction of Shanghai Copper Futures Prices Using an Improved LSTM Model
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.