## 5 Simulation Results and Discussions
### Simulation Setup and Evaluation Metrics
#### 5.1.2 Evaluation Metrics  
The evaluation metrics of machine learning methods vary in different research fields. This paper studied the unsupervised network traffic clustering problem, so the evaluation metrics used were also based on the clustering model. The cluster validity evaluation metrics used in this paper were composed of the internal validity metric silhouette coefficient and the external validity evaluation metrics normalized mutual information (NMI), adjusted Rand index (ARI), clustering accuracy (AC), and v-measure, respectively. When evaluating the classification model, the most common metric is the classification accuracy. Unsupervised learning's training process does not involve sample labels, so the accuracy calculation method is different from that of supervised learning. Assuming there are \(N\) samples, the label produced by the \(i\)th sample cluster is \(p_{i}\), and the true label is \(y_{i}\), the formula for calculating the accuracy is:  
\[AC=\frac{1}{N}\sum_{i=1}^{N}\delta(y_{i},\text{map}(p_{i})), \tag{8}\]  
where \(\text{map}(\cdot)\) represents the redistribution of clustering labels, which is generally achieved by the Hungarian algorithm [33]. \(\delta(\cdot)\) stands for indicating function  
\[\delta(x,y)=\begin{cases}1&\text{if }x=y\\ 0&\text{otherwise}.\end{cases} \tag{9}\]  
NMI is often used to measure the degree of agreement between two clustering \(\pi_{K}\) and \(\pi_{L}\) results, and it can be expressed as  
\[NMI(\pi_{K},\pi_{L})=\frac{\sum_{k=1}^{K}\sum_{l=1}^{L}n_{l}^{k}\log(\frac{nn_{ l}^{k}}{n^{k}n^{l}})}{\sqrt{(\sum_{k=1}^{K}n^{k}\log(\frac{n^{k}}{n}))(\sum_{l=1} ^{L}n^{l}\log(\frac{n^{l}}{n}))}}, \tag{10}\]  
where \(n^{k}\) is the \(k\)th cluster generated by the cluster, and \(n^{l}\) is the number of data samples from the \(l\)th cluster in the real cluster. \(n_{k}^{l}\) is the number of data samples shared by the \(k\)th cluster result and the \(l\)th real cluster. ARI is a real value that reflects the degree of overlap between the cluster and the actual cluster. The larger the value, the better the clustering effect. Its mathematical expression is given by  
\[ARI=\frac{RI-E(RI)}{\text{max}(RI)-E(RI)}, \tag{11}\]  
\[RI=\frac{a+d}{a+b+c+d}, \tag{12}\]  
where \(a\) denotes the same class of samples clustered in the same cluster, \(b\) denotes different classes of samples clustered in the same cluster, \(c\) denotes the same class of samples clustered in different clusters, and \(d\) denotes different classes of samples clustered in different clusters. Homogeneity refers to cluster classes with the same class of samples within a cluster, and completeness refers to samples of the same class being assigned to the same cluster class. V-measure is the harmonic mean of homogeneity and completeness used to express the proximity of the two categories. Its mathematical expression is given by  
\[v= \frac{2\times h\times c}{h+c} \tag{13}\] \[= \frac{2\times\left(1-\frac{H(\text{C}|K)}{H(\text{C})}\right) \times\left(1-\frac{H(\text{K}|\text{C})}{H(\text{K})}\right)}{\left(1-\frac {H(\text{C}|\text{K})}{H(\text{C})}+\left(1-\frac{H(\text{K}|\text{C})}{H( \text{K})}\right)},\]where \(C\) and \(K\) represent clusters and real classes, respectively, \(H(\cdot|\cdot)\) represents conditional entropy. As an internal evaluation metrics of clustering, silhouette coefficient combines cohesion and separation to evaluate the clustering effect. Its definition formula is as follows:  
\[s_{i}=\frac{b_{i}-a_{i}}{\max(a_{i},b_{i})}, \tag{14}\]  
where \(a_{i}\) represents the average distance between sample \(x_{i}\) and other samples in the same class, and \(b_{i}\) represents the minimum of the average distance between sample \(x_{i}\) and other cluster samples. The average value of \(s_{i}\) for all samples is the clustered silhouette coefficient, that is:  
\[SC=\frac{1}{N}\sum_{i=1}^{N}s_{i}. \tag{15}\]