Skip to main content
Log in

Predicting Stock Price Using Two-Stage Machine Learning Techniques

  • Published:
Computational Economics Aims and scope Submit manuscript

Abstract

Stock market forecasting is considered to be a challenging topic among time series forecasting. This study proposes a novel two-stage ensemble machine learning model named SVR-ENANFIS for stock price prediction by combining features of support vector regression (SVR) and ensemble adaptive neuro fuzzy inference system (ENANFIS). In the first stage, the future values of technical indicators are forecasted by SVR. In the second stage, ENANFIS is utilized to forecast the closing price based on prediction results of first stage. Finally, the proposed model SVR-ENANFIS is tested on 4 securities randomly selected from the Shanghai and Shenzhen Stock Exchanges with data collected from 2012 to 2017, and the predictions are completed 1–10, 15 and 30 days in advance. The experimental results show that the proposed model SVR-ENANFIS has superior prediction performance than single-stage model ENANFIS and several two-stage models such as SVR-Linear, SVR-SVR, and SVR-ANN.

This is a preview of subscription content, log in via an institution to check access.

Access this article

Price excludes VAT (USA)
Tax calculation will be finalised during checkout.

Instant access to the full article PDF.

Fig. 1
Fig. 2
Fig. 3
Fig. 4
Fig. 5
Fig. 6
Fig. 7

Similar content being viewed by others

