Applying Deep Learning Methods on Time-Series Data for Forecasting COVID-19 in Egypt, Kuwait, and Saudi Arabia

Faculty of Computers and Information, South Valley University, Qena, Egypt Computer Science Department, Faculty of Science, South Valley University, Qena, Egypt Faculty of Computers and Artificial Intelligence, South Valley University, Hurghada, Egypt Faculty of Computers and Information, Minia University, Minya, Egypt Research Chair of Pervasive and Mobile Computing, Department of Information Systems, College of Computer and Information Sciences, King Saud University, Riyadh 11543, Saudi Arabia Computer Science Department, Faculty of Applied Science, Taiz University, Taiz, Yemen


Introduction and Related Work
Coronavirus disease  is deemed one of the most significant provocative challenges facing humanity in the twenty-first century in terms of disease progression, fast spread, infection ways, and the increasing mortality rate over the world [1]. What makes things even worse is that there had been no prediction of this novel virus and its illness nature before its sudden spread in December 2019 in Wuhan, China. e number of total infection cases worldwide reached 7 410 510 patients, while the number of demise cases recorded 294 418 deaths [2]. Recently, all countries around the world are competing to find a vaccine for the emerging coronavirus. Indeed, there are now some vaccines that prevent COVID-19 such as Pfizer-BioNTech COVID-19 vaccine [3] and Moderna's COVID-19 vaccine [4]. Recently, machine learning is playing an indispensable role in predicting COVID-19. For example, Yan et al. [5] provided a predictive model based on machine learning using Tongji Hospital patients' data from 10/1/2020 to 18/2/ 2020. Yang et al. [6] built a predictive system using machine learning to determine the height of China's epidemic. e predictive system showed that the peak time for the coronavirus was in late February. Rao and Vazquez [7] presented new techniques based on an artificial intelligence framework using a mobile phone to detect COVID-19 patients.
Mohammad and Shakibi [8] used machine learning algorithms to predict patients' mortality rates with COVID-19. Furthermore, time-series forecasting is playing an essential role in predicting the number of deaths caused by COVID-19 in the future. e time-series forecasting (TSF) [9] system involves predicting the system behaviour in the future, based on information about the system's current and past status. Presently, TSF plays an imperative role in several real-world problems, such as the healthcare [9], weather forecasting [10], and others [11]. A deep neural network (DNN) is an artificial neural network (ANN) with multiple layers between the input and output layers. Deep learning is part of a broader family of machine learning methods based on artificial neural networks with representation learning [12]. Many scientific articles have appeared about forecasting COVID-19. For example, Yahia et al. [13] proposed a new technique using deep neural networks, long short-term memory, and CNN to forecast daily confirmed cases. Hu et al. [14] proposed new methods by using artificial intelligence for real-time forecasting of COVID-19 to evaluate the size, lengths, and ending time of COVID-19 across China. Chimmula and Zhang [15] presented a new technique using long short-term memory networks to forecast future COVID-19 cases in Canada. Tian et al. [16] used three machine learning models, including the hidden Markov chain model (HMM), the hierarchical Bayes model, and LSTM, to predict confirmed COVID-19 cases in six countries from 22/1/2020 to 14/4/2020. Mohammed et al. [17] presented a new model to predict confirmed cases of COVID-19 in China for the next ten days based on previously confirmed cases by the Chinese government. Lamiaa et al. [18] used different types of regression models to predict the number of people infected with COVID-19 in Egypt from 15/2/2020 to 15/6/2020. Wang et al. [19] presented the patient information-based algorithm (PIBA) to predict the number of deaths caused by COVID-19 in China. Ibrahim et al. [20] presented a study on coronavirus's epidemiological situation in both Iraq and Egypt by using the Gaussian model, logistic growth model, and compartmental (generalized SEIR) model. Ceylan [21] used autoregressive integrated moving average (ARIMA) to predict the epidemiological trend of COVID-19 in Italy, Spain, and France from 21/2/2020 to 15/4/2020. In this paper, we proposed two deep neural network algorithms to predict death cases and confirmed cases of COVID-19 in three countries: Egypt, Saudi Arabia, and Kuwait. e experimental results were made to time-series data from 1/5/2020 to 6/12/2020. Also, the dataset is divided into 80% training dataset and 20% testing dataset. e training dataset is used to train and optimize long short-term memory (LSTM) and gated recurrent unit (GRU). e testing dataset is used to evaluate models using three metrics, including the mean absolute error (MAE), the mean absolute percentage error (MAPE), and the root mean square error (RMSE). e remainder of this paper is organized as follows. Section 2 presents the proposed system of forecasting COVID-19 in three countries: Egypt, Saudi Arabia, and Kuwait. Section 3 discusses the experimental results. Finally, Section 4 concludes the paper.

