Introduction

Recently, the novel virus named “coronavirus” or we all know it as “COVID-19” is a subject that is under intense study. SARS-CoV-2 is a large family [1] of viruses that can cause fatal health issues in human beings. Researchers and scientists are running against time to find a vaccine and further prevention for this virus. The current outbreak of the virus was reported in late December of 2019 [1], in Wuhan, China. This virus is so contagious that it has spread all around the world in a short period. On January 30, 2020, WHO (World Health Organization) Director-General Dr. Tedros Adhanom Ghebreyesus declared this outbreak as a Public Health Emergency [2] of International Concern. Later on, March 11, WHO announced this unseen, dangerous, infectious virus as pandemic [2], when more cases and deaths were reported. The world has been facing many challenges due to these pandemics periodically over the centuries, and the effects of these pandemics have an enormous impact on the world. Moreover, the world does not only crash economically [3] but also the overall strengths and morals of the people are impacted.

Fig. 1
figure 1

Bangladesh new cases data from April 10−June 30, 2020 [4]

Furthermore, to break the chain of this contagious virus, many countries [3] took preventive measures, including travel bans, home-office, country lockdown, and most importantly, social distancing. However, Bangladesh, a lower-middle-income economy and one of the most populated countries globally, is facing many challenges. Therefore, it is essential to know the accurate prediction and the natural progression of this virus for a country like Bangladesh. Figure 1 shows the trend of the new cases of Bangladesh. The field of statistics, ML (machine learning) and AI (artificial intelligence), has provided us with various techniques and models to predict the next stage of this virus and take effective measures beforehand. This study aims to develop a prediction model and facilitate the decision-making process, where data are analyzed to get the perspective. Due to the data insufficiency in such a short period, which is not sufficient to train the AI models. Nevertheless, an effectively trainable AI model for time-series data is required, which can help forecast efficiency. At the very beginning of an epidemic, it is necessary to take proper and practical measures to prevent it from crossing the geological boundaries [5], which can save many lives with less impact. Therefore, forecasting and the proper study of the disease spread pattern can be a strategic plan in the planning of control strategy. Researchers can utilize predictive models to generate the prognosis, which depends on the underlying forecasting algorithm. In the case of COVID-19, the scenario is changing intensely with each passing day. In this situation, deep learning algorithms can provide a better mirror of the eye and upsurge [5]. Yang et al. have used an AI model taking the previous Severe Acute Respiratory Syndrome (SARS) dataset, which also shows the assurance for the future expectations of the plague [6]. They also introduced the dynamic SEIR (Susceptible-Exposed-Infectious-Recovered) model for foreseeing the COVID-19 contagion apex and sizes. More research works such as Sujatha and Chatterjee [7] have proposed a model that can be useful for perceiving the COVID-19 spread. They have used the linear regression, Multilayer perceptron, and vector autoregression model on the Kaggle data for COVID-19 to visualize the hygienic example of the illness and measure of COVID-19 cases in India. Haytham H. Elmousalami et al. [8] also has utilized the time-series models and numerical detailing to represent the correlation of the day level to determine the COVID-19 influenced cases. For the time series prediction and forecasting problems, the adaptive neuro-fuzzy inference system (ANFIS) [9] is universally applied as it has demonstrated a good performance in many extant applications. Furthermore, the adaptive neuro-fuzzy inference system (ANFIS) is flexible. It can determine the nonlinearity in the time series and combine both the Artificial Neural Network (ANN) and the fuzzy logic systems. Al-qaness et al. has proposed the FPASSA-ANFIS model, which is the enhanced model of ANFIS and flower pollination algorithm (FPA) using the salp swarm algorithm(SSA). They have used the WHO (World Health Organization) official data for predicting the confirmed cases for the upcoming ten days, namely in China and USA [10]. More researches like the paper [11] has suggested more effective models handle the non-linearity and the complexity of the COVID-19 time-series data. Moreover, long short-term memory (LSTM) is a model that holds the correlation of the time series dynamics. The COVID-19 data are time series data that compiles the number of confirmed cases where the cases increase endlessly over time until it arrives at a specific concentrated peak curve. From there, the LSTM captures the pattern of the dynamic growth of graphs with a minimum RMSE compared to RNN [11]. This paper has been organized as follows. In Section 2, the methods of LSTM and ANFIS are explained in detail. In Section 3, we have discussed how the dataset was prepared. Then, in Section 4, we have presented our results. Later, in Sections 5 and 6, we have discussed the findings and limitations of the results and possible threats to validity, respectively. Lastly, in Section 7, the conclusion of the work is given.

