## 2 Materials and Methods
### Implementation of Data Recovery  
In this paper, the LSTM neural network was used as the data prediction model, and its structure is shown in Figure 3.  
Figure 3: The structure of the LSTM. Figure 2: The sensor fault localization decision tree. LSTMs use gates to control the input and output of data. A gate is a fully connected layer whose input is a vector and its output is a real vector between 0 and 1. Assuming \(\mathbf{W}\) is the weight vector of the gate and \(b\) is the bias term, then the gate can be expressed as:  
\[\text{g}(x)=\sigma(\mathbf{W}x+b) \tag{7}\]  
The use of the gate is to multiply the output vector of the gate by the vector, so we need to control it element by element because the output of the gate is a real vector between 0 and 1. When the gate output is 0, any vector multiplied by it will result in a 0 vector, which is equivalent to nothing passing through. When the output is 1, any vector multiplied by it will not change anything, which is equivalent to passing anything. Because the range of \(\sigma\) (sigmoid function) is (0,1), so the state of the door is half-open and half-closed. The LSTM uses two gates to control the content of the cell state \(c\). One is the forget gate, which determines how much of the cell state \(c_{t-1}\) at the previous moment is retained in the current moment \(c_{t}\). The other is the input gate, which determines how much of the network's input \(x_{t}\) is saved to the cell state \(c_{t}\) at the current moment. The LSTM uses an output gate to control how much of the cell state is output to the current output value \(h_{t}\) of the LSTM. The detailed formula is as follows:  
\[f_{t}=\sigma(\mathbf{W}_{f}\cdot[h_{t-1},x_{t}]+b_{f}) \tag{8}\]  
\[i_{t}=\sigma(\mathbf{W}_{i}\cdot[h_{t-1},x_{t}]+b_{i}) \tag{9}\]  
where \(f_{t}\) is the forget gate; \(i_{t}\) is the input gate; \(\mathbf{W}_{f}\) is the weight matrix of the forget gate; \(\mathbf{W}_{i}\) is the weight matrix of the input gate; \(\mathbf{h}_{t-1}\) is the hidden state at time \(t-1\); \(x_{t}\) is the input vector at time \(t\); \(b_{f}\) is the bias term of the forget gate; \(b_{i}\) is the bias term of the input gate. Multiply the last unit state \(c_{t-1}\) by the forget gate \(f_{t}\) element by element, then multiply the current input unit state \(\widetilde{c}_{t}\) by the input gate \(i_{t}\) element by element, and then add the two products to obtain the current unit state \(\widetilde{c}_{t}\). The unit state used to describe the current input is calculated from the previous output and the current input. The detailed formula is as follows:  
\[\widetilde{c}_{t}=\text{tanh}(\mathbf{W}_{c}\cdot[h_{t-1},x_{t}]+b_{c}) \tag{10}\]  
\[c_{t}=f_{t}\circ c_{t-1}+i_{t}\circ\widetilde{c}_{t} \tag{11}\]  
where tanh is the activation function; \(\mathbf{W}_{c}\) is the weight matrix of the current input cell state; \(b_{c}\) is the bias term of the memory update. The output gate controls the effect of long-term memory on the current output. The final output of the LSTM is determined by the output gate and the unit state:  
\[o_{t}=\sigma(\mathbf{W}_{o}\cdot[h_{t-1},x_{t}]+b_{o}) \tag{12}\]  
\[c_{t}=f_{t}\circ c_{t-1}+i_{t}\circ\widetilde{c}_{t} \tag{13}\]  
where \(o_{t}\) is the output gate; \(\mathbf{W}_{o}\) is the weight matrix of the output gate; \(h_{t}\) is the current hidden state, which is the final output of this unit; \(b_{o}\) is the bias term of the output gate. At the same time, to make the model state the best, it is necessary to optimize the hyperparameters of the LSTM network to make the training model meet the requirements. K-fold cross-validation (CV) is used to calculate the error by dividing the sample into K parts, using K-1 parts as the training set each time, and the remaining part as the validation set. This process is repeated K times. Finally, the average of the K errors is used as the CV estimate of the outer sample error [23]. Grid search optimization is an exhaustive method that enumerates or separates the hyperparameters that need to be optimized.