Materials and Methods
In this paper, the proposed system forecasts the number of death cases and confirmed cases of COVID-19 in three countries: Egypt, Saudi Arabia, and Kuwait, from 1/5/2020 to 6/12/2020. e proposed system includes five steps which are data collection, data preprocessing, data splitting, model training and optimization, and evaluating the models as shown in Figure 1.

Data Collection.
e Novel Corona Virus 2019 Dataset has been taken from Kaggle [22]. is dataset includes dailylevel information of the number of confirmed cases and death cases of coronavirus. It consists of time-series data in different countries from 22/1/2020 to 6/12/2020. We made experimental results on three time series for the confirmed cases and death cases in three countries: Egypt, Saudi Arabia, and Kuwait.

Data Preprocessing.
Two steps have been applied on time-series data in three countries, namely, Egypt, Saudi Arabia, and Kuwait: transforming data into supervised learning and scaling data.

Transforming Data into Supervised Learning.
We divided the dataset into input samples (x) and targets (y) because we trained the deep learning models by supervised learning, and since we have only performed one-stepahead prediction (1 day), targets (y) are the next time step (t + 1) data points. For input samples (x), we used 5 lags (5 days).

Scaling Data.
A normalization, which is data rescaling from the original range to a new range between 0 and 1, has been done. Specifically, the data have been scaled to be within the range of 0 and 1, and the cause behind doing this is that LSTM and GRU models favor working on data in the range of its activation function. MinMaxScaler (feature_range � (0, 1)) [9], that is, a library in Python language to scaling dataset between 0 and 1, has been used. Besides, the ReLU activation function has been used in LSTM and GRU models. In the evaluation phase (i.e., model testing), the predictions have been transformed back into the primary scale to evaluate the model's performance correctly. For reverse scaling, the inverse_transform function that exists in the MinMaxScaler library in Python has been used. It reverses data row scaling into original values.

Splitting Dataset.
e dataset has been split into two parts for this step (80%) for the training set and (20%) for the testing set. e training set is used to optimize and train the models, while the testing dataset is used to evaluate the models.

Optimization Models.
Long short-term memory (LSTM) and gated recurrent units (GRUs) have been used as two candidate forecasting models for our COVID-19 forecasting problem. For each model, a different number of hidden layers was applied: one layer and two layers. Also, a dropout layer with a hidden layer was used [23]. e output layer includes one neuron, the ReLU activation function, and the Adam optimizer [24]. We used the Keras Tuner library [25] to optimize some parameters of deep neural network models. Table 1 shows the value for a dropout rate and the number of neurons.

Deep Learning Models
(i) Long short-term memory (LSTM) [26] is a special kind of an artificial recurrent neural network (RNN) architecture designed to model time-series and longterm dependency problem. It works more accurately than the conventional RNN. e key to LSTM is the cell state. LSTM network consists of three gates: an input gate (i), a forget gate (f ), and an output gate (o). Each gate is a neuron that has the past state vector (ht -1) and the current input (xt) as its inputs and outputs a number from 0 to 1 indicating the gating rate (1).  Complexity 3 (ii) Gated recurrent unit (GRU) [27] is a simplified LSTM. It has the same role in the network. It differs from LSTM in the number of gates and weights. GRU has two gates. It does not have an output gate and has no control over the memory content. e main controller in the flow of information or adding new information is the update gate [28].

