# Research on the Predictive Algorithm of Wear Degree Based on Adaptive Feature Learning
## 2 Establishment of the Model
### Encoder with Integrated Feature Attention Mechanism  
Given a time series input matrix \(\mathbf{X}\) generated from a wear data set, the matrix is defined as \(\mathbf{X}=(\mathbf{x}_{1},\mathbf{x}_{2},\dots,\mathbf{x}_{T})\in\mathbb{R}^{n \times T}\), where each \(\mathbf{x}_{t}\) is a vector that contains \(n\) features, i.e., \(\mathbf{x}_{t}=(\mathbf{x}_{t}^{1},\mathbf{x}_{t}^{2},\dots,\mathbf{x}_{t}^{n })^{\top}\in\mathbb{R}^{n}\). \(T\) represents the length of the sequence matrix window, and \(\mathbb{R}^{n\times T}\) represents the data size of the input sequence at time \(t\). With the first \(T-1\) values of the target sequence \((y_{1},y_{2},\dots,y_{T-1})\) and \((\mathbf{x}_{1},\mathbf{x}_{2},\dots,\mathbf{x}_{T})\) as inputs, this model aims to train and learn the mapping \(F\) from the input sequence to the current value of the target sequence \(\hat{y}_{T}\). \[\hat{y}_{T}=F(y_{1},y_{2},\dots,y_{T-1},\mathbf{x}_{1},\mathbf{x}_{2},\dots, \mathbf{x}_{T}) \tag{1}\]  
The encoder in this article uses LSTM units, and each LSTM unit has a storage unit state representation \(\mathbf{s}_{t}\) at time \(t\). The access to the storage unit is controlled by input gate \(\mathbf{i}_{t}\), forget gate \(\mathbf{f}_{t}\) and output gate \(\mathbf{o}_{t}\). The structure of the encoder is shown in Figure 2.  
The process of updating the hidden state of each encoder unit is represented by the following formula:  
\[\mathbf{f}_{t}=\sigma(\mathbf{W}_{f}[\mathbf{h}_{t-1};\mathbf{x}_{t}]+\mathbf{ b}_{f}) \tag{2}\]  
\[\mathbf{i}_{t}=\sigma(\mathbf{W}_{i}[\mathbf{h}_{t-1};\mathbf{x}_{t}]+\mathbf{ b}_{i}) \tag{3}\]  
Figure 1: Wear prediction model diagram. Figure 2: Schematic diagram of the encoder structure. \[\mathbf{o}_{t}=\sigma(\mathbf{W}_{o}[\mathbf{h}_{t-1};\mathbf{x}_{t}]+\mathbf{b}_{o}) \tag{4}\]  
\[\mathbf{s}_{t}=\mathbf{f}_{t}\odot\mathbf{s}_{t-1}+\mathbf{i}_{t}\odot\tanh( \mathbf{W}_{s}[\mathbf{h}_{t-1};\mathbf{x}_{t}]+\mathbf{b}_{s}) \tag{5}\]  
\[\mathbf{h}_{t}=\mathbf{o}_{t}\odot\tanh(\mathbf{s}_{t}) \tag{6}\]  
Among them, \([\mathbf{h}_{t-1};\mathbf{x}_{t}]\in\mathbb{R}^{m+n}\) (\(m\) represents the size of the hidden state) represents the concatenation of the previous hidden state \(\mathbf{h}_{t-1}\) and the current input \(\mathbf{x}_{t}\). \(\mathbf{W}_{f},\mathbf{W}_{i},\mathbf{W}_{o},\mathbf{W}_{s}\in\mathbb{R}^{m \times(m+n)}\) and \(\mathbf{b}_{f},\mathbf{b}_{i},\mathbf{b}_{o},\mathbf{b}_{s}\in\mathbb{R}^{m}\) are the weight and bias terms that need to be learned. \(\sigma\) refers to the Sigmoid function and \(\odot\) represents the element-wise multiplication at corresponding positions in matrices. The prediction of the wear level in this article involves multiple factors such as torque, vertical force, turning angle, friction coefficient, and temperature, and there are complex correlation relationships between these features. In order to better grasp the inherent connections between the characteristics, this article uses a feature attention mechanism to adaptively select relevant feature sequences. The attention weight \(e_{t}^{k}\) of the local features is obtained by referring to the LSTM unit's previous hidden state \(\mathbf{h}_{t-1}\) and unit state \(\mathbf{s}_{t-1}\). The formula for the constructed attention mechanism is as follows:  
\[e_{t}^{k}=\mathbf{v}_{e}^{\top}\tanh(\mathbf{W}_{e}[\mathbf{h}_{t-1};\mathbf{ s}_{t-1}]+\mathbf{U}_{e}\mathbf{x}^{k}) \tag{7}\]  
Among them, \(\mathbf{x}^{k}=(x_{1}^{k},x_{2}^{k},\dots,x_{T}^{k})^{\top}\in\mathbb{R}^{T}\) represents the \(k\)-th input sequence within the \(T\) step length, \(\mathbf{v}_{e}\in\mathbb{R}^{T},\mathbf{W}_{e}\in\mathbb{R}^{T\times 2m}\) and \(\mathbf{U}_{e}\in\mathbb{R}^{T\times T}\) are the weight and bias items that need to be learned.