Forecasting SARS-CoV-2 in the peruvian regions: a deep learning approach using temporal convolutional neural networks


  • Luis Aguilar I. Department of Mathematics, National University of Piura, Urb. Miraflores s/n, Castilla Apartado Postal 295, Piura, Perú.
  • Miguel Ibáñez-Reluz Medicine Faculty, Cesar Vallejo University, Av. Victor Larco 1770, Trujillo, Perú.
  • Juan C. Z. Aguilar Department of Mathematics and Statistics, Universidade Federal de S˜ao Jo˜ao del-Rei C.P. 110, CEP 36301-160, S˜ao Jo˜ao del-Rei, MG, Brazil.
  • Elí W. Zavaleta-Aguilar Sao Paulo State University (Unesp), Campus of Itapeva Rua Geraldo Alckmin 519, 18409-010 Itapeva, SP, Brazil.
  • L. Antonio Aguilar Artificial Intelligent Research, KapAITech Research Group, Condominio Sol de Chan-Chan, Trujillo, Perú.



Deep Learning, Forecasting, SARS-CoV-2, Temporal Convolutional Neural Networks, Time Series Data


The SARS-CoV-2 pandemic had taken the world by surprise since its discovery on December 2019, causing major losses worldwide. In this work, a deep learning model was developed to predict and forecast the daily SARS-CoV-2 cases on the Peruvian regions. The data used belongs to the open covid–19 data set, sourced by the Health Ministry of Peru (MINSA). The data set includes the periods from March 03, 2020 to March 16, 2021. A holdout approach was used, creating a training and validation data splits. Using the validation set, a temporal convolution neural network (TCN) composed by five layers was developed. The model was design to predict a mean tendency alongside with a prediction interval. To find the best hyper parameter configuration, a Bayesian approach was applied over the validation set. The TCN model was trained using the optimal configuration. Once trained, the model was able to predict the different SARS-CoV-2 trends present in the regions. Next, a forecast was performed beyond the available data, using a window of 15 days ahead (March 17 to March 31, 2021) for each region. Forecast results suggested a continued trend for all the regions, except Lima. The model performance was evaluated using the MAE, MAD, MSLE and RMSLE metrics on the test period, showing training to validation metrics improvements of 14.534, 3.123, 0.042, 0.047 respectively.


Bchetnia M, Girard C, Duchaine C, Laprise C. The outbreak of the novel severe acute respiratory syndrome coronavirus 2 (SARS-CoV-2): A review of the current global status. J Infect Public Health. 2020 Nov; 13(11):1601-1610. doi:10.1016/j.jiph.2020.07.011.

Harrison SL, Fazio-Eynullayeva E, Lane DA, Underhill P, Lip GYH. Comorbidities associated with mortality in 31,461 adults with COVID-19 in the United States: A federated electronic medical record analysis. PLoS Med. 2020 Sep 10; 17(9):e1003321. doi: 10.1371/journal.pmed.1003321.

Giannis D, Ziogas IA, Gianni P. Coagulation disorders in coronavirus infected patients: COVID-19, SARS-CoV-1, MERS-CoV and lessons from the past. J Clin Virol. 2020 Jun; 127: 104362. doi: 10.1016/j.jcv.2020.104362.

MINSA. Documento técnico atención y manejo clínico de casos de covid-19 - escenario de transmisión focalizada [Internet]. 2020 [cited 2021 Jan 29]. Available from:

MINSA. Alerta epidemiológica código: AE-016- 2020 [Internet]. 2020 [cited 2021 Jan 29]. Available from:

ESSALUD. Data COVID-19 - Reporte diário [Internet]. 2020 [cited 2021 Feb 04]. Available from:


MINSA. Gis Visor Vacunados [Internet]. 2020 [cited 2021 Mar 21]. Available from: /GisVisorVacunados/

Roser M, Ritchie H, Ortiz-Ospina E, Hasell J. Coronavirus pandemic (COVID-19) [Internet]. 2020 [cited 2021 Feb 04]. Available from:

MINSA. El Ministerio de Salud detectó la presencia de la variante brasileña del coronavirus en Loreto, Huánuco y Lima [Internet].

Feb 04 [cited 2021 Mar 21]. Available:

Abou-Ismail A. Compartmental models of the COVID-19 pandemic for physicians and physician-scientists. SN Compr ClinMed. 2020 Jun 4; 2: 852-858. doi: 10.1007/s42399-020-00330-z.

Cooper I, Mondal A, Antonopoulos CG. A SIR model assumption for the spread of COVID-19 in different communities. Chaos Soliton Fract. 2020 Jun 28; 139: 110057. doi: 10.1016/j.chaos.2020.110057.

He S, Peng Y, Sun K. SEIR modeling of the COVID-19 and its dynamics. Nonlinear Dyn. 2020 Jun 18; 101:1667-1680. doi: 10.1007/s11071-020-05743-y.