Evaluating the Models.
For measuring models' performance, three errors were used to estimate the forecasting precision of the models; two of these errors are scale-dependent errors where these errors are on the same scale as the data itself and therefore cannot be used to make comparisons between time-series datasets that are on different scales. e two scale-dependent errors that were used in this study are (i) Root mean square error (RMSE), which can be given as follows: (1) (ii) Mean absolute error (MAE), which can be given as follows: where y obs i and y pred i are the actual and predicted observations, respectively. e third measure used is a percentage error, namely, mean absolute percentage error (MAPE), which can be given as follows: e percentage errors have the advantage of being scaleindependent, and therefore they can be used to compare forecast performance between different scaled datasets.

Experimental Results and Discussion
is section will compare the forecasting performances of two neural network forecasting models, namely, GRU and LSTM, for one layer and two layers. In this study, we focus on the time-series data of daily COVID-19 confirmed cases and death cases from 1/5/2020 to 6/12/2020 in three countries: Egypt, Saudi Arabia, and Kuwait. Each model has been trained using the training dataset and evaluated by the testing dataset. e training data consist of a time-series dataset of confirmed and death cases. Also, hyperparameter tuning for each model will be described.

Experimental Setups.
e experiments have been conducted using a laptop with a specification of 20 GB of RAM, seven cores, and 100 GB disk. e dataset is split into 80% training dataset and 20% testing dataset. e deep learning models have been implemented using the Keras package. Some values of DL parameters are adapted: batch size-50 and number of epochs-100. e experimental results are registered to confirmed cases and death cases of COVID-19 in three countries: Egypt, Saudi Arabia, and Kuwait.

e Results of Egypt.
is section discusses the result of applying DL in confirmed cases and death cases time-series data in Egypt. Also, it presents the best value parameters of DL models.

Confirmed Cases
(i) Hyperparameter Tuning. e best value parameters for LSTM and GRU for the confirmed cases in Egypt are shown in Table 2. (ii) e Result of DL.  Figure 2 shows the confirmed cases of COVID-19 in Egypt for 220 days. e figure also shows the real values and the predicted values that are registered by LSTM. e confirmed cases started below 2000 and have increased steadily for 220 days to record the highest values in 220 days at 118432. e LSTM with one layer is registered as the best model; its prediction line is the nearest to the real line. Figure 3 shows the confirmed cases of COVID-19 in Egypt for 220 days. e figure also shows the real values and the predicted values that are registered by GRU. e confirmed cases started below 2000 and have increased steadily for 220 days to record the highest values in 220 days at 118432. e GRU with one layer is registered as the best model; its line prediction is the nearest to the real line.

Death Cases
(i) Hyperparameter Tuning. e best value parameters for LSTM and GRU for death cases in Egypt are shown in Table 4. (ii) e Results of DL. Table 5 shows the results of LSTM and GRU for the death cases in Egypt. e LSTM with one layer registered the best performance       Figure 4 shows changes in real death rates and the predicted death rates that are registered by LSTM in Egypt during 220 days from 1/5/2020 to 6/12/2020. e death rates started below 500 and have increased steadily for 220 days to record the highest values in 220 days at 6771. We can also see that the two models have predicted values nearest to the real values, but the best model is the LSTM with one layer. Figure 5 shows changes in real death rates and the predicted death rates that are registered by GRU in Egypt during 220 days from 1/5/2020 to 6/12/2020. e death rates started below 500 and have increased steadily for 220 days to record the highest values in 220 days at 6771. We can also see that the two models of GRU have predicted values that are nearest to real values.

e Results of Saudi Arabia.
is section discusses the result of applying DL in confirmed cases and death cases time-series data for Saudi Arabia. Also, it presents the best value parameters of DL models.

