Applying k-nearest neighbors to time series forecasting : two new approaches

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 to 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 some classical 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 USA and milk production in the UK are analyzed to demonstrate the application and the efficiency of the proposed approaches.

[1]  F. H. Barron,et al.  Selecting a best multiattribute alternative with partial information about attribute weights , 1992 .

[2]  Francisco Martinez Alvarez,et al.  Energy Time Series Forecasting Based on Pattern Sequence Similarity , 2011, IEEE Transactions on Knowledge and Data Engineering.

[3]  Pengjian Shang,et al.  Multidimensional k-nearest neighbor model based on EEMD for financial time series forecasting , 2017 .

[4]  Amir F. Atiya,et al.  An Empirical Comparison of Machine Learning Models for Time Series Forecasting , 2010 .

[5]  Truong Q. Nguyen,et al.  An Adaptable $k$ -Nearest Neighbors Algorithm for MMSE Image Interpolation , 2009, IEEE Transactions on Image Processing.

[6]  Chengjun Liu,et al.  A Novel Locally Linear KNN Method With Applications to Visual Recognition , 2017, IEEE Transactions on Neural Networks and Learning Systems.

[7]  Víctor M. Guerrero Time‐series analysis supported by power transformations , 1993 .

[8]  George Athanasopoulos,et al.  Forecasting: principles and practice , 2013 .

[9]  Ajith Abraham,et al.  Foundations of Computational Intelligence - Volume 3: Global Optimization , 2009, Foundations of Computational Intelligence.

[10]  Fotios Petropoulos,et al.  forecast: Forecasting functions for time series and linear models , 2018 .

[11]  D. Cox,et al.  An Analysis of Transformations , 1964 .

[12]  Antonio J. Rivera,et al.  Dealing with seasonality by narrowing the training set in time series forecasting with kNN , 2018, Expert Syst. Appl..

[13]  J. Ramos,et al.  Electricity Market Price Forecasting Based on Weighted Nearest Neighbors Techniques , 2007, IEEE Transactions on Power Systems.

[14]  G. Box,et al.  On a measure of lack of fit in time series models , 1978 .

[15]  Weizhong Yan,et al.  Toward Automatic Time-Series Forecasting Using Neural Networks , 2012, IEEE Transactions on Neural Networks and Learning Systems.

[16]  Francisco Martínez,et al.  A methodology for applying k-nearest neighbor to time series forecasting , 2019, Artificial Intelligence Review.