Abstract

The novel coronavirus disease (COVID-19) is regarded as one of the most imminent disease outbreaks which threaten public health on various levels worldwide. Because of the unpredictable outbreak nature and the virus’s pandemic intensity, people are experiencing depression, anxiety, and other strain reactions. The response to prevent and control the new coronavirus pneumonia has reached a crucial point. Therefore, it is essential—for safety and prevention purposes—to promptly predict and forecast the virus outbreak in the course of this troublesome time to have control over its mortality. Recently, deep learning models are playing essential roles in handling time-series data in different applications. This paper presents a comparative study of two deep learning methods to forecast the confirmed cases and death cases of COVID-19. Long short-term memory (LSTM) and gated recurrent unit (GRU) have been applied on time-series data in three countries: Egypt, Saudi Arabia, and Kuwait, from 1/5/2020 to 6/12/2020. The results show that LSTM has achieved the best performance in confirmed cases in the three countries, and GRU has achieved the best performance in death cases in Egypt and Kuwait.

Coronavirus disease (COVID-19) 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. The 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. The 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. The 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. The 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. The training dataset is used to train and optimize long short-term memory (LSTM) and gated recurrent unit (GRU). The 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).

The 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.

2. 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. The 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.

2.1. Data Collection

The Novel Corona Virus 2019 Dataset has been taken from Kaggle [22]. This dataset includes daily-level 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.

2.2. 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.

2.2.1. 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-step-ahead prediction (1 day), targets (y) are the next time step (t + 1) data points. For input samples (x), we used 5 lags (5 days).

2.2.2. 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.

2.3. Splitting Dataset

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

2.4. Model Optimization and Training
2.4.1. 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]. The 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.

