# Research on Side-Channel Analysis Based on Deep Learning with Different Sample Data
## 5 Experiment and Model Evaluation  
### Experiment A: Small Sample Data Experiment  
Under the small data set sample, the experiment uses 1500 random key data sets and randomly divides 1200 training sets and 300 test sets, accounting for 4:1, respectively. \begin{table}
\begin{tabular}{c c c c c} \hline \hline
**Model** & **Optimizer** & **Learning\_Rate** & **Mini\_Batch** & **Epochs** \\ \hline MLP & Adam & 0.0005 & 128 & 400 \\ CNN & Adam & 0.0005 & 128 & 400 \\ RNN & Adam & 0.0005 & 128 & 400 \\ LSTM & Adam & 0.0005 & 128 & 400 \\ \hline \hline \end{tabular}
\end{table} 
Table 1: Corresponding hyperparameter settings. Figure 10: Four model structures. From the experimental performance of each model on the demo board, it can be seen that in the training of the first 50 epochs, with the increase in the number of iterations, the RNN and MLP models converge rapidly. The accuracy rose to 0.0373 and 0.0187, respectively, and the loss dropped to 4.2227 and 4.7532, respectively. During this period, the training accuracy and loss value curves of the CNN and LSTM models hardly fluctuated. At the 50 th epoch, the accuracy of both on the training set was 0.0027, and the loss values were 5.6303 and 5.6518, respectively. After the 100 th epoch, the training accuracy and loss values of the CNN and LSTM models did not change significantly. For example, at the 150 th epoch, the training accuracies of the RNN, CNN, MLP, and LSTM models reached 0.0907, 0.0480, 0.0427, and 0.0347, respectively, and the model loss values were 3.8305, 4.6636, 4.2096, and 4.2431, respectively. With the increase in the number of iterations, the training accuracy and loss value curves of each model gradually converge smoothly and become stable. When the training reaches the 400 th epoch, each model achieves the optimal effect. Between the 350 th and 400 th epochs, the average training accuracies of the RNN, CNN, MLP, and LSTM are 0.2471, 0.1438, 0.1399, and 0.0676, respectively, the training loss values are 2.5843, 3.4043, 3.0573, and 3.6028, the test accuracies are 0.1300, 0.0940, 0.1180, 0.0600, and the test loss values are 3.4500, 3.6542, 3.1467, and 3.8582, respectively. There is no overfitting phenomenon in each model. On the whole, the RNN model has the highest training accuracy and the smallest loss value, but the volatility is too large. The accuracy of the MLP model is comparable to the CNN model, but the MLP model has a slower convergence speed and the CNN model is more stable. The LSTM model has the least volatility and is smooth and stable, but the accuracy is too low. Figure 13 shows the training time of each model when the epoch is 400. The training time of MLP is the shortest, which is the same as that of the CNN model, saving 34% and 81% compared to the RNN and LSTM models, respectively. It can be seen from Figure 14 that with the increase in the number of power traces, the rank value of each model gradually decreases to be flat, and the RNN model has the most obvious change. The rank values of the final MLP, CNN, RNN, and LSTM models are 3, 2, 3, and 4, respectively. The CNN model has the smallest rank value, and only two traces are needed to recover the correct key bytes. The specific parameters and experimental results of each model in Experiment A are shown in Table 2 below. It can be seen from the experimental performance of each model on the demo board that in the training of the first 50 epochs, with the increase in the number of iterations, the four models of CNN, RNN, LSTM, and MLP converge rapidly. At the 50 th epoch, the accuracy of the model on the training set rose to 0.4637, 0.2922, 0.1879, and 0.1772, and the loss dropped to 0.5292, 0.4116, 0.3071, and 0.2656, respectively. After the 50 th epoch, the CNN model converged at a slow speed. After the 300 th epoch, with the increase in the number of iterations, the training accuracy and loss value curves of each model gradually converged smoothly and tended to be stable. At 400 epochs, each model achieves the optimal effect.