Abstract
Long Short-Term Memory (LSTM) networks and their modified versions, Stacked LSTM, are often used for time series prediction due to their powerful ability to model long-range dependencies. However, few papers have delved into the relationship between the number of layers of LSTM and model performance. For this purpose, this study used LSTM and stacked LSTM at different levels to predict the univariate time series dataset of Apple Inc. stock prices. The goal is to study the relationship between stacking and performance in stock price prediction. The time span in the data is from 2000 to 2022, to discuss whether this relationship and overfitting will damage the model. The results indicate that as long as the model complexity is suitable for the complexity of the dataset, the number of layers is positively correlated with the model performance. It can provide basic knowledge of selecting layers when training other stock market prediction models, which will significantly save time and effort.