Methods

The experiment was conducted in two different types of neural network systems. Therefore, one algorithm was chosen from the fuzzy inference system and another from the recurrent neural network. ANFIS was selected from the fuzzy inference system due for multiple reasons. This algorithm is a combination of ANN and Takagi–Sugeno fuzzy inference systems. Thus, it takes all the advantages of both approaches in a single framework. Furthermore, ANFIS is considered a universal estimator. Therefore, there is always an opportunity to find ANFIS more efficient and optimal if we can find the best parameter by genetic algorithm [12, 13]. This system also can process non-linear functions by using the sets of fuzzy “IF–THEN” rules [14]. That is why ANFIS is a perfect candidate for this experiment. We chose another algorithm from recurrent neural networks. There are so many networks like simple RNN, Gated Recurrent Unit (GRU), LSTM, etc. Each network has its advantages and disadvantages. For example, simple RNN does not have any gates, whereas GRU introduces gates to decide whether it will pass the previous input to the next cell or not. GRU also has a memory unit. The reason why we chose LSTM is that it has both advantages of RNN and GRU. Besides, it has two more extra gates called “Forgot gate” and “Output gate” making LSTM more efficient than other recurrent neural networks. LSTM also has a feedback connection that allows it to process single data points and sequential data points. Hence, LSTM is another best candidate for our case as here we used time-series data, which is sequential. If we chose LSTM over RNN or GRU, then we can utilize so many extra features that give us the control to mix up inputs and weights. LSTM not only gives us the most control ability and flexibility but also gives better results.

Adaptive Neuro-Fuzzy Inference System (ANFIS)

ANFIS architecture is a modified part of the artificial neural networks (ANNs). With the assimilation of the Takagi–Sugeno fuzzy which is the modification of the fuzzy logic [15, 16] system, and it prospers a high performance in both computing and learning techniques which are dealing with nonlinearity [15, 16] (See Fig. 2).

Fig. 2
figure 2

Architecture of the developed ANFIS

There are five main layers in the ANFIS model [17]. The layer starts with the input layer, which takes in the parameters and then constructs them into the model. This layer is also the input layer of the fuzzy system. Later, using the first layer’s outputs, the second layer is created, which carries the member functions’ (MF) preceding values. Using the nodes on the second layer, which steadfast the degree of activity on fuzzy rules are concluded. Moreover, the third layer of the ANFIS model expands the degree of the activity of any regulations. The second last layer normalizes the functions, and the nodes facilitate the production of the outputs and finally send them to the final layer, which is the output layer. Furthermore, the accuracy of the ANFIS model is determined using the number and type of MFs, the optimum method, and the output of the MF type [17]. The input parameters are set as the independent variables on each scenario, and the outcome was the number of cases. Among the eight MFs type, we chose the best three MFs types, namely triangular, trapezoidal, and Gaussian, was used to train the ANFIS model so that the best MFs can be determined. Furthermore, for reducing the errors, the output membership function type was selected as linear. The optimum backpropagation (BP) method and the “0” value of error tolerance were done on training the fuzzy inference system (FIS).

Long Short-Term Memory (LSTM)

From the various deep learning methods, we can say the recurrent neural network(RNN) has been convinced to be the most robust for prediction. As it can automatically excerpt the necessary features from the training samples, delivering the activation from the previous time step as the load for the present time step and the network self-connections [18]. As Connor et al. mentioned, RNN is satisfying at processing data and manifests promising results in the time-series prediction by hoarding enormous historical information in its internal state [19]. However, it has an inconvenience of evanescence and the gradient detonate problems, leading to the abundant training time or the training does not work at all [20]. Therefore, to overcome this drawback, Hochreiter and Schmidhuber have designed the long short-term memory RNN structure in the year 1997 by dealing with the long-term dependency with the help of the multiplicative gates. These gates will manage the information flow, and the memory cells in the recurrent hidden layer [21]. The architecture of LSTM subsists of four gates, namely, input gate, forget gate, control gate, and the output gate [20]. Figure 3 shows the basic structure of LSTM.