References

  • Ali, M., Deo, R. C., Downs, N. J., & Maraseni, T. (2018). An ensemble-anfis based uncertainty assessment model for forecasting multi-scalar standardized precipitation index. Atmospheric Research, 207, 155–180.

    Google Scholar 

  • Ballings, M., Poel, D. V. D., Hespeels, N., & Gryp, R. (2015). Evaluating multiple classifiers for stock price direction prediction. Expert Systems with Applications, 42, 7046–7056.

    Google Scholar 

  • Barak, S., Arjmand, A., & Ortobelli, S. (2017). Fusion of multiple diverse predictors in stock market. Information Fusion, 36, 90–102.

    Google Scholar 

  • Bezdek, J. C. (1973). Fuzzy mathematics in pattern classification, Ph.D. Dissertation, Applied Mathematics, Cornell University.

  • Bollen, J., Mao, H., & Zeng, X. (2011). Twitter mood predicts the stock market. Journal of Computational Science, 2, 1–8.

    Google Scholar 

  • Bollerslev, T. (1986). Generalized autoregressive conditional heteroskedasticity. Journal of Econometricss, 31, 307–327.

    Google Scholar 

  • Booth, A., Gerding, E., & Mcgroarty, F. (2014). Automated trading with performance weighted random forests and seasonality. Expert Systems with Applications, 41, 3651–3661.

    Google Scholar 

  • Box, G., & Jenkins, G. (1976). Time series analysis: Forecasting and control Revised Ed. Journal of Time, 31, 238–242.

    Google Scholar 

  • Breiman, L. (1996). Bagging predictors. Machine Learning, 24, 123–140.

    Google Scholar 

  • Breiman, L. (2001). Random forests. Machine Learning, 45, 5–32.

    Google Scholar 

  • Cao, L., & Tay, F. E. (2001). Financial forecasting using support vector machines. Neural Computing & Applications, 10, 184–192.

    Google Scholar 

  • Chang, P. C., & Liu, C. H. (2008). A TSK type fuzzy rule based system for stock price prediction. Expert Systems with Applications, 34, 135–144.

    Google Scholar 

  • Chen, D. W., & Zhang, J. P. (2005). Time series prediction based on ensemble ANFIS. In 2005 International conference on machine learning and cybernetics (pp. 3552–3556). IEEE.

  • Chen, Y., Bo, Y., & Abraham, A. (2007). Flexible neural trees ensemble for stock index modeling. Neurocomputing, 70, 697–703.

    Google Scholar 

  • Chen, Y., & Hao, Y. (2017). A feature weighted support vector machine and k-nearest neighbor algorithm for stock market indices prediction. Expert Systems with Applications, 80, 340–355.

    Google Scholar 

  • Chiu, S. L. (1994). Fuzzy model identification based on cluster estimation. Journal of Intelligent & Fuzzy Systems, 2, 267–278.

    Google Scholar 

  • Chong, E., Han, C., & Park, F. C. (2017). Deep learning networks for stock market analysis and prediction: Methodology, data representations, and case studies. Expert Systems with Applications, 83, 187–205.

    Google Scholar 

  • Cortes, C., & Vapnik, V. (1995). Support-vector networks. Machine Learning, 20, 273–297.

    Google Scholar 

  • Dietterich, T. G. (1857). Ensemble methods in machine learning. Proceedings of international workshop on multiple classifier systems, 2000 (pp. 1–15).

  • Engle, R. F. (1982). Autoregressive conditional heteroscedasticity with estimates of the variance of united kingdom inflation. Econometrica, 50, 987–1007.

    Google Scholar 

  • Fama, E. F. (1965). The behavior of stock-market prices. The Journal of Business, 38, 34–105.

    Google Scholar 

  • Gavrishchaka, V. V., & Banerjee, S. (2006). Support vector machine as an efficient framework for stock market volatility forecasting. Computational Management Science, 3, 147–160.

    Google Scholar 

  • Guresen, E., Kayakutlu, G., & Daim, T. U. (2011). Using artificial neural network models in stock market index prediction. Expert Systems with Applications, 38, 10389–10397.

    Google Scholar 

  • Gustafson, D.E., & Kessel, W.C. (1979). Fuzzy clustering with a fuzzy covariance matrix. In IEEE conference on decision & control including the symposium on adaptive processes (pp. 761–766). IEEE.

  • Hansen, J. V., & Nelson, R. D. (1997). Neural networks and traditional time series methods: A synergistic combination in state economic forecasts. IEEE Transactions on Neural Networks, 8, 863–873.

    Google Scholar 

  • Hassan, M. R., Nath, B., & Kirley, M. (2007). A fusion model of HMM, ANN and GA for stock market forecasting. Expert Systems with Applications, 33, 171–180.

    Google Scholar 

  • Henrique, B. M., Sobreiro, V. A., & Kimura, H. (2018). Stock price prediction using support vector regression on daily and up to the minute prices. The Journal of Finance and Data Science, 4, 183–201.

    Google Scholar 

  • Huang, H., Wei, X., & Zhou, Y. (2016). A sparse method for least squares twin support vector regression. Neurocomputing, 211, 150–158.

    Google Scholar 

  • Jang, J. S. (1993). Anfis: adaptive-network-based fuzzy inference system. IEEE Transactions on Systems, Man, and Cybernetics, 23, 665–685.

    Google Scholar 

  • Khare, K., Darekar, O., Gupta, P., & Attar, V. (2017). Short term stock price prediction using deep learning. In 2017 2nd IEEE international conference on recent trends in electronics, information & communication technology (RTEICT) (pp. 482–486). IEEE.

  • Kim, K. J. (2003). Financial time series forecasting using support vector machines. Neurocomputing, 55, 307–319.

    Google Scholar 

  • Kim, T., & Kim, H. Y. (2019). Forecasting stock prices with a feature fusion LSTM-CNN model using different representations of the same data. PLoS One, 14, e0212320.

    Google Scholar 

  • Kohavi, R. et al. (1995). A study of cross-validation and bootstrap for accuracy estimation and model selection. In International joint conference on artificial intelligence, Montreal, Canada (Vol. 2, pp. 1137–1145).

  • Kohavi, R., & John, G. H. (1997). Wrappers for feature subset selection. Artificial Intelligence, 97, 273–324.

    Google Scholar 

  • Kourentzes, N., Barrow, D. K., & Crone, S. F. (2014). Neural network ensemble operators for time series forecasting. Expert Systems with Applications, 41, 4235–4244.

    Google Scholar 

  • Liu, C. F., Yeh, C. Y., & Lee, S. J. (2012). Application of type-2 neuro-fuzzy modeling in stock price prediction. Applied Soft Computing, 12, 1348–1358.

    Google Scholar 

  • Long, W., Lu, Z., & Cui, L. (2019). Deep learning-based feature engineering for stock price movement prediction. Knowledge-Based Systems, 164, 163–173.

    Google Scholar 

  • Melin, P., Soto, J., Castillo, O., & Soria, J. (2012). A new approach for time series prediction using ensembles of anfis models. Expert Systems with Applications, 39, 3494–3506.

    Google Scholar 

  • Mostafa, M. M. (2010). Forecasting stock exchange movements using neural networks: Empirical evidence from kuwait. Expert Systems with Applications, 37, 6302–6309.

    Google Scholar 

  • Oztekin, A., Kizilaslan, R., Freund, S., & Iseri, A. (2016). A data analytic approach to forecasting daily stock returns in an emerging market. European Journal of Operational Research, 253, 697–710.

    Google Scholar 

  • Pan, Y., Zhi, X., Wang, X., & Yang, D. (2017). A multiple support vector machine approach to stock index forecasting with mixed frequency sampling. Knowledge-Based Systems, 122, 90–102.

    Google Scholar 

  • Patel, J., Shah, S., Thakkar, P., & Kotecha, K. (2015). Predicting stock market index using fusion of machine learning techniques. Expert Systems with Applications, 42, 2162–2172.

    Google Scholar 

  • Peng, L., Liu, S., Liu, R., & Wang, L. (2018). Effective long short-term memory with differential evolution algorithm for electricity price prediction. Energy, 162, 1301–1314.

    Google Scholar 

  • Pérez-Cruz, F., Afonso-Rodríguez, J. A., & Giner, J. (2003). Estimating GARCH models using support vector machines. Quantitative Finance, 3, 163–172.

    Google Scholar 

  • Qiu, M., Song, Y., & Akagi, F. (2016). Application of artificial neural network for the prediction of stock market returns: The case of the Japanese stock market. Chaos, Solitons & Fractals, 85, 1–7.

    Google Scholar 

  • Qi, M., & Zhang, G. P. (2008). Trend time-series modeling and forecasting with neural networks. IEEE Transactions on Neural Networks, 19, 808–816.

    Google Scholar 

  • Rather, A. M., Agarwal, A., & Sastry, V. N. (2015). Recurrent neural network and a hybrid model for prediction of stock returns. Expert Systems with Applications, 42, 3234–3241.

    Google Scholar 

  • Singh, R., & Srivastava, S. (2017). Stock prediction using deep learning. Multimedia Tools and Applications, 76, 18569–18584.

    Google Scholar 

  • Smith, V. L. (2003). Constructivist and ecological rationality in economics. American Economic Review, 93, 465–508.

    Google Scholar 

  • Svetnik, V., Liaw, A., Tong, C., Culberson, J. C., Sheridan, R. P., & Feuston, B. P. (2003). Random forest: A classification and regression tool for compound classification and qsar modeling. Journal of Chemical Information and Computer Sciences, 43, 1947–1958.

    Google Scholar 

  • Takagi, T., & Sugeno, M. (1983). Derivation of fuzzy control rules from human operator’s control actions. In Proceedings of the IFAC symposium on fuzzy information, knowledge representation and decision analysis (pp. 55–60).

  • Tsai, C. F., & Hsiao, Y. C. (2011). Combining multiple feature selection methods for stock prediction: Union, intersection, and multi-intersection approaches. Decision Support Systems, 50, 258–269.

    Google Scholar 

  • Wang, J., Hou, R., Wang, C., & Shen, L. (2016). Improved v-support vector regression model based on variable selection and brain storm optimization for stock price forecasting. Applied Soft Computing, 49, 164–178.

    Google Scholar 

  • Wang, J. J., Wang, J. Z., Zhang, Z. G., & Guo, S. P. (2012). Stock index forecasting based on a hybrid model. Omega, 40, 758–766.

    Google Scholar 

  • Weng, B., Lu, L., Wang, X., Megahed, F. M., & Martinez, W. (2018). Predicting short-term stock prices using ensemble methods and online data sources. Expert Systems with Applications, 112, 258–273.

    Google Scholar 

  • Yager, R. R., & Filev, D. P. (1994). Generation of fuzzy rules by mountain clustering. Journal of Intelligent & Fuzzy Systems, 2, 209–219.

    Google Scholar 

  • Yeh, C. Y., Huang, C. W., & Lee, S. J. (2011). A multiple-kernel support vector regression approach for stock market price forecasting. Expert Systems with Applications, 38, 2177–2186.

    Google Scholar 

  • Yu, L., Wang, S., & Lai, K. K. (2008). Credit risk assessment with a multistage neural network ensemble learning approach. Expert Systems with Applications, 34, 1434–1444.

    Google Scholar 

  • Yu, L., Wang, S., & Lai, K. K. (2009). A neural-network-based nonlinear metamodeling approach to financial time series forecasting. Applied Soft Computing, 9, 563–574.

    Google Scholar 

  • Zarandi, M. F., Rezaee, B., Turksen, I., & Neshat, E. (2009). A type-2 fuzzy rule-based expert system model for stock price analysis. Expert Systems with Applications, 36, 139–154.

    Google Scholar 

  • Zhang, Y., & Wu, L. (2009). Stock market prediction of S&P 500 via combination of improved BCO approach and BP neural network. Expert Systems with Applications, 36, 8849–8854.

    Google Scholar 

  • Zhao, Y., Li, J., & Yu, L. (2017). A deep learning ensemble approach for crude oil price forecasting. Energy Economics, 66, 9–16.

    Google Scholar 

