Tesla Stock Close Price Prediction Using KNNR, DTR, SVR, and RFR

. Edward, . Suharjito

Abstract


The growth of every nation's economy depends heavily on the stock market. Because of their strong predictive powers, "K-Nearest Neighbor Regression (KNNR), Random Forest Regression (RFR), Decision Tree Regression (DTR), and Support Vector Regression (SVR)" is commonly used. From the previous study, it shows that the chosen state-of-the-art of previous studies is by Shah et al. (2021) using Bi-LSTM. But the state-of-the-art model shows a high Mean Squared Error (MSE) value that is 5% for predict Tesla Stock. Therefore, we propose the SVR, KNNR, DTR, and RFR model hope error value can be reduced. However, those models have difficulties finding suitable parameters for prediction. Due to that, we proposed the best parameters that were commonly used in studies which is SVR with RBF kernel, C = [1; 10; 100], gamma = [0, 1; 0, 2], epsilon = 0,1, KNNR with K = [1, 3, 5, 7, 9], and DTR with a criterion = [‘squared_error’;’friedman_mse’], RFR with 0 < n_estimators < 100 is picked to enhance the predictive capabilities of each proposed model. To prove this, a comparison is made with each proposed model, and choose the best proposed model then compared to the state-of-the-art of the previous study, which is Bi-LSTM. The dataset used was the Tesla Stock historical data from yahoo finance. The result showed RFR with n_estimators = 87 is superior to its comparison with results of 0.005452 RMSE, 0.000029 MSE, and 0.999296 R2 and compared to Bi-LSTM have about 0.11773 RMSE, 0.01386 MSE, and 0.791263 R2. Based on this study, it can be concluded that RFR with n_estimators = 87 has superior predictive capabilities performance compared with other models and the state-of-the-art of previous studies.

 

Doi: 10.28991/HEF-2022-03-04-01

Full Text: PDF


Keywords


Tesla Stock; Forecasting; Close Price; SVR; KNNR; DTR; RFR.

References


Shah, J., Jain, R., Jolly, V., & Godbole, A. (2021). Stock Market Prediction using Bi-Directional LSTM. 2021 International Conference on Communication Information and Computing Technology (ICCICT). doi:10.1109/iccict50803.2021.9510147.

Pahwa, K., & Agarwal, N. (2019). Stock Market Analysis using Supervised Machine Learning. 2019 International Conference on Machine Learning, Big Data, Cloud and Parallel Computing (COMITCon). doi:10.1109/comitcon.2019.8862225.

Alluch, J. B., Brown, L. V., & Sykes, T. (2018). The Complete Penny Stock Course Learn How to Generate Profits Consistently by Trading Penny Stocks. Millionaire Publishing LLC, Miami, United States.

Akben-Selcuk, E. (2019). Corporate social responsibility and financial performance: The moderating role of ownership concentration in Turkey. Sustainability (Switzerland), 11(13), 1–10. doi:10.3390/su11133643.

Statistik. (2021). Indonesia Stock Exchange. Available online: https://www.idx.co.id/id/data-pasar/laporan-statistik/statistik/ (accessed on March 2022). (In Indonesian).

Barberis, N., Jin, L. J., & Wang, B. (2021). Prospect Theory and Stock Market Anomalies. Journal of Finance, 76(5), 2639–2687. doi:10.1111/jofi.13061.

Suhadak, S., Kurniaty, K., Handayani, S. R., & Rahayu, S. M. (2019). Stock return and financial performance as moderation variable in influence of good corporate governance towards corporate value. Asian Journal of Accounting Research, 4(1), 18–34. doi:10.1108/ajar-07-2018-0021.

Rustam, Z., & Kintandani, P. (2019). Application of Support Vector Regression in Indonesian Stock Price Prediction with Feature Selection Using Particle Swarm Optimisation. Modelling and Simulation in Engineering, 2019, 1–6. doi:10.1155/2019/8962717.

