# Hard Disk Failure Prediction Based on Blending Ensemble Learning
## 3 Materials and Methods
### Lstm  
LSTM (long short-term memory) is a variant of RNN (recurrent neural network) created after solving the problem of gradient explosion and gradient disappearance. LSTM was first proposed in 1997 [21] and was not widely used and further improved until the 21 st century, when machine learning developed rapidly. Although many advanced neural networks have been proposed in the last decade, such as transformer and its many variations, LSTM is still favored by many people because of its excellent learning ability and relatively less complex structure. Thus far, LSTM is still the primary choice for processing time series data. Compared with an RNN, LSTM introduces the structure of many gated units, such as forget gates, input gates, and output gates, to process time series data [22; 23]. The structure of an LSTM unit is shown in Figure 3. Different from RNN, which only has one transfer state per cycle, LSTM adds the concept of cell state, which can store useful information of previous training data for a long time, while the hidden state pays more attention to recent information. Therefore, each LSTM cell has three inputs, including data at the current time point, cell status, and hidden status at the previous time point, and two outputs, namely cell status and hidden status at the current time point. It is precisely because of these characteristic gated units that LSTM is able to process data with a long time span, screen out useful information, and discard useless information so as to occupy a small amount of resources and process a large amount of data. The inputs in Figure 3 are the same; that is, they represent the combination of the hidden state of the last time point, the input value of this time point (for example, if the data  
Figure 3: The structure of an LSTM cell. Figure 2: A Simple BP Neural Network Framework. is in matrix form, it is spliced), and the cell state at the last time point. The one on the far left, called the forget gate, is designed to select information to be forgotten or information that is not very useful for training. Its calculation equation is as follows:  
\[f_{t}=\sigma(W_{f}\cdot[h_{t-1},x_{t}]+b_{f}) \tag{8}\]  
where \(\sigma\) is a sigmoid activation function, which maps the value to the range of (0, 1). \(W_{f}\) and \(b_{f}\) set the weight and bias for the forget gate, respectively. To the left of the forget gate is the input gate. Opposite to the forget gate, the role of this gated unit is to calculate the information to be retained. The calculation equation is as follows:  
\[i_{t}=\sigma(W_{i}\cdot[h_{t-1},x_{t}]+b_{i}) \tag{9}\]  
\[C_{t}^{{}^{\prime}}=tanh(W_{C}\cdot[h_{t-1},x_{t}]+b_{C}) \tag{10}\]  
where it can control which information is retained, while \(C_{t}^{{}^{\prime}}\) use a tanh activation function to calculate the input information at this time point. After the calculation of the above three equations, the cell state can be updated. The calculation equation is as follows:  
\[C_{t}=f_{t}*C_{t-1}+i_{t}*C_{t}^{{}^{\prime}} \tag{11}\]  
The meaning of this equation is that the cell status update of this time point is divided into two steps. The first step is to multiply (pointwise multiplication) the result obtained by the forget gate with the cell status of the previous time point to filter out the previous useless information. The second step is to multiply the two output results of the input gate to obtain the information that should be valued at this time point. The results of these two steps are then added together to achieve the goal of forgetting the old useless information and adding new information. The updated cell state is the first output value of LSTM, and the second output value is the hidden state ht of this time point. The calculation equation also includes two parts:  
\[o_{t}=\sigma(W_{o}\cdot[h_{t-1},x_{t}]+b_{o}) \tag{12}\]  
\[h_{t}=o_{t}*tanh(C_{t}) \tag{13}\]  
In this case, \(h_{t}\) is the second output of the cell, containing the useful information of the previous time point after filtering and the information of the local point.