Fig. 3
figure 3

The basic structure of the LSTM [20]

Some equations describe the gates of LSTM. Before explaining the equation, we need to know some variables used in these equations. The weight matrices are W, and the activation function is \(\sigma\), which is taken as the sigmoid. \(h_{t-1}\) represents the output of the previous LSTM block, and b represents the bias for the respective gates. Lastly, \(x_t\) is the input of the current timestamp. Now, The Input gate (\(i_t\)) is described as,

$$\begin{aligned} i_t=\sigma (W_i * [h_{t-1},x_t] + b_i) \end{aligned}$$
(1)

This equation chose information that can be passed to the cell. The data from the input side of a previous memory, which is to be ignored, is decided by the forget gate (\(f_t\)) by the following equation,

$$\begin{aligned} f_t=\sigma (W_i * [h_{t-1},x_t] + b_i) \end{aligned}$$
(2)

Control gate (\(C_t\)) controls the update of the cell by the following formula where tanh is used to normalize the values into range -1 to 1 and \(\tilde{C}\) is the candidate for cell state at timestamp (t).

$$\begin{aligned} \tilde{C} = tanh(W_c * [h_{t-1},x_t] + b_c)\nonumber \\ C_t=f_t * C_{t-1} + i_t * \tilde{C}_t \end{aligned}$$
(3)

The output layer (\(o_t\)) updates both hidden layer \(h_{t-1}\) and output as is given by,

$$\begin{aligned} o_t=\sigma (W_o * [h_{t-1},x_t] + b_o)\nonumber \\ h_t=o_t * tanh(C_t) \end{aligned}$$
(4)

Hardware and Software Setup

The algorithms were not implemented from scratch. For the ANFIS algorithm, we used the fuzzy logic toolbox of Matlab 2016 software, and for the LSTM algorithm, we used python 3.7. We also used Tensorflow 2 and Keras as the API. For the supportive package, Jupyter notebook, pip3, NumPy, Matplotlib, and spicy were installed. All of these python packages performed their action on a Linux operating system. The hardware had the Intel core i5 4th generation processor with the clock speed of 3.20 GHz. It has 16 GB of DDR3 Ram, and the bus speed of the ram is around 1600Mhz. It also had the NVIDIA GTX 1060 6 GB graphics processing unit.

Dataset

Data Collection

The dataset is the statistical report of COVID-19 cases of Bangladesh, which is available online [4]. Right now, this online source is the most authentic source where daily covid cases are recorded. They collected data from other authentic sources. Many researchers are doing their research by collecting the data from this online source [17, 20]. The dataset range is from 10 April 2020 to 30 June 2020, for training the dataset is taken from 10 April 2020 to 19 June 2020, and the remaining days till 30 June (2020) is taken for testing the model. It is essential to train the algorithm at the initial step for developing a firm model [17]. Moreover, a forecasting model is recommended to be classified into two categories, i.e., input(s) (as independent variable(s)) and output(s) (as dependent variable(s)) [17]. The time-series data of Bangladesh was taken into three scenarios. The first and second scenario is designed for the desired output x(t) days where we have taken the last four consecutive odd and even days, respectively. Lastly, for the third scenario, the last four consecutive days are taken as the input for output x(t). The ANFIS model and the LSTM both were implemented on this dataset for achieving reliable prediction.

Table 1 No. of inputs selection test results

Data Preparation

After collecting the data, we applied a strategy named teacher forcing. The teacher forcing method means if we expect an output y(t), then its input will be the prior time step x(t-1). Table 1 shows that we have to take four previous time steps as input because it is optimal for our case. We did a quick small test to determine the number of optimal inputs for our test. We used the LSTM algorithm with fixed parameters, which are also mentioned in Table 1 to determine which number of inputs gives us a better result. For this test, we considered prior to consecutive three steps, four steps, and five steps as inputs.

Table 2 Three proposed scenarios for time-series prediction of COVID-19 in Bangladesh