Lien Minh, D., Sadeghi-Niaraki, A., Huy, H. D., Min, K., & Moon, H. (2018). Deep learning approach for short-term stock trends prediction based on two-stream gated recurrent unit network. IEEE Access, 6, 55392–55404. doi:10.1109/ACCESS.2018.2868970.

Sutjipto, E., & Setiawan, W. (2021). Accuracy of dividend discount model and p/e ratio valuation in Indonesia stock exchange. SSRN Electronic Journal. doi:10.2139/ssrn.3865915.

Idrees, S. M., Alam, M. A., & Agarwal, P. (2019). A Prediction Approach for Stock Market Volatility Based on Time Series Data. IEEE Access, 7, 17287–17298. doi:10.1109/ACCESS.2019.2895252.

Thakkar, A., & Chaudhari, K. (2021). Fusion in stock market prediction: A decade survey on the necessity, recent developments, and potential future directions. Information Fusion, 65, 95–107. doi:10.1016/j.inffus.2020.08.019.

Thanathamathee, P., & Sawangarreerak, S. (2022). Discovering Future Earnings Patterns through FP-Growth and ECLAT Algorithms with Optimized Discretization. Emerging Science Journal, 6(6), 1328–1345. doi:10.28991/ESJ-2022-06-06-07.

Picasso, A., Merello, S., Ma, Y., Oneto, L., & Cambria, E. (2019). Technical analysis and sentiment embeddings for market trend prediction. Expert Systems with Applications, 135, 60–70. doi:10.1016/j.eswa.2019.06.014.

Nti, I. K., Adekoya, A. F., & Weyori, B. A. (2020). A systematic review of fundamental and technical analysis of stock market predictions. Artificial Intelligence Review, 53(4), 3007–3057. doi:10.1007/s10462-019-09754-z.

Rubi, M. A., Chowdhury, S., Abdul Rahman, A. A., Meero, A., Zayed, N. M., & Islam, K. M. A. (2022). Fitting Multi-Layer Feed Forward Neural Network and Autoregressive Integrated Moving Average for Dhaka Stock Exchange Price Predicting. Emerging Science Journal, 6(5), 1046–1061. doi:10.28991/esj-2022-06-05-09.

Liang, M., Wu, S., Wang, X., & Chen, Q. (2022). A stock time series forecasting approach incorporating candlestick patterns and sequence similarity. Expert Systems with Applications, 205, 117595. doi:10.1016/j.eswa.2022.117595.

Jeon, S., Hong, B., & Chang, V. (2018). Pattern graph tracking-based stock price prediction using big data. Future Generation Computer Systems, 80, 171–187. doi:10.1016/j.future.2017.02.010.

Fianto, B. A., Ridhwan, M. M., Shah, S. A. A., Faris, M., & Mohd Ruslan, R. A. H. (2022). Response of Financial Markets to COVID-19 Pandemic: A Review of Literature on Stock Markets. Emerging Science Journal, 7, 29–54. doi:10.28991/esj-2023-sper-03.

Polanco-Martínez, J. M. (2019). Dynamic relationship analysis between NAFTA stock markets using nonlinear, nonparametric, non-stationary methods. Nonlinear Dynamics, 97(1), 369–389. doi:10.1007/s11071-019-04974-y.

Rezaei, H., Faaljou, H., & Mansourfar, G. (2021). Stock price prediction using deep learning and frequency decomposition. Expert Systems with Applications, 169, 1–29. doi:10.1016/j.eswa.2020.114332.

Wen, M., Li, P., Zhang, L., & Chen, Y. (2019). Stock market trend prediction using high-order information of time series. IEEE Access, 7, 28299–28308. doi:10.1109/ACCESS.2019.2901842.

Jiang, W. (2021). Applications of deep learning in stock market prediction: Recent progress. Expert Systems with Applications, 184, 1–97. doi:10.1016/j.eswa.2021.115537.

