## 3 RUL Prediction Method Based on Hierarchical Clustering and Transformer-GRU
### Feature Extraction
The crest factor, calculated as the ratio of the peak value to the RMS, reflects the extremity of peaks within the waveform. The impulse factor, the ratio of the peak value to the mean absolute value, is commonly used to assess the presence of impact components in the signal and is generally smaller than the crest factor. The margin factor, defined as the ratio of the peak value to the square root amplitude, can be used to reflect the wear condition of the bearing. For a given signal segment \(X=\{x_{1},\,x_{2},\,x_{3},\,\ldots\,x_{N}\}\), the specific calculation formulas for the selected time-domain features are presented in Table 1.  
As the bearing begins to degrade, the frequency components, energy magnitude, and dominant frequency band position of the spectral signal will change [35]. Therefore, it is essential to extract frequency-domain features from the vibration signal. Twelve frequency-domain features referenced from [36] are selected and denoted as P17-P28. In addition, to more comprehensively extract the degradation information contained in the vibration signal, features are extracted from the time-frequency domain. The time-domain signals are decomposed using a three-level wavelet packet decomposition with the db5 wavelet, dividing the frequency axis into eight sub-bands. The energy ratio of each \begin{table}
\begin{tabular}{c c c c} \hline \hline
**Meaning** & **Feature and Calculation Formula** & **Meaning** & **Feature and Calculation Formula** \\ \hline Mean & P1 \(=\frac{1}{N}\sum_{i=1}^{N}x_{i}\) & Mean Absolute Value & P9 \(=\frac{1}{N}\sum_{i=1}^{N}\lvert x_{i}\rvert\) \\ Standard Deviation & P2 \(=\sqrt{\frac{1}{N}\sum_{i=1}^{N}\left(x_{i}-\overline{X}\right)^{2}}\) & Root Amplitude Value & P10 \(=\sqrt{\frac{1}{N}\sum_{i=1}^{N}\lvert x_{i}\rvert}\) \\ Mean Square Value & P3 \(=\frac{1}{N}\sum_{i=1}^{N}x_{i}^{2}\) & Skewness & P11 \(=\frac{1}{N}\sum_{i=1}^{N}\left(\frac{x_{i}-P_{1}}{P_{2}}\right)^{3}\) \\ Root Mean Square & P4 \(=\sqrt{\frac{1}{N}\sum_{i=1}^{N}x_{i}^{2}}\) & Kurtosis & P12 \(=\frac{1}{N}\sum_{i=1}^{N}\left(\frac{x_{i}-P_{1}}{P_{2}}\right)^{4}\) \\ Maximum Value & P5 \(=\max(x_{i})\) & Waveform Index & P13 \(=\frac{\text{P4}}{\text{P1}}\) \\ Minimum Value & P6 \(=\min(x_{i})\) & Crest Factor & P14 \(=\frac{\text{P7}}{\text{P4}}\) \\ Peak Value & P7 \(=\max(\lvert x_{i}\rvert)\) & Impulse Factor & P15 \(=\frac{\text{P7}}{\text{P1}}\) \\ Peak-to-Peak Value & P8 \(=\) P5-P6 & Margin Factor & P16 \(=\frac{\text{P7}}{\text{P10}}\) \\ \hline \hline \end{tabular}  
* In the table, \(x_{i}\) denotes the \(i\)-th value of the signal, \(\overline{X}\) represents the mean of signal \(X\), and \(N\) indicates the total number of data points in signal \(X\).  
\end{table} 
Table 1: Calculation formula of time-domain features. sub-band is calculated as the time-frequency domain features, denoted as P29-P36. The detailed calculation [28] is shown in Equation (13). \[P_{j}^{m}=\frac{\sum_{i=1}^{n}\left(x_{j}^{m}(i)\right)^{2}}{\sum_{m=0}^{2j-1} \sum_{i=1}^{n}\left(x_{j}^{m}(i)\right)^{2}} \tag{13}\]  
where \(j\) represents the decomposition level of the wavelet packet, \(m\) is the number of sub-bands obtained from the decomposition, and \(n\) denotes the length of the sub-band signal. \(x_{j}^{m}(i)\) denotes the \(i\)-th decomposition coefficient of the \(m\)-th coefficient vector at the \(j\)-th level of decomposition, and \(P_{j}^{m}\) represents the proportion of energy contained in the \(m\)-th frequency band when the signal is decomposed to the \(j\)-th level.