We can also understand from Table 1 that there are multiple methods to take the previous days. Consecutive is not the only way to take prior days. We also can consider prior odd or even days. However, we did not know which method is best for our experiment. That is why in Table 2, we proposed three ways (Scenarios). There might be other combinations like taking the first two consecutive days, one day gap, then the next two consecutive days, or different possible combinations. We did not include those possible combinations as they are made from the proposed three combinations.

The Correlation Matrix

Before implementation, we examine the correlation between each input and output. Correlation is a ubiquitous term in the statistical area. It is a single number that gives acknowledgment of the degree of relationship between the inputs and output. The correlation matrix summarizes the dataset and visualizes the pattern in the dataset, and provides feedback on whether the dataset contains any unwanted data or not. Although each scenario’s output column is the same, the input columns are different in every scenario. Every scenario is different in terms of input. So, we have to check the correlation of each scenario. As we mentioned earlier, that Table 1 has three different scenarios, which are used for training and testing. The first scenario was constructed with the previous four odd days as the input of each output. So the correlation matrix of the scenario is shown in Fig. 4,

Fig. 4
figure 4

The Correlation Matrix of Scenario 1

From the matrix, we can summarize that the correlation between each column lies from 0.96 to 0.97. There are no anomalies found in this scenario. Then the second scenario is the vice versa of scenario 1 where instead of taking odd days, we took even days, and the correlation matrix of this scenario is shown in Fig. 5,

Fig. 5
figure 5

The Correlation Matrix of Scenario 2

This scenario’s correlation matrix is also shown to have a better correlation as in the previous scenario. For the third scenario, we took the consecutive last four days to predict the output and the correlation matrix of this scenario (Fig. 6). The reason behind choosing interval and alternative days is that most Machine Learning approaches can not predict more than 10 days ahead of input data on the small linear dataset.

Fig. 6
figure 6

The Correlation Matrix of Scenario 3

Checking all the correlation matrices of each scenario, we can summarize that each scenario shows a high correlation between Inputs and output and does not contain any anomalies.

Evaluation

The appraisals were conducted by finding the correlation coefficient (R), mean absolute percentage error (MAPE), and the root-mean-square rrror (RSME). The performances of the models are evaluated by using these factors. Below are the formulas used to calculate the factors.

