Stock forecasting aims to predict future stock prices based on past price changes in the market, playing an essential role in the field of financial transactions. However, since the stock market is highly uncertain, stock prediction is complex and challenging. This paper uses the long short-term memory (LSTM) model to predict the stock market and compares it with the current stock prediction algorithm. Firstly, we preprocessed the raw dataset and normalized data into the range from 0 to 1. Secondly, we introduced the LSTM model and improved its performance by tuning four parameters: learning rate, number of hidden layers, number of epochs, and batch size. Finally, we use four evaluation metrics to evaluate models: mean average error (MAE), root mean square error (RMSE), coefficient of determination (R2), and mean absolute error percentage (MAPE). Our LSTM model performs better than the previous model in experiments in terms of MAE, RMSE, R2, and MAPE.
Read full abstract