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. 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.
    2. 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).
    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. Szafranek, Karol, 2019. "Bagged neural networks for forecasting Polish (low) inflation," International Journal of Forecasting, Elsevier, vol. 35(3), pages 1042-1059.
    3. 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.
    4. 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.
    5. 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.
    6. 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.
    7. 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.
    8. 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.
    9. 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).
    10. 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.
    11. 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.
    12. Fischer, Thomas & Krauss, Christopher & Treichel, Alex, 2018. "Machine learning for time series forecasting - a simulation study," FAU Discussion Papers in Economics 02/2018, Friedrich-Alexander University Erlangen-Nuremberg, Institute for Economics.
    13. Tianxiang Zhan & Fuyuan Xiao, 2021. "A Fast Evidential Approach for Stock Forecasting," Papers 2104.05204, arXiv.org, revised Jul 2021.
    14. Xin Huang & Han Lin Shang & David Pitt, 2022. "A model sufficiency test using permutation entropy," Journal of Forecasting, John Wiley & Sons, Ltd., vol. 41(5), pages 1017-1036, August.
    15. Martins, Guilherme Santos & Giesbrecht, Mateus, 2021. "Clearness index forecasting: A comparative study between a stochastic realization method and a machine learning algorithm," Renewable Energy, Elsevier, vol. 180(C), pages 787-805.
    16. Semenoglou, Artemios-Anargyros & Spiliotis, Evangelos & Makridakis, Spyros & Assimakopoulos, Vassilios, 2021. "Investigating the accuracy of cross-learning time series forecasting methods," International Journal of Forecasting, Elsevier, vol. 37(3), pages 1072-1084.
    17. Silvia Golia & Luigi Grossi & Matteo Pelagatti, 2022. "Machine Learning Models and Intra-Daily Market Information for the Prediction of Italian Electricity Prices," Forecasting, MDPI, vol. 5(1), pages 1-21, December.
    18. Richardson, Adam & van Florenstein Mulder, Thomas & Vehbi, Tuğrul, 2021. "Nowcasting GDP using machine-learning algorithms: A real-time assessment," International Journal of Forecasting, Elsevier, vol. 37(2), pages 941-948.
    19. Söhnke M. Bartram & Jürgen Branke & Mehrshad Motahari, 2020. "Artificial intelligence in asset management," Working Papers 20202001, Cambridge Judge Business School, University of Cambridge.
    20. Makridakis, Spyros & Spiliotis, Evangelos & Assimakopoulos, Vassilios, 2018. "The M4 Competition: Results, findings, conclusion and way forward," International Journal of Forecasting, Elsevier, vol. 34(4), pages 802-808.

    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.