## 3 Materials and Methods
### Multi-Classification  
For multi-classification, we already obtained the dataset and the feature set. For this section, we obtained the specific type of attack on the set of anomalies. For the sake of description, we consider the normal packet as a particular case of the abnormal packet. We did not use a neural network directly for the classification of the anomaly dataset. Instead, it was deformed and simplified to some extent. On the one hand, the penalty of error detection is too small for the neural network to provide a good training effect. On the other hand, we simplified the multi-classification step as much as possible; the direct deployment of neural networks is unrealistic due to the parameters and complexity of deploying neural networks at a particular scale [28]. Edge devices usually have a limited computational power and storage resources. Neural networks usually require many computational resources to perform training and inference tasks, especially when the models are large and the number of parameters is large. The computational power of edge devices may need to be improved to meet the high requirements of complex neural networks. Parallel computing can accelerate the training and inference process of neural networks by simultaneously utilizing multiple computing devices or processing units, thus improving overall performance and efficiency. We improved the architecture of the multi-classifier by splitting it into 23 binary classifiers, resulting in the attack set. The framework is shown in Figure 2.  
As shown in Figure 2, using neural networks alone for multi-classification means that the packets need to be matched directly for 23 cases, which is demanding regarding the data volume and computing power. We improved the above algorithm by delivering the packets to each of the 23 binary-classification neural networks simultaneously. Each neural network was responsible for determining whether the packet was of one of its corresponding types. We set up a mixer after the 23 neural networks, which aggregated and decided the type of packets. The results of the sub-models were integrated through the classifier layer. Specifically, each sub-model output a two-dimensional vector representing the probabilities of the corresponding sample belonging to two different classes. These output vectors were processed through the classifier layer, which consisted of a linear layer that mapped the input dimension from 23 to 23. The pseudocode of CM-NIDS is as Algorithm 2. The final output vector can be viewed as a prediction for multi-class classification, where each dimension corresponds to a class, and the values indicate the model's confidence or probability for that class. The integration process is not performed directly within the sub-models but rather through the model's overall structure. The outputs of the sub-models are passed as inputs to the classifier layer, which linearly maps these outputs to generate the final prediction. Through the forward propagation process of the entire network, the input features undergo processing with the feature layer, multiple sub-models, and the classifier layer to obtain the predicted class for the input sample. Overall, our model leverages multiple sub-models to learn diverse and specialized feature representations, integrates their outputs through a classifier layer for ensemble benefits, allows flexibility in adapting to different tasks and datasets, increases model depth for enhanced expressive capacity, and provides interpretability through a clear delineation of sub-model functionality. These characteristics contribute to an improved performance, broader representation capabilities, and a better understanding and interpretability of the model, advancing the application of neural network models in scientific research. We obtained specific types of abnormal attacks to facilitate a detailed and reliable reference for other network security systems. Our model can be better adapted to edge networks.