Deep learning model for predicting stock prices in Tanzania
Abstract
e prediction models help to provide investors with tools for making better data driven decisions. Machine learning and deep learning techniques have been successively
utilized in various countries to develop these models. However, there is a shortage of literature
on the efforts to exploit these techniques to forecast stock prices in Tanzania. Hence, this study
was conducted to address this gap. The study selected active companiesfrom the Dar es Salaam
Stock Exchange (DSE) and developed Long Short-Term Memory (LSTM), Bidirectional Long
Short-Term Memory (Bi-LSTM) and Gated Recurrent Unit (GRU) models to forecast the next
day closing prices of the companies. Long Short-Term Memory was the overall best model
with a Root Mean Square Error (RMSE) of 4.1818 and Mean Absolute Error (MAE) of 2.1695.
Findings revealed that it was significant to account for the number of outstanding shares of
each company when developing a joint model for forecasting the stock prices of multiple
companies. Specifically, LSTM attained an RMSE of 10.4734 before accounting for
outstanding shares and 4.7424 after accounting for outstanding shares, showing an
improvement of 54.72%. Furthermore, findings showed that investors’ participation attributes
helped to improve prediction accuracy. Specifically, LSTM realized an RMSE of 4.1818 when
these attributes were appended from that of 4.7424 without them, showing an improvement of
11.8%. The resulting model was deployed in a web-based prototype, whereby, end-user
validation results indicated that 76% of respondents rated the system as High in terms of its
forecasting ability. In future, the study recommends exploration of more features.