Wall, L. D. (2018). Some financial regulatory implications of artificial intelligence. Journal of Economics and Business, 100, 55–63. doi:10.1016/j.jeconbus.2018.05.003.

Ma, A. (2022). Profitability of technical trading strategies under market manipulation. Financial Innovation, 8(1), 1–9. doi:10.1186/s40854-021-00304-7.

Thomas, V. J., & Maine, E. (2019). Market entry strategies for electric vehicle start-ups in the automotive industry – Lessons from Tesla Motors. Journal of Cleaner Production, 235, 653–663. doi:10.1016/j.jclepro.2019.06.284.

Huang, Y. (2019). A Potential Company or Not: the Analysis of Tesla. Proceedings of the 2019 4th International Conference on Financial Innovation and Economic Development (ICFIED 2019). doi:10.2991/icfied-19.2019.76.

Claudia, O. (2019). Some Insights on the World’s Most Innovative Companies and their Defining Characteristics. Studies in Business and Economics, 14(2), 88–104. doi:10.2478/sbe-2019-0027.

Henrique, B. M., Sobreiro, V. A., & Kimura, H. (2019). Literature review: Machine learning techniques applied to financial market prediction. Expert Systems with Applications, 124, 226–251. doi:10.1016/j.eswa.2019.01.012.

Hu, Z., Zhao, Y., & Khushi, M. (2021). A survey of forex and stock price prediction using deep learning. Applied System Innovation, 4(1), 1–30. doi:10.3390/ASI4010009.

Sharma, D., Singla, S. K., & Sohal, A. K. (2021). Stock Market Prediction Using ARIMA, ANN and SVR. ICCCE 2020, Lecture Notes in Electrical Engineering, 698, Springer, Singapore. doi:10.1007/978-981-15-7961-5_100.

Puspitasari, D. A., & Rustam, Z. (2018). Application of SVM-KNN using SVR as feature selection on stock analysis for Indonesia stock exchange. AIP Conference Proceedings. doi:10.1063/1.5064204.

Hindrayani, K. M., Fahrudin, T. M., Prismahardi Aji, R., & Safitri, E. M. (2020). Indonesian Stock Price Prediction including Covid19 Era Using Decision Tree Regression. 2020 3rd International Seminar on Research of Information Technology and Intelligent Systems (ISRITI). doi:10.1109/isriti51436.2020.9315484.

Ravikumar, S., & Saraf, P. (2020). Prediction of Stock Prices using Machine Learning (Regression, Classification) Algorithms. 2020 International Conference for Emerging Technology (INCET). doi:10.1109/incet49848.2020.9154061.

Bhattacharjee, I., & Bhattacharja, P. (2019). Stock Price Prediction: A Comparative Study between Traditional Statistical Approach and Machine Learning Approach. 2019 4th International Conference on Electrical Information and Communication Technology (EICT). doi:10.1109/eict48899.2019.9068850.

Agrawal, S. C. (2021). Deep learning based non-linear regression for Stock Prediction. IOP Conference Series: Materials Science and Engineering, 1116(1), 012189. doi:10.1088/1757-899x/1116/1/012189.

Marchai, F. L., Martin, W., & Suhartono, D. (2021). Stock Prices Prediction Using Machine Learning. 2021 8th International Conference on Information Technology, Computer and Electrical Engineering (ICITACEE), Semarang, Indonesia. doi:10.1109/icitacee53184.2021.9617222.

Ma, Q. (2020). Comparison of ARIMA, ANN and LSTM for Stock Price Prediction. E3S Web of Conferences, 218. doi:10.1051/e3sconf/202021801026.

Muflikhah, L., & Haryanto, D. J. (2018). High Performance of Polynomial Kernel at SVM Algorithm for Sentiment Analysis. Journal of Information Technology and Computer Science, 3(2), 194–201. doi:10.25126/jitecs.20183260.

