# Early Risk Prediction of Diabetes Based on GA-Stacking
## 3 GA-Stacking
### Stacking Based on CNN and SVM  
CNN rely on the convolutional layer and the pooling layer to extract potential information in the input data. The fully connected layer is used to integrate the information, and the output layer is used to classify. For the physical examination dataset, CNN with a small number of layers can not only take advantage of its fewer parameters, no gradient explosion, and gradient disappearance, etc., but it can also efficiently and accurately explore the potential relationships between attributes [23]. In order to make the CNN more suitable for diabetes risk prediction on physical examination dataset, stacking based on CNN and SVM is proposed. The fully connected layer is used as the mate learner to process the output results of CNN and SVM. The model network structure is shown in Figure 2.  
The amount of physical examination datasets is relatively small, so we simplified the deep CNN structure, as shown in the Figure 2b. After the input attributes are expanded by the fully connected layer, they are processed twice by the convolutional layer, the pooling layer, and the activation layer. Then, the fully connected layer is connected for information integration. Finally, the SoftMax layer is used to obtain the classification result. The following is a detailed introduction to the used parts:  
After the original 32-dimensional physical examination data has undergone feature selection, a 20-dimensional attribute subset is obtained. To avoid the convolutional layer and the pooling layer from ignoring the necessary information, a fully connected layer is added after the input layer to expand the 20-dimensional to 36-dimensional:  
\[X^{\prime}{}_{36\times 1}=W^{T}_{36\times 20}X_{20\times 1}+B_{36\times 1} \tag{4}\]  
where \(X\) is the input matrix, \(X^{\prime}\) is the matrix after expanding, and \(W\) and \(B\) are the parameter matrices of weight and bias. Figure 2: Network structure of GA-stacking. (**a**) shows the structure of GA-Stacking. (**b**) shows the structure of simplified CNN. (**c**) shows the structure of SVM. Convolutional layer: Since the attribute information of the matrix is relatively scattered, padding is used to add 0 to the matrix, in order to prevent the information of the matrix edge from being lost during the convolution. Pooling layer: For the physical examination dataset, maximum pooling is used to extract the maximum value of the local area, which not only retains the information that has the greatest impact on diabetes classification, but also effectively avoids information loss during dimensionality reduction. Activation layer: The activation layer is used after convolutional and pooling layers, which can capture the non-linear factors of the physical examination data and extract effective information. We use \(ReLu\), which converges fastest, as the activation function:  
\[f(x)=\max(0,x) \tag{5}\]  
Fully connected layer: After potential information extraction, the fully connected layer converts the learned information of the physical examination attributes matrix into feature vectors for advanced reasoning. The neurons in this layer are fully connected to the neurons in the activation layer and transmit signals to the output layer or the second part of the convolutional layer. For another primary learner SVM, our main purpose is to construct an optimal decision function. It divides the 20-dimensional vector physical examination data into two categories. For the attribute \(x_{i}\) and the class label \(y_{i}\epsilon\{1\ or\ 0\}\), different kernel functions are used to construct the optimal hyperplane decision function with the largest margin. In this study, we compared the linear kernel, polynomial kernel, and radial basis function. Among them, the radial basis function, as shown in the Equation (6), has the best classification effect. \[K(x,x_{i})=\exp\left(-\frac{||x-x_{i}||^{2}}{2\sigma^{2}}\right) \tag{6}\]  
where, \(\sigma\) is the width parameter of the function, which controls the radial range of the function.