Download references

Acknowledgements

This research was supported by the National Natural Science Foundation of China (No.71720107002), the Project of High-level Teachers in Beijing Municipal Universities in the Period of 13th Five-year Plan (CIT&TCD20190338), and the Humanity and Social Science Foundation of Ministry of Education of China (No. 19YJAZH005), and the Young Academic Innovation Team of Capital University of Economics and Business of China (No. QNTD202002).

Author information

Authors and Affiliations

Authors

Corresponding author

Correspondence to Wei Chen.

Ethics declarations

Conflict of interest

We declare that we do not have any commercial or associative interest that represents a conflict of interest in connection with the work submitted.

Additional information

Publisher's Note

Springer Nature remains neutral with regard to jurisdictional claims in published maps and institutional affiliations.

Rights and permissions

Reprints and permissions

About this article

Check for updates. Verify currency and authenticity via CrossMark

Cite this article

Zhang, J., Li, L. & Chen, W. Predicting Stock Price Using Two-Stage Machine Learning Techniques. Comput Econ 57, 1237–1261 (2021). https://doi.org/10.1007/s10614-020-10013-5

Download citation

  • Accepted:

  • Published:

  • Issue Date:

  • DOI: https://doi.org/10.1007/s10614-020-10013-5

Keywords

Navigation