Skip to main content
Log in

Classical and fast parameters tuning in nearest neighbors with stop condition

  • Application Article
  • Published:
OPSEARCH Aims and scope Submit manuscript

Abstract

In this paper, we study the convergence of the algorithms employed by Classical Parameters Tuning in Nearest Neighbors (CPTO-WNN) and Fast Parameters Tuning in Nearest Neighbors (FPTO-WNN). CPTO-WNN and FPTO-WNN are two methodologies that perform the selection of weighted nearest neighbors parameters in time series setting. To do so, each methodology employs an algorithm named WNNoptimization. The WNNoptimization algorithm employs a method inspired by time series cross validation to pick automatically the weighted nearest neighbors parameters. Practically, it computes the global accuracy measure over the test sets, for different values of weighted nearest neighbors parameters and returns the ones for which the accuracy measure is minimal. Compared to CPTO-WNN, FPTO-WNN presents the advantage of reducing time complexity. However, when we are faced with many iterations, both methods raise concerns about computational time. One solution is to introduce a stop condition if the algorithms are convergent. Real data examples on retail and food services sales in the USA and milk production in the UK are analyzed to demonstrate the convergence of the algorithms. As a result, we propose a stop condition allowing the reduction of time complexity while maintaining a good precision. We compare the forecasting performance and time complexity of CPTO-WNN and FPTO-WNN after implementing the proposed stop condition. Experiments show that the introduction of the proposed stop condition provides good accuracy along with lower computational time.

This is a preview of subscription content, log in via an institution to check access.

Access this article

Price excludes VAT (USA)
Tax calculation will be finalised during checkout.

Instant access to the full article PDF.

Fig. 1
Fig. 2
Fig. 3
Fig. 4
Fig. 5
Fig. 6
Fig. 7
Fig. 8

Similar content being viewed by others

Data Availability

For our analysis, the Retail and Food Services Sales in the USA data that support the finding of this study are obtained from the United States Census Bureau Database, available at: https://www.census.gov/retail/index.html. Cow’s Milk Production in the UK are provided by Eurostat, which are available at: http://appsso.eurostat.ec.europa.eu/nui/show.do?dataset=apro_mk_colm &lang=en.

