# An Audio-Based Motor-Fault Diagnosis System with SOM-LSTM
## 3 Methodology
### Som-Istm
Setting the forget gate: The forget gate decides what information to forget from the cell state. It calculates the output, \(f_{t}\), of the forget gate through the current input, \(x_{t}\), and the hidden state, \(h_{t-1}\), at the previous time point, expressed as Equation (4):  
\[f_{t}=\sigma\Big{(}W_{f}\cdot[h_{t-1},x_{t}]+b_{f}\Big{)} \tag{4}\]  
\(W_{f}\) is the weight of the forget gate, \(b_{f}\) is the bias term of the forget gate, and \(\sigma\) is an \(S\)-function, expressed as Equation (5), so that the output value is between 0 and 1, which determines the proportion of forgetting. \[sigmoid(x)=\frac{1}{1+e^{x}} \tag{5}\]  
Step 2. Setting the input gate: The new information of the updated cell state is determined through the vector \(\overset{\sim}{C}_{t}\) with the candidate value range of [\(-1\), \(+1\)] created with a \(tanh\) layer, expressed as Equation (6):  
\[\overset{\sim}{C}_{t}=tanh(W_{C}\cdot[h_{t-1},x_{t}]+b_{C}) \tag{6}\]  
\(W_{c}\) is the weight of the input gate; \(b_{c}\) is the bias term of the input gate. Step 3. Cell-state update: The cell state, \(C_{t}\), is combined with the information of the forget gate and the input gate into the updated state, expressed as Equation (7):  
\[C_{t}=f_{t}\times C_{t-1}+i_{t}\times\overset{\sim}{C}_{t} \tag{7}\]  
\(f_{t}\) determines how much of the previous cell state to retain, while \(i_{t}\times\overset{\sim}{C}_{t}\) adds new candidate values. Step 4. Setting the output gate: The output gate will determine which data based on the cell state will be exported, expressed as Equation (8). This output value, \(h_{t}\), will be used as the output at the current time point and as the hidden state at the next time point, expressed as Equation (9):  
\[o_{t}=\sigma(W_{o}\cdot[h_{t-1},x_{t}]+b_{o}) \tag{8}\]  
\[h_{t}=o_{t}\times tanh(C_{t}) \tag{9}\]  
\(o_{t}\) is the activation function of the output gate, which determines which parts to export. The final output, \(h_{t}\), is the product of this activation value and the \(tanh\) value of the cell state, and it ensures that the output value is \(-1\) to \(1\). The SOM obtains feature-window signals of the multi-frequency domain from FFT for data-dimension reduction and feature mapping, and it extracts the operating characteristics of the motor with more frequencies and different dimensions. The LSTM learning is used to obtain multi-dimensional feature data from multi-frequency SOM as LSTM input data. Figure 3 shows the network structure of SOM-LSTM. The LSTM input layer passes through the feature maps of the SOM frequencies 128, 256, 512, and 1024 Hz. The LSTM output is a 1-dimensional number including the normal state, out-of-phase fault, unbalance fault, and misalignment fault; the parameter settings are the cell state (\(C_{t}\)) and memory capacity (\(f_{t}\)). The input data for the system consists of motor sound signals, which are captured using a high-quality microphone placed near the motor during its operation. The microphone records the sound at a sampling rate of 21,000 samples per second to ensure that a broad range of frequencies is captured, allowing for an accurate analysis of the motor's operational status. The SOM-LSTM involves several steps:  
1. The preparation of input signals:  
The recorded sound signals are first digitized, resulting in discrete time-domain signals. These signals represent the amplitude of the sound wave at each sampled point in time. This step effectively decomposes the sound signal into its constituent frequencies, providing a detailed view of the motor's acoustic profile. For example, if the 128 Hz data of FFT is input, the input terminal is 128 pieces of data at one time. Similarly, if the 1024 Hz data of FFT is input, the input terminal is 1024 pieces of data at one time. This paper passes the FFT data through the 2-dimensional topology structure of SOM \(m\) = [3, 4, 5], so that only a minimum of 9 (3 \(\times\) 3) strokes and a maximum of 25 (5 \(\times\) 5) strokes are needed to input data. 2.