Unveiling the Untold: Exploring the Depths of N-BEATS for Stock Price Prediction
The prediction of stock market movements is an evolving research area with numerous theories, models, and approaches proposed in the literature. N-BEATS is a pure deep learning method that utilizes backward and forward residual links with stacked connections and employs the ReLU activation function. It adheres to several principles, including not requiring assumptions such as input scaling or feature engineering.
In this article, I will explore the findings of my undergraduate thesis, where I conducted research on a specific topic to fulfill the requirements of my degree program.
Introduction
The world of financial markets is a dynamic and complex landscape, where the art of predicting stock prices has long been sought after by investors, traders, and analysts alike. While traditional forecasting methods have paved the way for strategic decision-making, the emergence of deep learning has revolutionized the field, offering unparalleled potential for accurate predictions. In this article, we delve into the cutting-edge world of N-BEATS (Neural Basis Expansion Analysis for Time Series), a groundbreaking deep learning framework, and explore its transformative impact on stock price prediction.
Amidst the unpredictability and ever-changing nature of financial markets, the quest for a robust and reliable predictive model has been the holy grail for investors. Traditional methods, such as time series analysis and statistical approaches, have provided valuable insights, but they often fall short in capturing the intricate patterns hidden within vast volumes of market data. This limitation has fueled the rise of deep learning, an AI-driven paradigm that empowers machines to learn from data, adapt, and refine their predictions over time.
Enter N-BEATS, a revolutionary approach to time series forecasting that has taken the financial world by storm. At its core, N-BEATS leverages the power of deep neural networks to process complex time series data and extract meaningful features that govern the dynamics of stock prices. By breaking down the time series into fundamental building blocks, known as basis functions, N-BEATS surpasses conventional models in capturing both short-term fluctuations and long-term trends, resulting in superior predictive accuracy.
In the thesis, N-BEATS is used to predict ISAT and PTBA stock prices, then the error rates will be compared with the baseline Naive Drift and Simple Exponential Smoothing. Furthermore, all three models are evaluated using backtesting. By evaluating the models using backtesting, the error trends over time can be observed. It is found that the N-BEATS model outperforms the other models in predicting stock prices for the next 10 periods.
Result
To perform forecasting using N-BEATS, the parameters used include a lookback period of 15 and a prediction output of 5. The model consists of 10 stacks, with each stack containing 3 blocks. It was trained using the Adam optimizer with an initial learning rate of 0.001 for 25 epochs, using a batch size of 128.
Afterward, the training model is tested and evaluated using backtesting without updating the model with 10 different prediction lengths. Then, the prediction performance of both the baseline model and the N-BEATS model will be compared by comparing the MAPE (Mean Absolute Percentage Error) values as follows.
Conclusion
The comparison above reveals that forecasting using the Naive Drift and Simple Exponential Smoothing methods is suitable for predicting ISAT and PTBA stocks for the next 1–5 days. On the other hand, the N-BEATS method is better suited for predicting stocks 8–10 days ahead. Both methods can be used according to specific needs. For instance, if the model needs to be used in real-time for predictions, the N-BEATS model can be executed every two weeks since it can forecast 10 periods ahead.
If anyone is interested in my thesis and would like to discuss it with me, please contact me via email at: khofifah.fifah160@gmail.com.
reference:
Amat Rodrigo, J., & Escobar Ortiz, J. (2023). Skforecast: Time Series Forecasting with Python and Scikit Learn.
B. N. Oreshkin, G. Dudek, P. Pe lka, E. Turkina. (2020). N-BEATS neural network 300 for mid-term electricity load forecasting.
Bulatov, Alikhan. (2020). Forecasting Bitcoin Prices Using N-BEATS Deep Learning Architecture. Student Theses.
Herzen, J., Lässig, F., Piazzetta, S. G., Neuer, T., Tafti, L. D., Raille, G., Van Pottelbergh, T., Pasieka, M., Skrodzki, A., Huguenin, N., Dumonal, M., Kościsz, J., Bader, D., Gusset, F., Benheddi, M., Williamson, C., Kosinski, M., Petrik, M., & Grosch, G. (2021). Darts: User-Friendly Modern Machine Learning for Time Series. arXiv (Cornell University). https://doi.org/10.48550/arxiv.2110.03224.