2.5. 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 long-term dependency problem. It works more accurately than the conventional RNN. The 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).(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. The main controller in the flow of information or adding new information is the update gate [28].
2.6. 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. The two scale-dependent errors that were used in this study are(i)Root mean square error (RMSE), which can be given as follows:(ii)Mean absolute error (MAE), which can be given as follows:where and are the actual and predicted observations, respectively.

The third measure used is a percentage error, namely, mean absolute percentage error (MAPE), which can be given as follows:

The percentage errors have the advantage of being scale-independent, and therefore they can be used to compare forecast performance between different scaled datasets.

3. Experimental Results and Discussion

This 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. The training data consist of a time-series dataset of confirmed and death cases. Also, hyperparameter tuning for each model will be described.

3.1. Experimental Setups

The experiments have been conducted using a laptop with a specification of 20 GB of RAM, seven cores, and 100 GB disk. The dataset is split into 80% training dataset and 20% testing dataset. The 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. The experimental results are registered to confirmed cases and death cases of COVID-19 in three countries: Egypt, Saudi Arabia, and Kuwait.

3.2. The Results of Egypt

This 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.

3.2.1. Confirmed Cases
(i)Hyperparameter Tuning. The best value parameters for LSTM and GRU for the confirmed cases in Egypt are shown in Table 2.(ii)The Result of DL. Table 3 shows the results of LSTM and GRU for the confirmed cases in Egypt. The GRU with one layer registered the best performance (MAPE of 0.46629, RMSE of 670.30478, and MAE of 531.85892), while the GRU with two layers recorded the lowest performance (MAPE of 4.46410, RMSE of 5081.1000, and MAE of 4999.11193). Also, the second-best performance is registered by LSTM with one layer (MAPE of 0.81385, RMSE of 1067.02289, and MAE of 922.83940).

Figure 2 shows the confirmed cases of COVID-19 in Egypt for 220 days. The figure also shows the real values and the predicted values that are registered by LSTM. The confirmed cases started below 2000 and have increased steadily for 220 days to record the highest values in 220 days at 118432. The 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. The figure also shows the real values and the predicted values that are registered by GRU. The confirmed cases started below 2000 and have increased steadily for 220 days to record the highest values in 220 days at 118432. The GRU with one layer is registered as the best model; its line prediction is the nearest to the real line.

3.2.2. Death Cases
(i)Hyperparameter Tuning. The best value parameters for LSTM and GRU for death cases in Egypt are shown in Table 4.(ii)The Results of DL. Table 5 shows the results of LSTM and GRU for the death cases in Egypt. The LSTM with one layer registered the best performance (MAPE of 0.44542, RMSE of 29.86051, and MAE of 28.59449), while the GRU with one layer recorded the lowest performance (MAPE of 3.35898, RMSE of 221.54026, and MAE of 217.90819). Also, the second-best performance is registered by LSTM with two layers (MAPE of 2.65719, RMSE of 174.04480, and MAE of 172.20877).

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. The 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. The 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.

3.3. The Results of Saudi Arabia

This 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.

3.3.1. Confirmed Cases
(i)Hyperparameter Tuning. The best value parameters of LSTM and GRU for the confirmed cases in Saudi Arabia are shown in Table 6.(ii)The Results of DL. Table 7 shows the results of LSTM and GRU for the confirmed cases in Saudi Arabia. The LSTM with one layer registered the best performance (MAPE of 0.07337, RMSE of 292.78232, and MAE of 259.10709), while the GRU with one layer recorded the lowest performance (MAPE of 2.62286, RMSE of 9267.03761, and MAE of 9253.56777). GRU registered the second-best performance with two layers (MAPE of 0.98515, RMSE of 3505.32098, and MAE of 3478.44134).

Figure 6 shows the confirmed cases of COVID-19 in Saudi Arabia for 220 days. The figure also shows the real values and the predicted values that are registered by LSTM. The confirmed cases started below 24097 and have increased steadily for 220 days to record the highest values in 220 days at 358713. The 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. The figure also shows the real values and the predicted values that are registered by GRU. The confirmed cases started below 24097 and have increased steadily for 220 days to record the highest values in 220 days at 358713. The GRU with two layers is registered as the best model; its prediction line is the nearest to the real line.

3.3.2. Death Cases
(i)Hyperparameter Tuning. The best value parameters for LSTM and GRU for death cases in Saudi Arabia are shown in Table 8.(ii)The Results of DL. Table 9 shows the results of LSTM and GRU for the death cases in Saudi Arabia. The LSTM with one layer registered the best performance (MAPE of 0.13875, RMSE of 12.35616, and MAE of 8.07489), while LSTM with two layers recorded the lowest performance (MAPE of 3.48952, RMSE of 197.16462, and MAE of 197.06171). GRU registered the second-best performance with two layers (MAPE of 3.97765, RMSE of 64.71113, and MAE of 52.99585).

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. The death rate started below 168 cases and increased rapidly to reach 5965 in 220 days. The 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 days from 1/5/2020 to 6/12/2020. The death rates started below 168 cases and increased rapidly to reach 5965 in days 220. The 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.

3.4. The Results of Kuwait

This 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.

3.4.1. Confirmed Cases
(i)Hyperparameter Tuning. The best value parameters for LSTM and GRU for confirmed cases in Kuwait are shown in Table 10.(ii)The Results of DL. Table 11 shows the results of LSTM and GRU for the confirmed cases in Kuwait. The GRU with two layers registered the best performance (MAPE of 0.73056, RMSE of 1150.09990, and MAE of 957.22111), while the GRU with one layer recorded the lowest performance (MAPE of 5.38244, RMSE of 7345.07808, and MAE of 7297.40818). LSTM registered the second-best performance with one layer (MAPE of 0.90842, RMSE of 1420.72388, and MAE of 1187.80330).

Figure 10 shows the confirmed cases of COVID-19 in Kuwait for 220 days. The figure also shows the real values and the predicted values that are registered by LSTM. The confirmed cases started below 4377 and have increased steadily during 220 days to record the highest values in 220 days at 144369. The 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. The figure also shows the real values and the predicted values that are registered by GRU. The confirmed cases started below 4377 and have increased steadily during 220 days to record the highest values in 220 days at 144369. The GRU with two layers is registered as the best model; its line is the nearest to the real line.

3.4.2. Death Cases
(i)Hyperparameter Tuning. The best value parameters of LSTM and GRU for death cases in Kuwait are shown in Table 12.(ii)The Results of DL. Table 13 shows the results of LSTM and GRU for the death cases in Kuwait. The LSTM with two layers registered the best performance (MAPE of 1.28359, RMSE of 11.08447, and MAE of 10.55966), while GRU with one layer recorded the lowest performance (MAPE of 3.52966, RMSE of 29.53712, and MAE of 29.40379). GRU registered the second-best performance with two layers (MAPE of 2.22638, RMSE of 18.65710, and MAE of 18.44505).

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. The 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. The 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.

4. Conclusion

This paper proposed a system to forecast the confirmed cases and death cases of COVID-19 in three countries: Egypt, Saudi Arabia, and Kuwait. The proposed system consists of five stages: data collection, data preprocessing, data splitting, model training optimization, and model evaluation. The 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. The 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.

Data Availability

Novel Corona Virus 2019 Dataset was obtained from https://www.kaggle.com/sudalairajkumar/novel-corona-virus-2019-dataset.

Conflicts of Interest

The authors declare that they have no conflicts of interest.

Acknowledgments

The authors are grateful to the Deanship of Scientific Research, King Saud University, for funding through Vice Deanship of Scientific Research Chairs.