Source-linked AI summary

Deep learning for Stock Market Prediction

Mojtaba Nabipour, Pooyan Nayyeri, Hamed Jabani, Amir Mosavi

arXiv:2004.01497v1q-fin.STcs.LG

TL;DR

Predicting stock-market group values is challenging because stock values are dynamic, non-parametric, and non-linear. The paper evaluates tree-based and neural-network algorithms for regression forecasts of four Tehran Stock Exchange groups across multiple forecast horizons. LSTM achieves the lowest error and best fitting ability overall, although its long runtime is a drawback.

  • Problem

    Stock-value prediction is difficult because values are dynamic, non-parametric, and non-linear.

  • Method

    The study compares six tree-based models and ANN, RNN, and LSTM for stock-group regression prediction.

  • Results

    LSTM is the best overall model, producing the lowest error and strongest fitting ability across the stock-market groups.

  • Takeaways & Limitations

    The study supports using LSTM for these forecasts, while tree-based performance is competitive among AdaBoost, Gradient Boosting, and XGBoost.

  • Takeaways & Limitations

    LSTM has the practical limitation of long runtime.

Abstract

from arXiv · show

Prediction of stock groups' values has always been attractive and challenging for shareholders. This paper concentrates on the future prediction of stock market groups. Four groups named diversified financials, petroleum, non-metallic minerals and basic metals from Tehran stock exchange are chosen for experimental evaluations. Data are collected for the groups based on ten years of historical records. The values predictions are created for 1, 2, 5, 10, 15, 20 and 30 days in advance. The machine learning algorithms utilized for prediction of future values of stock market groups. We employed Decision Tree, Bagging, Random Forest, Adaptive Boosting (Adaboost), Gradient Boosting and eXtreme Gradient Boosting (XGBoost), and Artificial neural network (ANN), Recurrent Neural Network (RNN) and Long short-term memory (LSTM). Ten technical indicators are selected as the inputs into each of the prediction models. Finally, the result of predictions is presented for each technique based on three metrics. Among all the algorithms used in this paper, LSTM shows more accurate results with the highest model fitting ability. Also, for tree-based models, there is often an intense competition between Adaboost, Gradient Boosting, and XGBoost.

1. Introduction

Stock-market prediction is difficult because values are dynamic, non-parametric, and non-linear, while earlier observations and economic factors influence movements. This study addresses a literature emphasis on classification by evaluating machine-learning and neural-network methods for regression forecasts of stock-market groups.

  • Motivation: Earlier records and movement trends are considered vital for predicting stock values effectively.The introduction contrasts this view with the dated market hypothesis that stock values are impossible to predict.
  • Motivation: Stock values are dynamic, non-parametric, and non-linear, weakening the performance of traditional statistical models.The paper frames accurate prediction as difficult for investors and governments assessing market status.
  • Related approaches: Machine learning is presented as able to identify valid information and detect patterns in datasets.The paper positions machine learning as a tool for developing case-specific predictive performance.
  • Related approaches: Ensemble methods have been confirmed to outperform individual methods in time-series prediction, while boosting and bagging are popular approaches.The introduction also describes progress in gradient boosting and XGBoost and the use of deep learning for financial time series.
  • Related approaches: RNNs retain memory of recent events, making them suitable when earlier observations matter in stock-market prediction.The paper contrasts this with ordinary neural networks, which assume consecutive inputs are independent.
  • Study focus: The study evaluates tree-based models and neural networks for regression forecasts of stock-market groups over 1, 2, 5, 10, 15, 20, and 30 days.It targets a research area where most prior studies reportedly focused on classification rather than regression.

2.1. Tree-based models

The paper introduces tree-based models used for prediction, from decision trees and bagging to random forests and boosting methods. These methods combine splitting rules, randomized ensembles, or sequential error correction to form predictive models.

  • Tree-based models: Decision-tree methods summarize splitting rules that divide the predictor space in a tree.The paper presents decision trees as supervised techniques for classification and regression, while noting overfitting in over-complex trees.
  • Decision Tree: Decision Trees learn simple decision rules from data features to predict a target value.They are easy to understand and interpret but can overfit when trees become over-complex.
  • Bagging: Bagging fits basic regressors on random dataset subsets and combines their predictions by voting or averaging.Sampling with replacement and randomization can reduce the variance of an estimator such as a decision tree.
  • Random Forest: Random Forest averages predictions from many decision trees while randomizing training data and feature selection at node splits.Each tree learns from a random sample of the data points.
  • Boosting: Boosting sequentially trains weak learners so later models correct earlier prediction errors.AdaBoost adapts sample weights according to current prediction error, concentrating subsequent models on difficult items.
  • Boosting: Gradient Boosting fits each new predictor to residual errors using gradient descent, whereas XGBoost extends boosting for better speed and performance.XGBoost also includes regularization, missing-data handling, tree pruning, cross-validation, and parallelized tree building.