Khandakar, A., Chowdhury, M. E. H., Kazi, M. K., Benhmed, K., Touati, F., Al-Hitmi, M., & Gonzales, A. S. P. (2019). Machine learning based photovoltaics (PV) power prediction using different environmental parameters of Qatar. Energies, 12(14), 1–19. doi:10.3390/en12142782.

Chicco, D., Warrens, M. J., & Jurman, G. (2021). The coefficient of determination R-squared is more informative than SMAPE, MAE, MAPE, MSE and RMSE in regression analysis evaluation. PeerJ Computer Science, 7, 1–24. doi:10.7717/PEERJ-CS.623.

Hyndman, R. J., & Athanasopoulos, G. (2018). Forecasting: principles and practice. OTexts Publisher, Australia.

Weng, Q., Liu, R., & Tao, Z. (2022). Forecasting Tesla’s Stock Price Using the ARIMA Model. Proceedings of Business and Economic Studies, 5(5), 38–45. doi:10.26689/pbes.v5i5.4331.

Manurung, A. H., Budiharto, W., & Prabowo, H. (2018). Algorithm and modeling of stock prices forecasting based on long short-term memory (LSTM). ICIC Express Letters, 12(12), 1277–1283. doi:10.24507/icicel.12.12.1277.

Budiharto, W. (2021). Data science approach to stock prices forecasting in Indonesia during Covid-19 using Long Short-Term Memory (LSTM). Journal of Big Data, 8(1). doi:10.1186/s40537-021-00430-0.

Chrysmien, & Jayadi, R. (2022). Comparison Stock Price Prediction Between Arima, Multiple Linear Regression and LSTM Models By Adding Stock Sentiment Analysis and Usd/Idr Fluctuation. Journal of Theoretical and Applied Information Technology, 100(4), 1158–1169.

Haryadi, D., Hakim, A. R., Atmaja, D. M. U., & Yutia, S. N. (2022). Implementation of Support Vector Regression for Polkadot Cryptocurrency Price Prediction. International Journal on Informatics Visualization, 6(1–2), 201–207. doi:10.30630/joiv.6.1-2.945.

Hamami, F., & Fithriyah, I. (2020). Classification of Air Pollution Levels using Artificial Neural Network. 2020 International Conference on Information Technology Systems and Innovation (ICITSI). doi:10.1109/icitsi50517.2020.9264910.

Alawsi, M. A., Zubaidi, S. L., Al-Bdairi, N. S. S., Al-Ansari, N., & Hashim, K. (2022). Drought Forecasting: A Review and Assessment of the Hybrid Techniques and Data Pre-Processing. Hydrology, 9(7), 1–23. doi:10.3390/hydrology9070115.

Hung, C.-C., & Chen, Y.-J. (2021). DPP: Deep predictor for price movement from candlestick charts. PLOS ONE, 16(6), e0252404. doi:10.1371/journal.pone.0252404.

Mathew, A., Sreekumar, S., Khandelwal, S., & Kumar, R. (2019). Prediction of land surface temperatures for surface urban heat island assessment over Chandigarh city using support vector regression model. Solar Energy, 186, 404–415. doi:10.1016/j.solener.2019.04.001.

Zhong, H., Wang, J., Jia, H., Mu, Y., & Lv, S. (2019). Vector field-based support vector regression for building energy consumption prediction. Applied Energy, 242, 403–414. doi:10.1016/j.apenergy.2019.03.078.

Wu, J., Liu, H., Wei, G., Song, T., Zhang, C., & Zhou, H. (2019). Flash flood forecasting using support vector regression model in a small mountainous catchment. Water (Switzerland), 11(7), 1–16. doi:10.3390/w11071327.

Afzal, P., Farhadi, S., Konari, M. B., Meigoony, M. S., & Saein, L. D. (2022). Geochemical anomaly detection in the Irankuh District using Hybrid Machine learning technique and fractal modeling. Geopersia, 12(1), 191–199. doi:10.22059/GEOPE.2022.336072.648644.

