# TransECA-Net: A Transformer-Based Model for Encrypted Traffic Classification
## 4 Experimental Result
### Basic Experiment
The following data augmentation strategies were implemented: minor rotations or horizontal flips simulated variations in packet sequencing or protocol implementations; scaling operations adjusted \begin{table}
\begin{tabular}{c c} \hline \hline \multicolumn{3}{c}{**Configuration and Environment**} \\ \hline CPU & AMD Ryzen 5 5600H with Radeon Graphics 3.30 GHz \\ RAM & 16.0 GB \\ GPU & NVIDIA GeForce RTX3050 Ti \\ Operating system & Windows 11 64-bit \\ Integrated development environment & PyCharm \\ Deep learning framework & PyTorch \\ \hline \hline \end{tabular}
\end{table} 
Table 3: Computer configuration and running environment. matrix dimensions with zero-padding or truncation; cropping techniques emulated traffic length variations; and random matrix truncation mimicked incomplete traffic capture scenarios. These approaches partially addressed dataset imbalance through enhanced data diversity. Hyperparameter selection is a central component of deep learning model design, requiring decisions to be grounded in a balanced integration of empirical heuristics, task-specific characteristics, hardware limitations, and experimental validation. The selection of hyperparameters in this study was based on a combination of literature review and theoretical analysis. By referencing multi-domain research findings, we ensured that the chosen parameters exhibited both theoretical validity and practical feasibility. 1. Learning rate configuration: As demonstrated in [31], the learning rate plays a decisive role in model convergence speed and performance. An initial learning rate of 0.001 was adopted, a value validated by multiple studies as an ideal starting point for deep learning tasks. Additionally, an adaptive learning rate scheduling strategy was implemented to enhance training efficiency through dynamic adjustment mechanisms. 2. Batch configuration: Considering GPU parallel-processing capabilities and training stability, the batch size was set to 128. As discussed in [32], this configuration achieves a balance between training speed and model performance while effectively mitigating overfitting risks. 3. Training epochs: By monitoring training loss and validation accuracy, the final training epoch count was determined to be 40. Research [33] highlights that the excessive prolongation of training epochs increases overfitting risks; thus, the optimal upper limit was established based on convergence curve analysis. 4. Dropout mechanism: Following the sensitivity analysis of network layers in [34], a layered dropout strategy was implemented: 0.5 for fully connected layers and 0.3 for the output layer. This approach employs differentiated regularization to suppress overfitting while enhancing model generalization capabilities. To evaluate the performance of the model's training results and facilitate comparison with other encrypted network traffic classification methods, this paper uses three metrics--accuracy, precision, and recall--to assess the model's performance. \[Accuracy=\frac{TP+TN}{TP+FP+TN+FN}\]  
\[\text{Precision}=\frac{TP}{TP+FP}\]  
\[Recall=\frac{TP}{TP+FN}\]  
In this context, _TP_ (true positive) represents the number of instances correctly classified as the current network category. _TN_ (true negative) denotes the number of instances accurately classified as not belonging to the current network category. _FP_ (false positive) refers to the number of other network categories mistakenly classified as the current network category, while _FN_ (false negative) indicates the number of instances from the current network category that were incorrectly identified as belonging to other network traffic categories. The experimental results are shown in Figure 3. The left graph displays the training loss value for each epoch, with the _x_-axis representing the number of epochs and the _y_-axis representing the loss value. As shown in the figure, the loss value stabilizes around 0.035 by the 10 th epoch.