Portfolio Selection Using Random Forest Algorithm


  • Daname KOLANI Faculté des sciences juridiques économiques et sociales - Agdal Université Mohammed V de Rabat


Portfolio Selection, Decision Tree, Random Forest, Asset Allocation, Value Investing


Portfolio selection has long been a main topic in finance.  What stocks should one invest in? How much should one allocate to each stock to maximize gain and minimize risk? These are the questions we aim to answer by demonstrating the possibility of obtaining abnormal returns above those offered by the benchmark by constructing a portfolio through a rule-based algorithm called Random Forest with Decision Tree as the base model. The use of Random Forest addresses the problem of over-fitting in the learning process and permits the prediction of a robust portfolio based on financial ratios. This approach has proven to outperform the S&P 500 Index and the Equal-Weight portfolio from 2013 to 2020.


Download data is not yet available.


E. F. Fama and K. R. French, "Dividend yields and expected stock returns," Journal of Financial Economics, vol. 22, p. 325, 1988.

R. J. Balvers, T. F. Cosimano and B. McDonald, "Predicting Stock Returns in an Efficient Market," The Journal of Finance, Vols. 109-1128, no. 4, p. 45, 1990.

E. F. Fama and K. R. French, "The Cross-Section of Expected Stock Returns," The Journal of Finance, vol. 47, pp. 427-465, 1992.

M. H. Pesaran and A. Timmermann, "Predictability of Stock Returns: Robustness and Economic Significance," The Journal of Finance, vol. 50, no. 4, pp. 1201-1228, 1995.

J. Lewellen, "Predicting Returns with Financial Ratios," Journal of Financial Economics, vol. 74, p. 209–235, 2004.

H. M. Markowitz, "Portfolio Selection," Journal of Finance, vol. 7, pp. 77-91, 1952.

J. D. Piotroski, "Value Investing : The Use of Historical Financial Statatement Information to Separate Winners from Losers," Jounal of Accounting Research, vol. 38, pp. 1-41, 2000.

P. N. Kolm, R. Tütüncü and F. J. Fabozzi, "60 Years of portfolio optimization: Practical challenges and current trends," European Journal of Operational Research, vol. 234, no. 2, pp. 356-371, 2014.

T. Hastie, R. Tibshirani and J. Friedman, Elements of Statistical Learning, Springer ed., Springer, 2009.

E. Guresen, G. Kayakutlu and T. U. Daim, "Using artificial neural network models in stock market index prediction," Expert Systems with Applications, vol. 38, pp. 10389-10397, 2011.

S. Lee, D. Enke and Y. Kim, "A relative value trading system based on a correlation and rough set analysis for the foreign exchange futures market," Engineering Applications of Artificial Intelligence, vol. 61, pp. 47-56, 2017.

N. El Karoui, G. Ban and A. E. B. Lim, "Machine Learning and Portfolio Optimization," Management Science, vol. 64, no. 3, pp. 1136-1154, 2018.

T. Conlon, J. Cotter and I. Kynigakis, "Machine Learning and Factor-Based Portfolio Optimization," Michael J. Brennan Irish Finance Working Paper Series, vol. 21, no. 6, p. 89, 2021.

T. Kaczmarek and K. Perez, "Building portfolios based on machine learning predictions," Economic Research-Ekonomska Istraživanja, pp. 1-20, 2021.

L. Breiman, J. Friedman, R. Olshen and C. J. Stone, Classification and Regression Trees (2nd Ed.), Boca Raton: Chapman and Hall/CRC, 1984.

B. Graham and D. Dodd, Security Analysis, Whittlesey House, McGraw-Hill Book Co., 1934.

B. Graham, The Intelligent Investor, Harper & Brothers, 1949.

L. Breiman, "Bagging predictors," Machine Learning, vol. 24, no. 2, pp. 123-140, 1996.

B. Efron, "Bootstrap methods: Another look at the jackknife," The Annals of Statistics, vol. 7, no. 1, pp. 1-26, 1979.

R. O. Michaud and R. O. Michaud, Efficient asset allocation: A practical guide to stock portfolio optimization and asset allocation, Harvard Business School Press, 1998.

L. Breiman, "Random forests," Machine Learning, vol. 45, no. 1, pp. 5-32, 2001.

S. A. Klarman, Margin of Safety: Risk-Averse Value Investing Strategies for the Thoughtful Investor, HarperCollins, 1991.

J. Lintner, "he valuation of risk assets and the selection of risky investments in stock portfolio and capital budgets," Review of Economics and Statistics, pp. 47:13-37, 1965.

W. F. Sharpe, "Capital asset prices: A theory of market equilibrium under conditions of risk," Journal of Finance, pp. 19:425-442, 1964.




How to Cite

KOLANI, D. (2022). Portfolio Selection Using Random Forest Algorithm. International Journal of Computer Engineering and Data Science (IJCEDS), 2(1), 28–36. Retrieved from https://ijceds.com/ijceds/article/view/32