# High-Accuracy Entanglement Detection via a Convolutional Neural Network with Noise Resistance
## 3 Results
### The Generalization of Our Classification Model  
The resistance of this classification model is related to the generalization of the CNN to a certain extent, which generally refers to the situation in which the training dataset differs from the testing dataset. Generalization is a fundamental metric that assesses a model's capability to learn general patterns from training data and successfully apply them to new,  
Figure 4: Incomplete measurement results with four types of noise models, where \(\varepsilon\) represents the error rate. The error rate increases from 0 to 0.1, with the accuracy decreasing by about 5% under the four types of noise.  
Figure 3: Complete measurement results with four types of noise models, where \(\varepsilon\) represents the error rate, increasing from 0 to 0.2. Except for Pauli noise, the decrease in accuracy under the other noise models is less than 2%.  
unseen data. In the context of CNNs, the max pooling layer serves as a vital component, playing a pivotal role in enhancing the model's generalization. By adopting the strategy of selecting the maximum value within a local region as the output, max pooling effectively reduces the dimensionality of feature maps, decreases the computational complexity of the model, and simultaneously strengthens its robustness against minor variations in input data. This local invariance enables the model to enhance its generalization.  
In the case of the aforementioned results, we employ a randomized sampling approach to procure our datasets, ensuring that there is a minimal chance of direct overlap between the training dataset and testing dataset. This strategy inherently promotes a scenario where the model is tested on data that are genuinely novel and unseen during the training process. Consequently, the foundation for the model's generalization is firmly established and validated, as it demonstrates its ability to adapt and apply learned patterns to dissimilar data instances, thereby reinforcing its capacity to generalize effectively.  
Here, we proceed to validate the model's generalization capability through testing. We still use the network above trained with random states \(\rho=p|\psi\rangle\langle\psi|+\frac{1-p}{4}\mathbf{I}\); here, \(|\psi\rangle=\frac{\sqrt{2}}{2}(|01\rangle-|10\rangle)\). We change to obtain the testing set from \(|\psi\rangle=\frac{\sqrt{2}}{2}(|01\rangle+|10\rangle)\), \(\frac{\sqrt{2}}{2}(|00\rangle-|11\rangle)\), or \(\frac{\sqrt{2}}{2}(|00\rangle+|11\rangle)\). The comparison results are shown in Figure 5. When changing within a certain range, the classification model can still achieve good performance.  
For states \(|\psi\rangle=\frac{\sqrt{2}}{2}(|01\rangle+|10\rangle)\), the accuracy is almost the same as the testing dataset \(|\psi\rangle=\frac{\sqrt{2}}{2}(|01\rangle-|10\rangle)\) similar to the training dataset with the measurements repeated 1000 times, and decreases from 99.30% to 98.59% in \(10,000\) repeated measurements. Although the accuracy decreases even further when the testing dataset is expanded to \(|\psi\rangle=\frac{\sqrt{2}}{2}(|00\rangle\pm|11\rangle)\), the accuracies exceed 96% and 97% in repeated measurements of 1000 and 10,000, respectively, indicating that our model's generalization is relatively reliable.  
Figure 5: Detection results for other ranges of quantum states. The testing dataset is expanded to different ranges of state \(|\psi\rangle\).