2.2. Artificial neural networks

The section introduces feedforward ANNs, recurrent networks, and LSTM architectures for processing inputs and sequential stock-market observations. It explains how ANN nodes transform weighted inputs and how recurrent models incorporate prior information.

  • Artificial neural networks: ANNs connect nodes across layers, with input and output layers separated by hidden layers that can make the network deeper.Each node connects to every node in the next layer.
  • Artificial neural networks: Each ANN node passes a weighted sum of inputs plus a bias through an activation function to produce the next node's input.The process proceeds from input to output, and weights and biases are learned during training.
  • Artificial neural networks: ANN training uses forward passes, comparison with targets, and gradient-descent updates during backpropagation.Weights and biases are initialized randomly before iterative adjustment.
  • Recurrent neural networks: RNNs retain previously computed information, making prior observations relevant when predicting stock-market values at a given time.Unlike ordinary networks that assume consecutive inputs are independent, RNNs process sequence items with outputs related to prior values.
  • Long short-term memory: LSTM is a type of RNN that uses cells and forget and output gates to retain values over varying intervals and control information flow.The gates support forgetting old information and learning new information.

3. Research data

The study uses ten years of Tehran Stock Exchange data from four stock-market groups, derives and normalizes ten technical indicators, and evaluates models on prediction horizons from 1 to 30 days. Neural-network time-series models use multiple days of features, while other models use daily feature-target samples.

  • Dataset: Data span November 2009 to November 2019 and cover Diversified Financials, Petroleum, Non-metallic minerals, and Basic metals.The data were acquired from the Tehran Stock Exchange website.
  • Technical indicators: Ten technical indicators are calculated from each group's opening, closing, low, high, and price data and independently normalized.Independent normalization prevents larger-valued indicators from dominating smaller-valued indicators.
  • Model inputs: Non-recurrent models use ten features and one group-index target per sample, whereas RNN and LSTM datasets include features from more than one day.The sequence models vary training days and epochs according to the selected time-series input length.
  • Prediction setup: The models predict each group's target value 1, 2, 5, 10, 15, 20, or 30 days ahead.Datasets are rearranged so each day's ten features correspond to a target at the selected future horizon.
  • Model parameters: Tree-based models use the number of trees as a design parameter, with model-specific parameter values listed in Table 2.Other common tree-model parameters are held identical across models.
  • Model parameters: ANN, RNN, and LSTM parameters include neurons, activation function, optimizer, learning rate, and epochs, with sequence models additionally using training days.The valid neural-network parameter values are listed in Table 3.

4. Results and discussion

The study evaluates tree-based and neural-network models for multi-horizon forecasting across four stock-market groups, using error and goodness-of-fit measures. LSTM performs best overall, while tree-based results vary by group and longer horizons increase errors.

  • Evaluation measures: MAPE measures percentage forecasting accuracy, while MAE measures average absolute prediction error and R2 measures goodness of fit.MAPE uses actual and forecast values; MAE averages absolute differences across samples; R2 ranges from 0 to 1.
  • Forecast horizon: Prediction errors rise as the forecast horizon extends across the algorithms.The reported best-parameter experiments found higher error values for predictions farther ahead.
  • Tree-based models: Decision Tree ranks lowest among tree-based models, while Adaboost performs best on average for Diversified Financials and Petroleum.The comparison covers average performance across the evaluated horizons and groups.
  • Tree-based models: Gradient Boosting performs best on average for Non-metallic minerals and Basic metals, while XGBoost balances accuracy, fitting strength, and runtime.These group-level and multi-criteria comparisons distinguish the strongest tree-based choices by evaluation context.
  • Neural networks: LSTM outperforms RNN significantly and is the strongest overall model, achieving the lowest errors and best fitting ability despite long runtime.ANN generally ranks lowest among the neural-network methods.

5. Conclusion

The paper forecasts four Tehran Stock Exchange stock groups with tree-based and deep-learning regression models using exponentially smoothed technical indicators. LSTM is reported as the top-performing technique, while both model families show potential for stock-group regression.

  • Conclusion: The study forecasts Diversified Financials, Petroleum, Non-metallic minerals, and Basic metals 1, 2, 5, 10, 15, 20, and 30 days ahead.The forecasting task is formulated as regression using tree-based models and ANN, RNN, and LSTM.
  • Conclusion: Exponentially smoothed technical indicators and features were used as prediction-model inputs.The conclusion identifies these transformed indicators as the input features for the forecasting problem.
  • Conclusion: LSTM was the top performer compared with the other techniques.The paper states that LSTM achieved the strongest overall performance in the prediction problem.
  • Conclusion: Tree-based and deep-learning algorithms showed potential for stock-group regression.This is presented as the paper's overall conclusion about the evaluated model families.
Loading 2004.01497v1…