## 3 Methodology
### Diabetes Prediction Models
#### 3.5.3 CNN-Bi-LSTM: A Real-Time Framework
: _(Stride:) The stride is the number of pixels that have been moved across the input matrix. If we set the value of stride as 1, the filters shift one pixel at a time, whereas if we set the value of stride at 2, the filters move two pixels at a time. In this section, we use stride filters with kernel sizes of 1._  
* Bi-LSTM Estimation of the layer: Using Bi-LSTM [49; 50], the output data of the CNN layer are determined. Bi-LSTM is a bidirectional RNN that consists of 32 hidden LSTM cells, so there are a total of 64 LSTM cells that have an additional peehole connection that prevents vanishing gradient problems and additional cell state memory that uses past and future knowledge to forecast output by using two separate hidden layers, such as forward state sequence, is represented by \(\overset{\rightarrow}{h}_{t}\) as shown in Equation (6) [43], the backward state sequence \(\overset{\leftarrow}{h}_{t}\) is shown in Equation (7) [43], and the output vector is represented by Equation (8) \[\overset{\rightarrow}{h}_{t}=H\Big{(}W_{ph}p_{t}+W_{hh}h_{t-1}+b_{h}\Big{)},\] (6) \[\overset{\leftarrow}{h}_{t}=H\Big{(}W_{ph}p_{t}+W_{hh}h_{t+1}\,+b_{h}\Big{)},\] (7) where \(h_{t}:\) hidden state at timestamp \(t\) \(W_{ph}:\) weight matrix between input and hidden vector \(p_{t}:\) input vector at timestamp \(t\) \(W_{hh}:\) the weight vector between two hidden states \(h_{t+1}:\) the hidden state vector at timestamp \(t\)\(+1\) \(b_{h}\): the bias vector for hidden state vectors \[q_{t}=W_{pq}\overset{\rightarrow}{h}_{t}+W_{pq}\overset{\leftarrow}{h}_{t}+B_ {q},\] (8) As a result, output values \(q_{t}\) are derived by summing up weight matrices of input and output by performing a dot product by forwarding hidden layers \(\overset{\rightarrow}{h}_{t}\) and backward hidden layers \(\overset{\leftarrow}{h}_{t}\) and adding a constant bias \(B_{q}\). * Dropout: 15% dropout was applied, which is used to reduce the overfitting in neural networks by dropping some of the random nodes during the network training process;
* Output values were transferred into a sigmoid function used for binary classification, which determines whether or not the input instance is diabetic [51];
* Calculation Error: The cost function assesses how effectively the neural network is equipped by describing the difference between the provided testing sample and the expected performance. The optimizer function was used to decrease the cost function. A cross-entropy function, which comes in a variety of forms
and sizes, is commonly used in deep learning. Mathematically cost function \(\varphi\) is expressed as Equation (9) [35]:  
\[\varphi=\frac{1}{m}\sum(a\ \log(b)+(1-a)\log(1-b)), \tag{9}\]  
where  
\(m:\) batch size  
\(a:\) output resultant value  
\(b:\) expected value  
Experiments have shown that when Adam is used, the optimal point is reached fast. As a result, we employed the Adam optimizer method, which has a \(1\times 10^{-4}\) learning rate. * Evaluate if the prediction mechanism's final criterion has been achieved: Effective completion of cycles depends on two factors: weights should not exceed a certain threshold, and the estimated error rate is below a specified threshold. If at least one of the graduation standards is fulfilled, the training is finished. Otherwise, the instruction would be resumed;
* Back Propagation Error: The calculated error is spread in the opposite direction, the weight and bias of each layer are modified, and then the process goes back to stage (4) to start network training. Hyperparameter Optimization: In this part, we presented the techniques for tuning the hyperparameter for model training in the best way possible to predict diabetes more accurately. It is a technique that helps us reduce the cost of the model by tuning hyperparameters that change the shape of the model to achieve the highest accuracy. This study applied a grid search algorithm to five deep learning models to train their parameters. **Definition 2**.