Luken, K. J., Norris, R. P., & Park, L. A. F. (2019). Preliminary results of using k-nearest-neighbor regression to estimate the redshift of radio-selected data sets. Publications of the Astronomical Society of the Pacific, 131(1004), 1–7. doi:10.1088/1538-3873/aaea17.

Martínez, F., Frías, M. P., Pérez, M. D., & Rivera, A. J. (2019). A methodology for applying k-nearest neighbor to time series forecasting. Artificial Intelligence Review, 52(3), 2019–2037. doi:10.1007/s10462-017-9593-z.

Parashar, P. (2020). Decision Tree Regression and it’s Mathematical Implementation. Medium. Available online: https://medium.com/swlh/decision-tree-regression-and-its-mathematical-implementation-58c6e9c5e88e (accessed on March 2022).

Zhang, W., Zhang, R., Wu, C., Goh, A. T. C., & Wang, L. (2022). Assessment of basal heave stability for braced excavations in anisotropic clay using extreme gradient boosting and random forest regression. Underground Space (China), 7(2), 233–241. doi:10.1016/j.undsp.2020.03.001.

Bakshi, C. (2020). Random Forest Regression. Medium. Available online: https://levelup.gitconnected.com/random-forest-regression-209c0f354c84 (accessed on March 2022).

Ronaghan, S. (2018). The Mathematics of Decision Trees, Random Forest and Feature Importance in Scikit-learn and Spark. Medium. Available online: https://towardsdatascience.com/the-mathematics-of-decision-trees-random-forest-and-feature-importance-in-scikit-learn-and-spark-f2861df67e3 (accessed on March 2022).

Schuster, M., & Paliwal, K. K. (1997). Bidirectional recurrent neural networks. IEEE transactions on Signal Processing, 45(11), 2673-2681. doi:10.1109/78.650093.

Althelaya, K. A., El-Alfy, E.-S. M., & Mohammed, S. (2018). Evaluation of bidirectional LSTM for short-and long-term stock market prediction. 2018 9th International Conference on Information and Communication Systems (ICICS). doi:10.1109/iacs.2018.8355458.

Shastri, M., Roy, S., & Mittal, M. (2019). Stock Price Prediction using Artificial Neural Model: An Application of Big Data. EAI Endorsed Transactions on Scalable Information Systems, 6(20), 1–8. doi:10.4108/eai.19-12-2018.156085.

Khan, W., Malik, U., Ghazanfar, M. A., Azam, M. A., Alyoubi, K. H., & Alfakeeh, A. S. (2020). Predicting stock market trends using machine learning algorithms via public sentiment and political situation analysis. Soft Computing, 24(15), 11019–11043. doi:10.1007/s00500-019-04347-y.

Ertuğrul, E., Baytar, Z., Çatal, Ç., & Muratli, Ö, C. (2019). Performance tuning for machine learning-based software development effort prediction models. Turkish Journal of Electrical Engineering and Computer Sciences, 27(2), 1308–1324. doi:10.3906/elk-1809-129.

Al-Fugara, A., Ahmadlou, M., Shatnawi, R., AlAyyash, S., Al-Adamat, R., Al-Shabeeb, A. A. R., & Soni, S. (2022). Novel hybrid models combining meta-heuristic algorithms with support vector regression (SVR) for groundwater potential mapping. Geocarto International, 37(9), 2627–2646. doi:10.1080/10106049.2020.1831622.

Yang, L., & Shami, A. (2020). On hyperparameter optimization of machine learning algorithms: Theory and practice. Neurocomputing, 415, 295–316. doi:10.1016/j.neucom.2020.07.061.

Jassim, M. S., Coskuner, G., & Zontul, M. (2022). Comparative performance analysis of support vector regression and artificial neural network for prediction of municipal solid waste generation. Waste Management and Research, 40(2), 195–204. doi:10.1177/0734242X211008526.

