# FCNN-SE: An Intrusion Detection Model Based on a Fusion CNN and Stacked Ensemble
## 3 Materials and Methods
### SE Method  
The SE method is shown in Figure 2. In the SR method, multiple base learners are trained using the original dataset. In the training process, the K-fold cross-validation is used to reduce the risk of model overfitting. The posterior probabilities of the base learners for each class of data are formed into a new dataset, which is used to retrain the meta-learner to obtain the final classification results.  
\begin{table}
\begin{tabular}{c c c c c} \hline \hline
**No.** & **Layer** & **Size** & **Step** & **Number** \\ \hline \multirow{2}{*}{1} & Input layer & 41 & - & - \\  & Input layer & \(7\times 7\) & - & - \\ \hline \multirow{2}{*}{2} & Convolution layer 1-1 & 3 & 1 & 32 \\  & Convolution layer 2-1 & \(3\times 3\) & \(1\times 1\) & 32 \\ \hline \multirow{2}{*}{3} & MaxPooling layer 1-1 & 2 & 2 & 32 \\  & MaxPooling layer 2-1 & \(2\times 2\) & \(2\times 2\) & 32 \\ \hline \multirow{2}{*}{4} & Convolution layer 1-2 & 3 & 1 & 64 \\  & Convolution layer 2-2 & \(3\times 3\) & \(1\times 1\) & 64 \\ \hline \multirow{2}{*}{5} & MaxPooling layer 1-2 & 2 & 2 & 64 \\  & MaxPooling layer 2-2 & \(2\times 2\) & \(2\times 2\) & 64 \\ \hline \multirow{2}{*}{6} & Convolution layer 1-3 & 3 & 1 & 96 \\  & Convolution layer 2-3 & \(3\times 3\) & \(1\times 1\) & 96 \\ \hline \multirow{2}{*}{7} & MaxPooling layer 1-3 & 2 & 2 & 96 \\  & MaxPooling layer 2-3 & \(2\times 2\) & \(2\times 2\) & 96 \\ \hline \multirow{2}{*}{8} & Convolution layer 1-4 & 3 & 1 & 128 \\  & Convolution layer 2-4 & \(3\times 3\) & \(1\times 1\) & 128 \\ \hline \multirow{2}{*}{9} & GlobalMaxPooling layer 1-1 & - & - & - \\  & GlobalMaxPooling layer 2-1 & - & - & - \\ \hline \hline \end{tabular}
\end{table}
Table 1: The FCNN parameters.  
Figure 2: The SE method.  
The specific steps of the SE algorithm are as follows:  
1. Divide the original dataset into two parts: training set \(D\), and test set \(T\).
2. Perform the K-fold cross-validation of the base learners; randomly divide the original training set into K equal parts \((D_{1},D_{2},\cdots,D_{k})\), where each base learner uses one of the parts as the K-fold test set and the remaining (\(\text{K}-1\)) parts as the K-fold training set. Each base learner is trained using the K-fold training set, and the K-fold test set is used for classification. The posterior probabilities obtained by each base learner are combined and used as a training set \(\widetilde{D}\) for the meta-learner.
3. Each base learner classifies the original test set \(T\) and uses the posterior probabilities as the test set \(\widetilde{T}\) of the meta-learner.
4. The meta-learner uses the new dataset obtained from the base learners, incusing the training set \(\widetilde{D}\) and test set \(\widetilde{T}\), and performs learning and training, respectively, to output the final classification results.  
The SE method uses the K-fold cross-validation to reduce the risk of model overfitting, while the posterior probabilities of multiple base learners are used for the second-stage training process. This method can overcome the limitations of a single learner; it combines the applicability and advantageous features of various learners and, thus, can improve the accuracy and generalization of classification results.