# Research on the Predictive Algorithm of Wear Degree Based on Adaptive Feature Learning
## 2 Establishment of the Model
### Decoder with Integrated Temporal Attention Mechanism  
The traditional encoder-decoder structure cannot capture long-term temporal relationships in input sequences. As the time series grows, the predictive performance of this structure will deteriorate significantly. To solve this problem, the temporal attention mechanism is introduced to perform weighted calculations on the hidden state information, analyze the long time-series correlation of the wear degree data, decode the analysis results, and finally output the prediction results \(\hat{y}_{T}^{0}\).  
The attention weights \(\beta_{t}^{i}\) of each encoder's hidden state at a given time \(t\) are calculated based on the previous hidden state \(\mathbf{d}_{t-1}\) of the decoder and the storage state \(\mathbf{s}_{t-1}^{\prime}\) of the LSTM unit, as shown in the following Formula:  
\[l_{t}^{i}=\mathbf{v}_{d}^{\top}\tanh(\mathbf{W}_{d}[\mathbf{d}_{t-1};\mathbf{ s}_{t-1}^{\prime}]+\mathbf{U}_{d}\mathbf{h}_{i}),1\leq i\leq T \tag{10}\]  
\[\beta_{t}^{i}=\frac{\exp(l_{t}^{i})}{\sum_{j=1}^{T}\exp(l_{t}^{j})} \tag{11}\]In Formula (10), \([\mathbf{d}_{t-1};\mathbf{s}^{\prime}_{t-1}]\) represents the concatenation of the previous hidden state and unit state, \(\mathbf{v}_{d}\), \(\mathbf{W}_{d}\) and \(\mathbf{U}_{d}\) are the parameter weights and bias terms to be learned. The attention weight \(\beta\) obtained after normalization using the Softmax function represents the importance of the \(i\)-th encoder hidden state at time \(t\) to the predicted target sequence. The weighted sum of the encoder's hidden states \(\mathbf{c}_{t}\) is calculated to serve as the input to the corresponding decoder. The formula is as follows:  
\[\mathbf{c}_{t}=\sum_{i=1}^{T}\beta_{i}^{i}\mathbf{h}_{i} \tag{12}\]  
The decoder's hidden state at time \(t\) can be represented by combining \(\mathbf{c}_{t}\) with the given first \(T-1\) target sequences, as follows:  
\[\widetilde{y}_{t-1}=\widetilde{\mathbf{w}}^{\top}[y_{t-1};\mathbf{c}_{t-1}]+ \widetilde{b} \tag{13}\]  
\[\mathbf{d}_{t}=f_{2}(\mathbf{d}_{t-1},\widetilde{y}_{t-1}) \tag{14}\]  
The update formula for \(\mathbf{d}_{t}\) is similar to the update Formulas (2)-(5) of the encoder hidden states \(\mathbf{h}_{i}\). The updated \(\mathbf{d}_{t}\) can be express as:  
\[\mathbf{d}_{t}=\mathbf{o}^{\prime}_{t}\odot\tanh(\mathbf{s}^{\prime}_{t}) \tag{15}\]  
The mapping \(F\) from input sequence to predicted target sequence value \(\hat{y}_{T}^{D}\) can be represented as:  
\[\hat{y}_{T}^{D}=F(y_{1},y_{2},\dots,y_{T-1},\mathbf{x}_{1},\mathbf{x}_{2}, \dots,\mathbf{x}_{T})=\mathbf{v}_{y}^{\top}(\mathbf{W}_{y}[\mathbf{d}_{T}; \mathbf{c}_{T}]+\mathbf{b}_{w})+b_{v} \tag{16}\]  
\([\mathbf{d}_{T};\mathbf{c}_{T}]\) represents their concatenation, parameter \(\mathbf{W}_{y}\) and \(\mathbf{b}_{w}\) map it to the size of the decoder's hidden state, \(\mathbf{v}\) represents weight values, and \(b_{v}\) represents bias terms. \(\hat{y}_{T}^{D}\) is the predicted wear result of the decoder output.  
By analyzing the importance of different input positions through the temporal attention mechanism and adaptively optimizing the weight configuration, the adverse effects caused by information dilution during the input process are alleviated, and the predictive performance of the model for long time-series data is improved. Although the performance has improved, there is still room for optimization in predicting real-world data sets with large fluctuations.