# Tool Wear Monitoring for Complex Part Milling Based on Deep Learning
## 2 Method
### Deep Learning for Tool Wear Monitoring
#### 2.3.2 Deep Autoencoder  
The pre-selected features are all obtained from cutting force signals. They are highly coupled and superfluous for tool wear prediction. This affects the accuracy and generalization ability of the deep learning model. In this study, the deep autoencoder (DAE) is used to learn the low-dimensional abstract features from the original features, which have a high correlation with the tool wear. The structure of the DAE is illustrated in Figure 5. Deep autoencoder is an unsupervised deep learning network for data dimensional reduction and feature extraction. It has a symmetric structure of multiple layers with the same input and output data. It consists of an encoder and a decoder. The transformation from the input layer to the middle hidden layer is called encoding. This is a dimensional reduction process, which transforms the high-dimensional original data into the low-dimensional space. The transformation from the middle hidden layer to the output layer is called decoding. This is the reconstruction process, which is the inverse of the encoder that reconstructs the encoded vector back to the original input data. In the encoding process, the obtained middle hidden layer reflectsthe essential features of the high-dimensional input data and is the core of the DAE. In this study, a six-layer DAE is developed with three layers for both the encoder and decoder.  
The encoding process can be expressed as  
\[\mathbf{h}=f_{\theta}(\mathbf{x})=s_{f}(\mathbf{W}\mathbf{x}+\mathbf{b}) \tag{9}\]  
The decoding process can be expressed as  
\[\mathbf{\overset{\wedge}{x}}=g_{\theta^{\prime}}(\mathbf{h})=s_{g}\Big{(}\mathbf{W}^{ \prime}\mathbf{h}+\mathbf{b}^{{}^{\prime}}\Big{)} \tag{10}\]  
Figure 4: Architecture of deep learning network for tool wear prediction combining autoencoder and multi-layer perceptron.  
Figure 5: Symmetrical structure of deep autoencoder consisting of three-layer encoder and three-layer decoder.  
where \(\mathbf{x}=[x_{1},x_{2},\cdots,x_{n}]^{T}\) is the input vector, \(\mathbf{h}\) and \(\overset{\wedge}{\mathbf{x}}=[\hat{x}_{1},\hat{x}_{2},\cdots,\hat{x}_{n}]^{T}\) are the encoded and decoded vectors, \(f_{\theta}\) and \(g_{\theta^{\prime}}\) are the encoding and decoding functions, \(\mathbf{W}\) is the weight matrix from the input layer to the hidden layer, \(\mathbf{W}^{{}^{\prime}}\) is the weight matrix from the hidden layer to the input layer, \(\mathbf{b}\) is the bias vector of the hidden layer, \(\mathbf{b}^{{}^{\prime}}\) is the bias vector of the output layer, \(\theta\) is the set of parameters in the encoding function, \(\theta^{\prime}\) is the set of parameters in the decoding function, \(s_{f}\) and \(s_{g}\) are the activation functions of the encoder and decoder, which are both selected as the sigmoid function.  
In the training process, to measure the error between the input \(\mathbf{x}\) and the reconstructed input \(\mathbf{x}^{{}^{\prime}}\), the squared Euclidean distance is used as the loss function for this regression problem, which can be expressed as  
\[Loss\big{(}\mathbf{W},\mathbf{b},\mathbf{W}^{{}^{\prime}},\mathbf{b}^{{}^{\prime}}\big{)}= \sum_{i=1}^{n}\|x_{i}-\hat{x}_{i}\|^{2} \tag{11}\]  
After the DAE has been trained, the encoder (the first three layers) is employed as a feature extractor in front of the deep learning model.