## 3 LSTM and FSST-Based Fault Diagnosis Algorithm
### Data Preprocessing  
For time-series data exhibiting significant or irregular fluctuations over time, if these data are not initially preprocessed, training machine learning algorithms on such data can lead to various issues, including inadequate handling of missing values, the influence of outliers, differences in data scales, overlooking seasonality and trends, and neglect of temporal structures. Filtering signals can help remove unnecessary noise by selectively passing or blocking frequency bands, enabling neural networks to better discern the features of actual signals. Moreover, filtered signals often exhibit more normalized characteristics, contributing to stable neural network operation and reducing input data size imbalances. Utilizing filtered data for neural network training can enhance model performance and reduce the noise and volatility associated with signal processing. However, severely distorting actual signals can lead to inaccurate judgments. Rescaling time-series data for normalization is the process of transforming data to a new range, allowing the data distribution to be adjusted. One commonly used method involves scaling the data to the desired range using the minimum and maximum values of the input data. This process can be expressed mathematically as shown in Equation (1). In this expression, \(X_{\text{rescaled}}\) represents the rescaled data, and \(a\) and \(b\) denote the lower and upper bounds of the new range, respectively. Moreover, \(X\) represents the original data, \(\max(X)\) represents the maximum value of the data, and \(\min(X)\) represents the minimum value. Rescaling adjusts the data to a consistent range, which is particularly useful for machine learning models, as it aligns the ranges of various input variables, thereby improving the model's learning and performance. By adjusting the data distribution, rescaling reduces the model's sensitivity to outliers or anomalies, thus enhancing the model's stability and generalization abilities. Rescaling preserves the characteristics of the raw data, as it only involves adjusting the range of the data without altering its distribution. This is one of the reasons why rescaling is widely used in data preprocessing. In time-series data, feature points exist in different frequency bands. We designed a bandpass filter for data with features to enable selective frequency band passage, high-frequency noise removal, smooth feature extraction, enhanced learning stability, and improved signal-to-noise ratio (SNR). This filter prevents the neural network from learning unnecessary features, thereby enhancing neural network model training. After the time-series data have been filtered, extracting time-frequency features provides the neural network with the input data instead of the original data. This allows the neural network to simultaneously learn time and frequency information. Figure 2: Semantic segmentation of time-series data. The proposed infinite impulse response (IIR) filter uses previous samples of the input and output to compute the output. It was designed using the _'ellip'_ design method, which provides highly damped passbands and the steepest cutoff. The given parameters adjust the frequency response of the filter, a key design feature for digital signal processing. The equation of the designed filter is shown in Equation (2). In this expression, \(H(z)\) represents the transfer function of the filter, which describes the relationship between the input and output using the \(Z\)-transform method. \(K\) is the scaling constant of the filter, which adjusts the overall magnitude of the transfer function. \(z_{n}\) represents the zeros (roots) at which the output is zero for a given input, and \(p_{n}\) represents the poles, where the output diverges to infinity for a given input. In time-series data, the relationship between time and frequency reflects periodic changes in the data over time. Specifically, frequency indicates the rate of periodic changes in the data at a specific time.