Confirmed Cases
(i) Hyperparameter Tuning. e best value parameters of LSTM and GRU for the confirmed cases in Saudi Arabia are shown in Table 6.
(ii) e Results of DL.  e confirmed cases started below 24097 and have increased steadily for 220 days to record the highest values in 220 days at 358713. e LSTM with one layer is registered as the best model; its prediction line is the nearest to the real line. Figure 7 shows the confirmed cases of COVID-19 in Saudi Arabia for 220 days. e figure also shows the real values and the predicted values that are registered by GRU. e confirmed cases started below 24097 and have increased steadily for 220 days to record the highest values in 220 days at 358713. e GRU with two layers is registered as the best model; its prediction line is the nearest to the real line.

Death Cases
(i) Hyperparameter Tuning. e best value parameters for LSTM and GRU for death cases in Saudi Arabia are shown in Table 8. (ii) e Results of DL.  Figure 8 illustrates real death rates and the predicted death rates registered by LSTM in Saudi Arabia during 220 days from 1/5/2020 to 6/12/2020. e death rate started below 168 cases and increased rapidly to reach 5965 in 220 days. e figure also shows that the best model is LSTM with one layer, where its line (the red line) is the nearest to the original line. Figure 9 illustrates real death rates and the predicted death rates registered by GRU in Saudi Arabia during 220          8 Complexity days from 1/5/2020 to 6/12/2020. e death rates started below 168 cases and increased rapidly to reach 5965 in days 220. e figure also shows that the best model is GRU with two layers, where its line (the green line) is the nearest to the original line.

e Results of Kuwait.
is section discusses the result of applying DL in confirmed cases and death cases time-series data in Kuwait. Also, it presents the best value parameters of DL models.

Confirmed Cases
(i) Hyperparameter Tuning. e best value parameters for LSTM and GRU for confirmed cases in Kuwait are shown in Table 10. (ii) e Results of DL.  Figure 10 shows the confirmed cases of COVID-19 in Kuwait for 220 days. e figure also shows the real values and the predicted values that are registered by LSTM. e confirmed cases started below 4377 and have increased steadily during 220 days to record the highest values in 220 days at 144369. e two models are registered as the best models; their line is the nearest to the real line. Figure 11 shows the confirmed cases of COVID-19 in Kuwait for 220 days. e figure also shows the real values and the predicted values that are registered by GRU. e confirmed cases started below 4377 and have increased          Complexity steadily during 220 days to record the highest values in 220 days at 144369. e GRU with two layers is registered as the best model; its line is the nearest to the real line.

Death Cases
(i) Hyperparameter Tuning. e best value parameters of LSTM and GRU for death cases in Kuwait are shown in Table 12. (ii) e Results of DL.  Figure 12 shows changes in real death rates and the predicted death rates registered by LSTM in Kuwait during 220 days from 1/5/2020 to 6/12/2020. e death rates started below 30 and have increased steadily to record the highest values in 220 days at 891. We can also see that the line of LSTM with two layers is the nearest to line of real values. Figure 13 shows changes in real death rates and the predicted death rates registered by GRU in Kuwait during 220 days from 1/5/2020 to 6/12/2020. e death rates started below 30 and have increased steadily to record the highest values in 220 days at 891. We can also see that the line of GRU with two layers is the nearest to the line of real values.

Conclusion
is paper proposed a system to forecast the confirmed cases and death cases of COVID-19 in three countries: Egypt, Saudi Arabia, and Kuwait. e proposed system consists of five stages: data collection, data preprocessing, data splitting, model training optimization, and model evaluation. e six time-series datasets have been divided into 80% training dataset and 20% testing dataset. Two deep learning models, LSTM and GRU, have been optimized and trained using a training dataset. Both models have been evaluated using three measures, including MAE, MAPE, and RMSE, using a testing dataset. e results show that LSTM has achieved the best performance in the confirmed cases for three countries, and GRU has achieved the best performance in death cases for Egypt and Kuwait.

Conflicts of Interest
e authors declare that they have no conflicts of interest.