IDEAS home Printed from https://ideas.repec.org/a/wly/jforec/v43y2024i5p1559-1574.html
   My bibliography  Save this article

Applying k‐nearest neighbors to time series forecasting: Two new approaches

Author

Listed:
  • Samya Tajmouati
  • Bouazza E. L. Wahbi
  • Adel Bedoui
  • Abdallah Abarda
  • Mohamed Dakkon

Abstract

The k‐nearest neighbors algorithm is one of the prominent techniques used in classification and regression. Despite its simplicity, the k‐nearest neighbors has been successfully applied in time series forecasting. However, the selection of the number of neighbors and feature selection is a daunting task. In this paper, we introduce two methodologies for forecasting time series that we refer to as Classical Parameters Tuning in Weighted Nearest Neighbors and Fast Parameters Tuning in Weighted Nearest Neighbors. The first approach uses classical parameters tuning that compares the most recent subsequence with every possible subsequence from the past of the same length. The second approach reduces the neighbors' search set, which leads to significantly reduced grid size and hence a lower computational time. To tune the models' parameters, both methods implement an approach inspired by cross‐validation for weighted nearest neighbors. We evaluate the forecasting performance and accuracy of our models. Then, we compare them to other approaches, especially, Seasonal Autoregressive Integrated Moving Average, Holt Winters, and Exponential Smoothing State Space Model. Real data examples on retail and food services sales in the United States and milk production in the United Kingdom are analyzed to demonstrate the application and efficiency of the proposed approaches.