References

  1. Ahmed, N.K., Ayar, N.E., El-Shishiny, H.: An empirical comparison of machine learning models for time series forecasting. Econ. Rev. 29(5–6), 594–621 (2010). https://doi.org/10.1080/07474938.2010.481556

    Article  Google Scholar 

  2. Alvarez, F.M., Troncoso, A., Riquelme, J.C., Ruiz, J.S.A.: Energy time series forecasting based on pattern sequence similarity. IEEE Trans. Knowl. Data Eng. 23(8), 1230–1243 (2010). https://doi.org/10.1109/TKDE.2010.227

    Article  Google Scholar 

  3. Box, G.E., Jenkins, G.M., Reinsel, G.C., Ljung, G.M.: Time series analysis: forecasting and control. John Wiley & Sons, USA (2015)

    Google Scholar 

  4. United States Census Bureau. “Retail and food services sales in the USA- monthly data”, Online available from https://www.census.gov/retail/index.html (accessed Jan.15,2022)

  5. Eurostat. “Cow’s milk collection and products obtained - monthly data”, Online available from http://appsso.eurostat.ec.europa.eu/nui/show.do?dataset=apro_mk_colm &lang=en (accessed Jan.15,2022)

  6. Hyndman, R., Koehler, A.B., Ord, J.K., Snyder, R.D.: Forecasting with exponential smoothing: the state space approach. Springer Science & Business Media, UK (2008)

    Book  Google Scholar 

  7. Lora, A.T., Santos, J.M.R., Expósito, A.G., Ramos, J.L.M., Santos, J.C.R.: Electricity market price forecasting based on weighted nearest neighbors techniques. IEEE Trans. Power Syst. 22(3), 1294–1301 (2007). https://doi.org/10.1109/TPWRS.2007.901670

    Article  Google Scholar 

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

    Article  Google Scholar 

  9. Martínez, F., Frías, M.P., Pérez-Godoy, M.D., Rivera, A.J.: Dealing with seasonality by narrowing the training set in time series forecasting with kNN. Expert Syst. Appl. 103, 38–48 (2018). https://doi.org/10.1016/j.eswa.2018.03.005

    Article  Google Scholar 

  10. Palit, A.K., Popovic, D.: Computational intelligence in time series forecasting: theory and engineering applications. Springer Science & Business Media, UK (2006)

    Google Scholar 

  11. Poon, S., Granger, C.W.: Forecasting volatility in financial markets: a review. J. Econ. Lit. 41(2), 478–539 (2003). https://doi.org/10.1257/002205103765762743

    Article  Google Scholar 

  12. Tajmouati S., El Wahbi B., Bedoui A., Abarda A., Dakkon M.: “Applying k-nearest neighbors to time series forecasting : two new approaches”, arxiv, (2021). https://doi.org/10.48550/arXiv.2103.14200

  13. Tajmouati, S., El Wahbi, B., Dakkon, M.: Applying regression conformal prediction with nearest neighbors to time series data. Commun. Stat.-Simul. Comput. 26, 1–11 (2022). https://doi.org/10.1080/03610918.2022.2057538

    Article  Google Scholar 

  14. Tang, L., Pan, H., Yao, Y.: “K-nearest neighbor regression with principal component analysis for financial time series prediction”, in ICCAI 2018: Proceedings of the 2018 International Conference on Computing and Artificial Intelligence, March., (2018), pp. 127–131 . https://doi.org/10.1145/3194452.3194467

  15. Zhang, G., Patuwo, B.E., Hu, M.Y.: Forecasting with artificial neural networks: The state of the art. Int. J. Forecast. 14(1), 35–62 (1998). https://doi.org/10.1016/S0169-2070(97)00044-7

    Article  Google Scholar 

  16. Zhang, N., Lin, A., Shang, P.: Multidimensional k-nearest neighbor model based on EEMD for financial time series forecasting. Phys. A 477, 161–173 (2017). https://doi.org/10.1016/j.physa.2017.02.072

    Article  Google Scholar 

  17. Tajmouati, S., Abarda, A., El Moudden, M., Dakkon, M.,Esghir, M.: “A study of the application of statistical methods for Big data”. in Proceedings of the International Conference on Learning and Optimization Algorithms: Theory and Applications, pp. 1-6, (2018). https://doi.org/10.1145/3230905.3230944

  18. Li, R., Lin, D.K., Li, B.: Statistical inference in massive data sets. Appl. Stoch. Model. Bus. Ind. 29(5), 399–409 (2013). https://doi.org/10.1002/asmb.1927

    Article  Google Scholar 

  19. Patel, V.: Stopping criteria for, and strong convergence of, stochastic gradient descent on Bottou-Curtis-Nocedal functions. Math. Program. 195(1), 693–734 (2022). https://doi.org/10.1007/s10107-021-01710-6

    Article  Google Scholar 

  20. Tajmouati, S., El Wahbi, B., Dakkon, M.: Modeling COVID-19 confirmed cases using a hybrid model. Adv. Decis. Sci. 26(1), 1–34 (2022). https://doi.org/10.47654/v26y2022i1p128-162

    Article  Google Scholar 

  21. Abarda, A., Bentaleb, Y., Mharzi, H.: A divided latent class analysis for big data. Proc. Comput. Sci. 110, 428–433 (2017). https://doi.org/10.1016/j.procs.2017.06.111

    Article  Google Scholar 

Download references

Acknowledgements

Not applicable

Funding

There is no funding for this study.

Author information

Authors and Affiliations

Authors

Contributions

ST developped CPTO-WNN and FPTO-WNN methodologies. ST, BEW, and MD noticed the convergence of these methodologies. ST proposed the stop condition allowing the reduction of time complexity without loss of precision. BEW and MD supervised the new methods as well as their application on real time series and approved them.

Corresponding author

Correspondence to Samya Tajmouati.

Ethics declarations

Conflict of interest

There is no competing interests to declare.

Ethical Approval and consent to participate

Not applicable.

Consent for Publication

Not applicable.

Additional information

Publisher's Note

Springer Nature remains neutral with regard to jurisdictional claims in published maps and institutional affiliations.

Rights and permissions

Springer Nature or its licensor (e.g. a society or other partner) holds exclusive rights to this article under a publishing agreement with the author(s) or other rightsholder(s); author self-archiving of the accepted manuscript version of this article is solely governed by the terms of such publishing agreement and applicable law.

Reprints and permissions

About this article

Check for updates. Verify currency and authenticity via CrossMark

Cite this article

Tajmouati, S., El Wahbi, B. & Dakkon, M. Classical and fast parameters tuning in nearest neighbors with stop condition. OPSEARCH 60, 1063–1081 (2023). https://doi.org/10.1007/s12597-023-00650-3

Download citation

  • Accepted:

  • Published:

  • Issue Date:

  • DOI: https://doi.org/10.1007/s12597-023-00650-3

Keywords

Navigation