Anastassopoulou C, Russo L, Tsakris A, Siettos C. Data-based analysis, modelling and forecasting of the COVID-19 outbreak. PLoS One. 2020 Mar 31; 15(3): e0230405. doi: 10.1371/journal.pone.0230405.

Dong E, Du H, Gardner L. An interactive web-based dashboard to track COVID-19 in real time. Lancet Infect Dis. 2020 Feb 19; 20(5): 533–534. doi: 10.1016/S1473-3099(20)30120-1.

Hochreiter S, Schmidhuber J. Long Short-Term Memory. Neural Comput. 1997 Nov; 9(8):1735–1780. doi:10.1162/neco.1997.9.8.1735.

Chimmula VKR, Zhang J. Time series forecasting of COVID-19 transmission in Canada using LSTM networks. Chaos Soliton Fract. 2020 Jun; 135:109864. doi: 10.1016/j.chaos.2020.109864.

Zeroual A, Harrou F, Dairi A, Sun Y. Deep learning methods for forecasting COVID-19 time-Series data: A comparative study. Chaos Soliton Fract. 2020; 140: 110121. doi: 10.1016/j.chaos.2020.110121.

Mohimont L, Chemchem A, Alin F, Krajecki M, Steffenel L. Convolutional neural networks and temporal CNNs for covid-19 forecasting in France. Appl Intell. 2021 Apr 14: 1-26. doi: 10.1007/s10489-021-02359-6.

Huang CJ, Chen YH, Ma Y, Kuo PH. Multiple-input deep convolutional neural network model for COVID-19 forecasting in China. medRxiv. 2020 Mar 23, Pre print. doi: 10.1101/2020.03.23.20041608.

Abbasimehr H, Paki R. Prediction of COVID-19 confirmed cases combining deep learning methods and Bayesian optimization. Chaos Soliton Fract. 2021; 142:110511. doi: 10.1016/j.chaos.2020.110511.

Bai S, Kolter JZ, Koltun V. An empirical evaluation of generic convolutional and recurrent networks for sequence modeling. arXiv. 2018; 19:1803.01271v2.

He K, Zhang X, Ren S, Sun J. Deep residual learning for image recognition. Proceedings of the 2016 IEEE Conference on Computer Vision and Pattern Recognition (CVPR); 2016 Jun 26-30; Las Vegas, NV, USA. IEEE; 2016. p. 770-778. doi:10.1109/CVPR.2016.90.

MINSA. Casos positivos por COVID-19 - [Ministerio de Salud - MINSA] [Online]. 2020 [cited 2021 Mar 20]. Available from:

Ioffe S, Szegedy C. Batch normalization: accelerating deep network training by reducing internal covariate shift. In: Lawrence N, Reid M, editors. Proceedings of the 32nd International Conference on Machine Learning; 2015 Jul 7-9; Lille, France. PMLR v37; 2015. p. 448-456.

Nair V, Hinton GE. Rectified linear units improve restricted Boltzmann machines. Proceedings of the 27th International Conference

on International Conference on Machine Learning. 2010 Jun 21-24; Haifa, Israel. p. 807–814.

Hinton GE, Srivastava N, Krizhevsky A, Sutskever I, Salakhutdinov RR. Improving neural networks by preventing coadaptation of feature detectors. arXiv. 2012 Jul 03 : 1207.0580v1.

Sutskever I, Martens J, Dahl G. Hinton G. On the importance of initialization and momentum in deep learning. Proceedings of the 30th International Conference on International Conference on Machine Learning; 2013 Jun 17-19; Atlanta, Georgia, USA. PMLR v28; 2013. p. 1139–1147.

Balandat M, Karrer B, Jiang DR, Daulton S, Letham B,Wilson AG, Bakshy E. BoTorch: A framework for efficient Monte-Carlo Bayesian optimization. arXiv. 2020 Dec 08 : 1910.06403v3.

Smith LN. Cyclical learning rates for training neural networks. Proceedings of the 2017 IEEE Winter Conference on Applications of Computer Vision (WACV); 2017 Mar 21-24; Santa Rosa, CA, USA. IEEE; 2017. p. 464–472. doi:10.1109/WACV.2017.58.

Glorot X, Bengio Y. Understanding the difficulty of training deep feedforward neural networks. Teh YW, Titterington M, editors. Proceedings of the Thirteenth International Conference on Artificial Intelligence and Statistics; 2010 May 13-15; Chia Laguna Resort, Sardinia, Italy. PMLR v9; 2010. p. 249-256.




How to Cite

Aguilar I., L., Ibáñez-Reluz, M., Z. Aguilar, J. C., Zavaleta-Aguilar, E. W., & Aguilar, L. A. (2021). Forecasting SARS-CoV-2 in the peruvian regions: a deep learning approach using temporal convolutional neural networks. Selecciones Matemáticas, 8(01), 12 - 26.