# Clustering Analysis of Wind Turbine Alarm Sequences Based on Domain Knowledge-Fused Word2 vec
## 5 Results and Discussion
### Experiment Settings
#### 5.1.3 Evaluation Metrics  
In order to assess the performance and effectiveness of clustering algorithms, two types of evaluation metrics are commonly used: external evaluation and internal evaluation metrics. The foremost metrics assess the clustering performance by comparing the clustering results to some external, predefined ground truth or known labels. These metrics require a labeled dataset to measure how well the clustering aligns with the true class assignments. As mentioned in the previous section, we have 261 labeled alarm sequences available for analysis. Initially, we perform clustering on these sequences and assess their clustering performance under various parameter settings using external evaluation metrics to determine the optimal parameter combination. The external metrics employed for evaluation are Purity and Adjusted Rand Index (ARI) [32]. Purity measures the extent to which each cluster consists of instances from a single, dominant class. It is quantified as the ratio of correctly classified objects to the total number of objects. \[\text{Purity}=\frac{1}{N}\sum_{c\in\mathbb{C}}\max(j)\big{|}C_{i}\cap D_{j} \big{|}, \tag{11}\]  
where \(N\) is the number of correctly classified objects, \(C\) is the number of clusters, \(D\) is the number of true classes, \(C_{i}\) is the object belonging to cluster \(i\), and \(D_{j}\) is the object belonging to class \(j\). The Purity score ranges from 0 to 1, where 1 indicates perfect clustering, meaning each cluster contains data points belonging to a single class only. Conversely, lower Purity values indicate a less accurate clustering, with more mixed-class clusters. Purity is a straightforward and easy-to-interpret metric but has limitations, especially when dealing with unbalanced datasets or clusters with overlapping class distributions. In such cases, ARI might be more informative. \begin{table}
\begin{tabular}{c c c} \hline \hline
**Labels** & **Fault Events** & **Sample Numbers** \\ \hline
0 & Pitch system communication fault & 8 \\
1 & Pitch system driver fault & 10 \\
2 & Emergency pitching & 62 \\
3 & Other faults of the pitch system & 17 \\
4 & Frequency-converter communication fault & 14 \\
5 & Other faults of the frequency converter & 15 \\
6 & Generator faults & 11 \\
7 & Yaw faults & 7 \\
8 & Cabin faults & 8 \\
9 & System communication faults & 6 \\
10 & Sensor faults & 28 \\
11 & Cooling system faults & 27 \\
12 & Wind vane faults & 27 \\
13 & Other faults & 21 \\ \hline \hline \end{tabular}
\end{table} 
Table 3: Types of fault events and the number of samples. The ARI is a clustering evaluation metric used to assess the quality of clustering results by measuring the similarity between the clustering assignments and the true class labels of the data. It is an improvement over the Rand Index (RI), as it accounts for the expected similarity between random clusterings. The RI is calculated as follows:  
\[\text{RI}=\frac{e+f}{\left( \begin{matrix}m\\ 2\end{matrix} \right)}, \tag{12}\]  
where \(m\) denotes the count of data, \(e\) signifies the quantity of data within the true and predicted clusters, and \(f\) denotes the quantity of data positioned in distinct clusters according to the true and predicted classifications. The ARI is computed by adjusting the RI based on the expected similarity between random clusterings:  
\[\text{ARI}=\frac{\text{RI}-\text{ExpectedRI}}{\text{max}(\text{RI})-\text{ ExpectedRI}}, \tag{13}\]  
where ExpectedRI represents the expected value of RI. The value of ARI ranges from \(-1\) to \(1\), where \(1\) indicates perfect clustering, \(0\) indicates clustering results no better than random, and negative values indicate poor clustering results. Conversely, internal evaluation metrics measure the quality of clustering results based solely on the data and the clustering structure themselves. These metrics do not rely on any external information or ground truth labels.