# An Audio-Based Motor-Fault Diagnosis System with SOM-LSTM
## 3 Methodology
### Som-Istm  
In the SOM neural network, each neuron is located on a node of the map and is responsible for responding to a specific type of input pattern. Through the learning process, the neurons self-organize to reflect the topology of the input data so that similar data points are close to each other on the map and dissimilar data points are far apart. The steps of the SOM algorithm are as follows [30]. Step 1. Map unit initialization: The weight, \(W_{i}\), of each neuron \(i\) is generated randomly. Step 2. Look for each input sample, \(X\), of the best matching unit. The SOM looks for the best matching unit by calculating the similarity (or distance) between \(X\) and the weight, \(W_{i}\), of all neurons. The similarity measure is calculated as per Equation (1):  
\[d(X,W_{i})=\sqrt{\sum_{j=1}^{m}\bigl{(}x_{j}-w_{ij}\bigr{)}^{2}} \tag{1}\]  
\(m\) is the dimension of the vector. \(d(X,W_{i})\) is the distance between the best matching unit (BMU) of neurons and the input sample \(X\). Step 3. Update neighborhood weights: Move the BMU and the neuron weights to their neighborhood closer to the input sample \(X\) in order to perform learning. The adjustment of the weights is expressed as Equation (2):  
\[W_{i}(t+1)=W_{i}(t)+\theta(i,BMU,t)\times\alpha(t)\times[X-W_{i}(t)] \tag{2}\]  
\(W_{i}(t+1)\) is the weight of neuron \(i\) at time \((t+1)\). \(\theta(i,BMU,t)\) is the neighborhood function that will determine how much the neuron \(i\) is influenced by its distance from the BMU. The neighborhood function usually decreases as the distance increases, and it decreases with time. \(\alpha(t)\) is the learning rate, which decreases with time to ensure that the learning process is stabilized gradually. Step 4. Reduce the learning rate: The neighborhood function \(\theta(i,BMU,t)\) is usually a distance- and time-varying function, ensuring that the network has a greater influence in the early stages of learning. As time goes by, the affected neighborhood will gradually shrink, and the learning process is refined gradually. The neighborhood function used in this paper is a Gaussian function, expressed as Equation (3):  
\[\theta(i,BMU,t)=\exp(-\frac{d^{2}(i,BMU)}{2\sigma^{2}(t)}) \tag{3}\]  
\(d(i,BMU)\) is the distance between the neuron \(i\) and the BMU on the network map. This distance usually refers to the grid distance on the network map, e.g., the Euclidean distance. \(\sigma(t)\) is the neighborhood width that decreases with time, controlling the shape of the neighborhood function. In the early stage of learning, \(\sigma(t)\) is relatively large, allowing more neurons to be affected by the BMU; as learning progresses, \(\sigma(t)\) decreases gradually so that the learning process further focuses on the immediate neighborhood of the BMU. Step 5. Repeat iteration: Repeat Step 2 and Step 4 until the termination condition. The termination condition in this paper is 3000 iterations. The LSTM is a special recurrent neural network for processing and predicting the time series events in sequence data. Each unit structure contains the following: (1) a forget gate, (2) an input gate, (3) an output gate, and (4) a cell state. The LSTM calculation process allows the cell to decide what information to save from the input data, what outdated information to forget, and when to transfer information from the cell state to the output. LSTM has some unique advantages compared to GRU [31] and convolutional neural networks (CNNs) [32]. LSTM has a more complex structure, which makes it better at memorizing long-sequence data and retaining information. LSTM can effectively handle long-term dependency problems, while GRU is relatively simplified and may be lesseffective in dealing with long-sequence dependencies. CNN is good at processing images and local features, but its performance with sequence data is usually not as good as that of LSTM. Therefore, LSTM will have more advantages than GRU and CNNs in model construction that requires memorizing long-term information. The main calculation steps are as follows [33; 34]:  
Step 1.