Application of Long Short-Term Memory (LSTM) in Stock Price Prediction (Published)
No doubt, the stock market has been one of the most volatile and this makes it very difficult to carry out forecast or prediction about the movement in share prices. However, the advent of machine learning is gradually changing the narratives as there are a number of neural networks which could be used to develop models to effectively predict the stock prices. This study examined the application of Long Short-Term Memory algorithms in predicting stock prices using time series data on Apple shares from 2017 to 2022. The closing price of the stocks was adopted and the data split into 98% for training and 2% for test because the study only wanted to make prediction for the last 20 days. TensorFlow together with its subset Keras libraries were employed with other libraries like Dropout for regularization and sklearn for normalization. NumPy to build array, pandas for data analysis were also imported with matplotlib for the purpose of plotting the result graph. The LSTM model was trained to learn from the sequential data and predict the share price. The outcome revealed that the machine learnt very effectively and has a predictive ability for share prices. The model was able to predict the trend or pattern in prices almost accurately.
Keywords: Neural network, long short-term memory, machine learning, recurring neural network