Suggested Citation

  • Samya Tajmouati & Bouazza E. L. Wahbi & Adel Bedoui & Abdallah Abarda & Mohamed Dakkon, 2024. "Applying k‐nearest neighbors to time series forecasting: Two new approaches," Journal of Forecasting, John Wiley & Sons, Ltd., vol. 43(5), pages 1559-1574, August.
  • Handle: RePEc:wly:jforec:v:43:y:2024:i:5:p:1559-1574
    DOI: 10.1002/for.3093
    as

    Download full text from publisher

    File URL: https://doi.org/10.1002/for.3093
    Download Restriction: no

    File URL: https://libkey.io/10.1002/for.3093?utm_source=ideas
    LibKey link: if access is restricted and if your library uses this service, LibKey will redirect you to where you can use your library subscription to access this item
    ---><---

    References listed on IDEAS

    as
    1. Kück, Mirko & Freitag, Michael, 2021. "Forecasting of customer demands for production planning by local k-nearest neighbor models," International Journal of Production Economics, Elsevier, vol. 231(C).
    2. Nesreen Ahmed & Amir Atiya & Neamat El Gayar & Hisham El-Shishiny, 2010. "An Empirical Comparison of Machine Learning Models for Time Series Forecasting," Econometric Reviews, Taylor & Francis Journals, vol. 29(5-6), pages 594-621.
    Full references (including those not matched with items on IDEAS)

    Most related items

    These are the items that most often cite the same works as this one and are cited by the same works as this one.
    1. Philippe Goulet Coulombe & Maxime Leroux & Dalibor Stevanovic & Stéphane Surprenant, 2022. "How is machine learning useful for macroeconomic forecasting?," Journal of Applied Econometrics, John Wiley & Sons, Ltd., vol. 37(5), pages 920-964, August.
    2. Petar Soric & Enric Monte & Salvador Torra & Oscar Claveria, 2022. ""Density forecasts of inflation using Gaussian process regression models"," IREA Working Papers 202210, University of Barcelona, Research Institute of Applied Economics, revised Jul 2022.
    3. Maghsoodi, Abtin Ijadi, 2023. "Cryptocurrency portfolio allocation using a novel hybrid and predictive big data decision support system," Omega, Elsevier, vol. 115(C).
    4. Szafranek, Karol, 2019. "Bagged neural networks for forecasting Polish (low) inflation," International Journal of Forecasting, Elsevier, vol. 35(3), pages 1042-1059.
    5. Huber, Jakob & Stuckenschmidt, Heiner, 2020. "Daily retail demand forecasting using machine learning with emphasis on calendric special days," International Journal of Forecasting, Elsevier, vol. 36(4), pages 1420-1438.
    6. Ahmad, Tanveer & Madonski, Rafal & Zhang, Dongdong & Huang, Chao & Mujeeb, Asad, 2022. "Data-driven probabilistic machine learning in sustainable smart energy/smart energy systems: Key developments, challenges, and future research opportunities in the context of smart grid paradigm," Renewable and Sustainable Energy Reviews, Elsevier, vol. 160(C).
    7. Andrei Dubovik & Adam Elbourne & Bram Hendriks & Mark Kattenberg, 2022. "Forecasting World Trade Using Big Data and Machine Learning Techniques," CPB Discussion Paper 441, CPB Netherlands Bureau for Economic Policy Analysis.
    8. Kock, Anders Bredahl & Teräsvirta, Timo, 2014. "Forecasting performances of three automated modelling techniques during the economic crisis 2007–2009," International Journal of Forecasting, Elsevier, vol. 30(3), pages 616-631.
    9. Robert RUSU & Constantin AVRAM, 2022. "Deep Learning Systems Integrated into the Digital Strategy of a Company Involved in e-commerce," Economics and Applied Informatics, "Dunarea de Jos" University of Galati, Faculty of Economics and Business Administration, issue 1, pages 5-10.
    10. Nghia Chu & Binh Dao & Nga Pham & Huy Nguyen & Hien Tran, 2022. "Predicting Mutual Funds' Performance using Deep Learning and Ensemble Techniques," Papers 2209.09649, arXiv.org, revised Jul 2023.
    11. Koffi, Siméon, 2022. "Prévision de l’inflation en Côte D’ivoire : Analyse Comparée des Modèles Arima, Holt-Winters, et Lstm [Inflation Forecasting in Côte D'Ivoire: A Comparative Analysis of the Arima, Holt-Winters, and," MPRA Paper 113961, University Library of Munich, Germany.
    12. Anna Almosova & Niek Andresen, 2023. "Nonlinear inflation forecasting with recurrent neural networks," Journal of Forecasting, John Wiley & Sons, Ltd., vol. 42(2), pages 240-259, March.
    13. Ben Moews & J. Michael Herrmann & Gbenga Ibikunle, 2018. "Lagged correlation-based deep learning for directional trend change prediction in financial time series," Papers 1811.11287, arXiv.org, revised Nov 2018.
    14. Corey Ducharme & Bruno Agard & Martin Trépanier, 2024. "Improving demand forecasting for customers with missing downstream data in intermittent demand supply chains with supervised multivariate clustering," Journal of Forecasting, John Wiley & Sons, Ltd., vol. 43(5), pages 1661-1681, August.
    15. Dolgui, Alexandre & Hashemi-Petroodi, S. Ehsan & Kovalev, Sergey & Kovalyov, Mikhail Y., 2021. "Profitability of a multi-model manufacturing line versus multiple dedicated lines," International Journal of Production Economics, Elsevier, vol. 236(C).
    16. Green, Gareth & Richards, Timothy, 2016. "Interpreting Results of Demand Estimation from Machine Learning Models," 2016 Annual Meeting, July 31-August 2, Boston, Massachusetts 236147, Agricultural and Applied Economics Association.
    17. Tanujit Chakraborty & Ashis Kumar Chakraborty & Munmun Biswas & Sayak Banerjee & Shramana Bhattacharya, 2021. "Unemployment Rate Forecasting: A Hybrid Approach," Computational Economics, Springer;Society for Computational Economics, vol. 57(1), pages 183-201, January.
    18. Makridakis, Spyros & Hyndman, Rob J. & Petropoulos, Fotios, 2020. "Forecasting in social settings: The state of the art," International Journal of Forecasting, Elsevier, vol. 36(1), pages 15-28.
    19. Haoran Wang & Shi Yu, 2021. "Robo-Advising: Enhancing Investment with Inverse Optimization and Deep Reinforcement Learning," Papers 2105.09264, arXiv.org.
    20. Andrawis, Robert R. & Atiya, Amir F. & El-Shishiny, Hisham, 2011. "Forecast combinations of computational intelligence and linear models for the NN5 time series forecasting competition," International Journal of Forecasting, Elsevier, vol. 27(3), pages 672-688, July.

    More about this item

    Statistics

    Access and download statistics

    Corrections

    All material on this site has been provided by the respective publishers and authors. You can help correct errors and omissions. When requesting a correction, please mention this item's handle: RePEc:wly:jforec:v:43:y:2024:i:5:p:1559-1574. See general information about how to correct material in RePEc.

    If you have authored this item and are not yet registered with RePEc, we encourage you to do it here. This allows to link your profile to this item. It also allows you to accept potential citations to this item that we are uncertain about.

    If CitEc recognized a bibliographic reference but did not link an item in RePEc to it, you can help with this form .

    If you know of missing items citing this one, you can help us creating those links by adding the relevant references in the same way as above, for each refering item. If you are a registered author of this item, you may also want to check the "citations" tab in your RePEc Author Service profile, as there may be some citations waiting for confirmation.

    For technical questions regarding this item, or to correct its authors, title, abstract, bibliographic or download information, contact: Wiley Content Delivery (email available below). General contact details of provider: http://www3.interscience.wiley.com/cgi-bin/jhome/2966 .

    Please note that corrections may take a couple of weeks to filter through the various RePEc services.

    IDEAS is a RePEc service. RePEc uses bibliographic data supplied by the respective publishers.