$$\begin{aligned} R = \frac{N\sum (xy)-\sum (x)*\sum (y)}{\sqrt{[n\sum (x^2)-\sum (x)^2][n\sum (y^2)-\sum (y)^2}}\end{aligned}$$
(5)
$$\begin{aligned} MAPE = \frac{1}{N}\sum _{t=1}^{n}\left| \frac{x_t-y_t}{x_t}\right| \end{aligned}$$
(6)
$$\begin{aligned} RMSE = \frac{1}{N}\sum _{t=1}^{n}\sqrt{(x_t-y_t)^2} \end{aligned}$$
(7)

Where N represents the number of data points and x and y are the actual and predicted value respectively.

Results

The ANFIS model’s performance and the LSTM are evaluated using both the training and testing data, and the best-case scenario is defined.

Adaptive Neuro-Fuzzy Inference System (ANFIS)

The parameters were not set arbitrarily. There are two optimum methods. One is backpropagation, and another is hybrid. In our case, the hybrid optimum method is not suitable for our dataset. We have performed a small test to determine which optimum method is ideal for our experiment. We found that the hybrid method’s error is much higher than the backpropagation method; hence, we chose backpropagation. There are various ANFIS parameters, for example, number of MFs, MF types, or optimum methods, which can be modified to test the dataset. We played with those parameters and came up with optimal settings mentioned in Table 3. As mentioned earlier, we picked three MF types that are the best among the nine MF types. We also set the number of input MFs to 3, which is also optimal, as the other values we have tried did not give promising results for the experiment. Firstly, the ANFIS model was carried out on the dataset using the three MF types, namely, triangular, trapezoidal, and Gaussian, where the back propagation (BP) was used as the optimum method. All outputs of MF are linear, and the number of MF is 3, as shown in Table 3.

Table 3 ANFIS training results

From the first observation, from Table 3, we can see that the best membership function for the ANFIS model is trapezoidal. However, Scenario 3 seems to have all the correlation coefficients negative, meaning the inputs have a negative relationship with the output. It can be said that using the trapezoidal MF for Scenario 2, we get a positively high correlation and lower RMSE value compared to the other two MF types in Scenario 2.

Fig. 7
figure 7

Plot diagrams for the prediction of daily (Trapezoidal)

As we can see from the graph that the actual cases and Scenario 2 predicted cases curve has a similar wave, though there is still a difference in the value (See Fig. 7).

Long Short-Term Memory Network(LSTM)

The LSTM was also applied in the three scenarios for prediction. The dropout regularization method was the input in this recurrent connection to the LSTM units, which reduces the overfitting and improves the model performance by updating the weights while training a network [22]. The batch size decreases from 32, 16, and 8, respectively. The four-layer units were increased by 5 gradually such that the first layer had 5, the next layer 10, and so on till the fourth layer. Table 4 shows the dropout values and the epoch value.

Table 4 LSTM fixed training parameters
Table 5 LSTM training results

From the Table 5, it can be clearly said that Scenario 2 with the batch size 16 has the best RMSE value and the best correlation coefficient between input and output. However, Scenario 1 with batch size 16 has a higher correlation coefficient, but the RMSE value is pretty high; therefore, it can not be considered the best case.

Validation

Table 6 and Fig. 8 represent the ANFIS and LSTM model’s best prediction results from 19th to 30th June 2020. The LSTM has presented more convincing values for RMSE and correlation coefficient for forecasting the outbreak.

Table 6 Best training results from both algorithms
Fig. 8
figure 8

Plot diagram for the best prediction results of ANFIS and LSTM Model

Discussion

We have used the ANFIS and LSTM based prediction model to forecast the COVID-19 pandemic growth in Bangladesh. These time-series data are the compiled number of confirmed cases are rising high and arriving at a specific coincided peak curve. These two machine learning approaches are used only for predicting and making no assumption in this outbreak. From our observation, we can say that LSTM has provided us with more satisfactory results compared to ANFIS for predicting the COVID-19 pandemic. Furthermore, we have taken three scenarios for our experiment, from which the Scenario 2 has been showing better results than the other two scenarios. Additionally, LSTM captured the pattern of this hyped-up growth of the graph with a better correlation value and RMSE. However, both the models have shown to have a decent potential in predicting time-series data. Moreover, we cannot forget the convoluted anomaly of this outbreak. Further research is still very fundamental to endorse the results and improve the quality of prediction. In some cases choosing the right activation function can give us a better result. However, most of the time, testing various configurations and evaluating the outcome provides better results. We also tested multiple configurations and found out that one of the configurations of LSTM gives the best result from all other configurations. From our observation at the end of the experiment, it is worth mentioning that ANFIS consumes more time and hardware resources for training than LSTM.

Threats to Validity

There are few mentionable threats for the experiment; that is, there might be some problems with the dataset as not all the published cases are not of that specific day only. It might occur due to a lack of test time processing. There is another threat of an outlier to appear, even though this dataset of Bangladesh did not have outliers. However, there is no guarantee if this will not happen as if it occurred in China on 12 Feb 2020 [23]. Before 11 February, the daily new cases were 2015, and later, on 13 February, the daily new cases were 5090. In comparison to these two days, 12 February is an outlier data for the model. Therefore, we can exclude this type of days while training.

Conclusion

Much research is ongoing to predict the COVID-19 as our daily livelihood depends on the result of this crisis. Various studies are done using different prediction models. We have selected the ANFIS model and the LSTM for predicting the COVID-19 cases in Bangladesh. However, more work is required for verifying which forecasting method or model is competent in all cases for all the different populations worldwide. The input data is not correct either as there are various reasons like an infected person is asymptotic or did not get tested or did not get listed in the database. Nevertheless, the gradual learning approach can overcome these imprecise input data. Also, there is an unknown suspect in the community that few countries are reporting false data for political reasons. Many countries, including Bangladesh, implemented social distancing and lockdown, resulting in an impact on the cases and casualties. By considering these factors, the results of the predictions can be a little inhibited. While we tried to provide a promising result for the Bangladesh data, yet we need to further test for more optimized and far more accurate results on various other databases. Nonetheless, the given results are displaying promise and success for AI in predicting a pandemic.