Cui, L., Zhang, Y., Zhang, R., & Liu, Q. H. (2020). A Modified Efficient KNN Method for Antenna Optimization and Design. IEEE Transactions on Antennas and Propagation, 68(10), 6858–6866. doi:10.1109/TAP.2020.3001743.

Fu, G., Lü, Q., Yan, J., Farquharson, C. G., Qi, G., Zhang, K., Zhang, Y., Wang, H., & Luo, F. (2021). 3D mineral prospectivity modeling based on machine learning: A case study of the Zhuxi tungsten deposit in northeastern Jiangxi Province, South China. Ore Geology Reviews, 131, 1–19. doi:10.1016/j.oregeorev.2021.104010.

Anmala, J., & Turuganti, V. (2021). Comparison of the performance of decision tree (DT) algorithms and extreme learning machine (ELM) model in the prediction of water quality of the Upper Green River watershed. Water Environment Research, 93(11), 2360–2373. doi:10.1002/wer.1642.

Contreras, P., Orellana-Alvear, J., Muñoz, P., Bendix, J., & Célleri, R. (2021). Influence of random forest hyperparameterization on short-term runoff forecasting in an andean mountain catchment. Atmosphere, 12(2), 1–16. doi:10.3390/atmos12020238.

Khan, Z. A., Ullah, A., Ullah, W., Rho, S., Lee, M., & Baik, S. W. (2020). Electrical energy prediction in residential buildings for short-term horizons using hybrid deep learning strategy. Applied Sciences (Switzerland), 10(23), 1–12. doi:10.3390/app10238634.

Daghigh, V., Lacy, T. E., Daghigh, H., Gu, G., Baghaei, K. T., Horstemeyer, M. F., & Pittman, C. U. (2020). Heat deflection temperatures of bio-nano-composites using experiments and machine learning predictions. Materials Today Communications, 22(10078), 9. doi:10.1016/j.mtcomm.2019.100789.

Ağbulut, Ü., Gürel, A. E., & Biçen, Y. (2021). Prediction of daily global solar radiation using different machine learning algorithms: Evaluation and comparison. Renewable and Sustainable Energy Reviews, 135, 1–14. doi:10.1016/j.rser.2020.110114.

Gu, Y., Liu, D., Arvin, R., Khattak, A. J., & Han, L. D. (2023). Predicting intersection crash frequency using connected vehicle data: A framework for geographical random forest. Accident Analysis & Prevention, 179, 106880. doi:10.1016/j.aap.2022.106880.

Neto, M. P., & Paulovich, F. V. (2021). Explainable matrix - Visualization for global and local interpretability of random forest classification ensembles. IEEE Transactions on Visualization and Computer Graphics, 27(2), 1427–1437. doi:10.1109/TVCG.2020.3030354.

Dash, R. K., Nguyen, T. N., Cengiz, K., & Sharma, A. (2021). Fine-tuned support vector regression model for stock predictions. Neural Computing and Applications. doi:10.1007/s00521-021-05842-w.

Guo, Y., Han, S., Shen, C., Li, Y., Yin, X., & Bai, Y. (2018). An adaptive SVR for high-frequency stock price forecasting. IEEE Access, 6, 11397–11404. doi:10.1109/ACCESS.2018.2806180.

Zheng, J., Wang, Y., Li, S., & Chen, H. (2021). The stock index prediction based on SVR model with bat optimization algorithm. Algorithms, 14(10), 1–31. doi:10.3390/a14100299.

Nti, I. K., Adekoya, A. F., & Weyori, B. A. (2020). Efficient Stock-Market Prediction Using Ensemble Support Vector Machine. Open Computer Science, 10(1), 153–163. doi:10.1515/comp-2020-0199.


Full Text: PDF

DOI: 10.28991/HEF-2022-03-04-01

Refbacks

  • There are currently no refbacks.


Copyright (c) 2023 . Edward, . Suharjito