# Clustering Analysis of Wind Turbine Alarm Sequences Based on Domain Knowledge-Fused Word2 vec
## 4 The Proposed Method
### Vector Representation of Alarms Using DK-Word2 vec
#### 4.2.2 DK-Word2 vec  
Aiming at the issue of Word2 vec neglecting actual abnormal information during training, this study proposes a training approach that fuses alarm category information provided by domain knowledge. The method optimizes the loss function of the skip-gram \begin{table}
\begin{tabular}{c c c} \hline \hline
**ID** & **Criteria** & **Categories** \\ \hline
1 & Alarm types & Information, warning, fault \\ \hline \multirow{2}{*}{2} & \multirow{2}{*}{Sub\_assembles} & Cooling, operational state, pitch, power supply, blades, generator, hub, tower, grid connection, frequency converter, sensor, system communication, main shaft, yaw, cabin, and others. \\ \hline \multirow{2}{*}{3} & \multirow{2}{*}{Failure mechanism} & Temperature failure, voltage failure, current failure, and control failure. \\ \hline
4 & Pitch actuator units & Actuator unit 1, actuator unit 2, and actuator unit 3. \\ \hline \hline \end{tabular}
\end{table} 
Table 2: Alarm categories classified under different criteria. model, taking the provided alarm category information into account when constructing vector representations for individual alarms. The detailed process is as follows. Under a particular classification criterion, let \(\mathbb{M}=\{\mathbb{M}_{1},\ldots\mathbb{M}_{k},\ldots\}\) represent the set of categories and \(\mathbb{M}_{k}\) denote one category within this set, where each category contains multiple alarms. From an intuitive standpoint, to enhance the distinguishability of clustering, our objective is to minimize the differences among vectors within the same category. Simultaneously, we aspire to maximize the differences among vectors from distinct categories. Let two alarms be denoted as \(a_{i}\) and \(a_{j}(i,j=1,2,\ldots,W)\), where \(W\) represents the total number of alarms, and their vector representations are represented as \(\mathbf{a}_{i}\) and \(\mathbf{a}_{j}\), respectively. The similarity between these two alarms can be calculated using the cosine similarity of vectors:  
\[\text{similarity}=\frac{\mathbf{a}_{i}\cdot\mathbf{a}_{j}}{\|\mathbf{a}_{i}\| \big{\|}\mathbf{a}_{j}\|}. \tag{4}\]  
Based on the categories within the set \(\mathbb{M}\), the vector representations of two alarms can be denoted as \(\mathbf{a}_{i}^{m_{p}}\) and \(\mathbf{a}_{j}^{m_{q}}\), where \(m_{p}\) and \(m_{q}\) are the labels of their respective categories. We employ the sum of differences between alarm vectors within the same category to characterize the effectiveness of intra-category classification, denoted as:  
\[\delta=\sum_{\forall\mathbb{M}_{k}\in\mathbb{M}}\sum_{ \begin{subarray}{c} \mathbf{a}^{m_{p}}\in\mathbb{M}_{k}\\ \mathbf{a}^{m_{q}}\in\mathbb{M}_{k}\end{subarray} }\left(1-\frac{\mathbf{a}_{i }^{m_{p}}\cdot\mathbf{a}_{j}^{m_{q}}}{\left\|\mathbf{a}_{i}^{m_{p}}\right\| \big{\|}\mathbf{a}_{j}^{m_{q}}\right\|}\right), \tag{5}\]  
where \(m_{p}\) and \(m_{q}\) belong to the same category \(\mathbb{M}_{k}\). A smaller value of \(\delta\) indicates a better classification performance within the category content. We use the sum of similarities between alarm vectors in different categories to represent the effectiveness of inter-category classification, denoted as  
\[\gamma=\sum_{\forall\mathbb{M}_{k}\in\mathbb{M}}\sum_{ \begin{subarray}{c} \mathbf{a}^{m_{p}}\in\mathbb{M}_{k}\\ \mathbf{a}^{m_{q}}\
otin\mathbb{M}_{k}\end{subarray} }\left(\frac{\mathbf{a}_{ i}^{m_{p}}\cdot\mathbf{a}_{j}^{m_{q}}}{\left\|\mathbf{a}_{i}^{m_{p}} \right\|\mathbf{a}_{j}^{m_{q}}}\right), \tag{6}\]  
where \(m_{p}\) and \(m_{q}\) belong to different categories. A smaller value of \(\gamma\) indicates a better classification performance between different categories.