# Hospital Readmission and Length-of-Stay Prediction Using an Optimized Hybrid Deep Model
## 3 Methodology
### Gaocm
The next generations are created by conducting the crossover and possible mutation of the parents. The fitness values for new children are sorted in descending order, and the best of them are selected for the next generations. In the proposed algorithm, the model's loss decreases gradually, and the accuracy increases continuously. The proposed algorithms utilize a modified version of GA with two key differences from the original GA structure. Firstly, the objective function of the proposed method is customized to enhance both accuracy and loss. Secondly, the process of selecting the objective function is based on the calculated loss, leading to two different paths and corresponding loss functions for the optimization process. The fitness function of the GA is defined as  
\[F=\alpha\cdot a\cdot V_{1}+\beta\bigg{(}\frac{1}{l+\varepsilon}\bigg{)}V_{2} \tag{1}\]  
where \(a\) and \(l\) are the accuracy and the loss, respectively, measured on the test set. \(\alpha\) and \(\beta\) are two hyperparameters specified based on calculated loss (2). \(\varepsilon\) is a small value added to the denominator to avoid dividing by zero. \(V_{1}\) and \(V_{2}\) are defined below to select the best kernel size, the filter size, and the number of neurons and epochs. \[V_{1} =0.3\;*\;\bigg{(}\frac{N_{F}}{N_{FT}}\bigg{)}\;+\;0.3\;*\;\bigg{(} \frac{N_{K}}{N_{KT}}\bigg{)}\] \[+\;0.2\;*\;\bigg{(}\frac{N_{U}}{N_{UT}}\bigg{)}+0.2*\;\bigg{(} \frac{N_{E}}{1.5}\bigg{)} \tag{2}\]  
and  
\[V_{2} =0.3\;*\;\bigg{(}1-\frac{N_{F}}{N_{FT}}\bigg{)}\;+\;0.3\;*\; \bigg{(}1-\frac{N_{K}}{N_{KT}}\bigg{)}\] \[+\;0.2\;*\;\bigg{(}1-\frac{N_{U}}{N_{UT}}\bigg{)}+0.2*\;\bigg{(}1 -\frac{N_{E}}{1.5}\bigg{)} \tag{3}\]  
where \(N_{F}\) is the number of convolution filters, \(N_{FT}\) is the total number of convolution filters, \(N_{K}\) is the number of convolution kernels. \(N_{KT}\) is the total number of convolution kernels, \(N_{U}\) is the number of neurons at the deep layer, \(N_{UT}\) is the total number of neurons at the deep layer, and \(N_{E}\) is the total number of epochs. Compared to traditional CNN models, the proposed methods can use dynamic kernel size to evaluate the quality of the extracted features for the final LOS and readmitted time frame prediction. Furthermore, the proposed method uses only two convolutional layers for feature extraction, and the depth of the proposed method is lower than traditional CNNs like VGG16. The search environment for the kernel sizes are 3, 5, 7, and 9. The search environment for filter size is between 32 and 36 and 62 to 64 for the first and second convolutional layers. The search environment for the number of neurons is between 256 and 512 and 124 to 256 for the first and second dense layers. The search environment for the number of epochs is 500 to 1000. The proposed method can extract various combinations of feature sets screened by the fitness function values. The fitness function has been defined in a way that increases the accuracy while decreasing the loss. To make sure the value of the fitness function is smooth, we define the values of \(\alpha\) and \(\beta\) as follows:  
* If the loss (\(l\)) is greater than or equal to 1, the categorical cross-entropy loss (CCL) varies between 1 and 10. Thus, we define alpha and beta as 0.1 and 0.9, respectively;
* If the loss (\(l\)) is less than 1, the CCL varies between 0.001 and 1. Thus, we define \(\alpha\) and \(\beta\) as 0.99 and 0.01, respectively. In summary, the proposed approach sets the number of neurons, convolutional kernel size, and convolutional filter size. Besides choosing the mentioned parameters of the model, GAOCNN indicates the number of epochs for training the model, too. Thus, GAOCNN tries to increase the number of epochs as long as the tuned structure increases the accuracy and decreases the loss. Choosing the number of epochs for training leads to the optimal time for training.