# Towards Machine Learning for Error Compensation in Additive Manufacturing
## 5 Deep Learning for Error Compensation in Additive Manufacturing
### Long Short-Term Memory for Layer Manufacturing Analytics  
A data-driven predictive model is proposed by [PERSON] et al., taking the printing process into account in a deep learning network structure, using Fused Deposition Modeling (FDM) as a demonstrative case study [113]. Temperature and vibration data are measured to reveal the layer-wise thermal and mechanical activities as well as the process variations, and the inter-relationship among different printing layers is characterized by a Long Short-term Memory (LSTM) network. Process parameters and material property data combined with data collected from sensors are fused in order to estimate the tensile strength of manufactured parts. A modified Layer-wise Relevance Propagation (LRP) is applied to calculate the effect of each process parameters on the prediction result.  
In a previous work adapting Design of Experiment (DoE) approach [126], additional machine setting played a big role in the surface roughness where the slice height and width played major roles whereas factors like temperature was insignificant. In another study [127], consideration of material properties and machine settings taking into account factors like tool path and layer thickness on warp deformation is scrutinised. However, these methods are highly dependent on quantitative correlations to support the proposition of thinner printing layers alongside the preferred setup for FDM manufacturing.  
In order to improve part tensile strength prediction performance in FDM, a machine learning method has been developed based on an LSTM network and in-process sensing data. The main goal is to better understand the effect of sequential layer-by-layer printing process which is the main trait of FDM. Firstly, a set of sensors including IR sensor, a thermocouple and an accelerometer capture the layer-wise activities. The sensing data is taken as input to the individual LSTM cells that reflect the individual printing layers. The inter-cell communication through the LSTM forward path is used to model the layer-wise thermal history. The processed sensing data from each LSTM cell, representing the contribution from each of the printing layers to the part property, are then combined with the process parameters and material property to predict the tensile strength of manufactured parts hand in hand. Additionally, Layer-wise Relevance Propagation (LRP) algorithm has been modified and adapted in analysing the extent of process parameters' impact in tensile strength prediction.  
Experimental results show that the LSTM-based predictive model outperforms several machine learning techniques, such as Support Vector Regression and Random Forest. In process sensing, it shows that significant improvement was made in part tensile strength prediction. Specifically, it reduces the prediction RMSE by 44% and improves the prediction of variation by 22.6% reflected by the R2 value over the model that only uses the process parameters and material property as network input. From the relevance analysis, it is proven that three process parameters namely extruder temperature, printing speed and layer height, massively contribute to the tensile strength prediction in the model. The proposed LSTM model managed to outperform the RF and SVR models for part tensile strength prediction, with improvement of 9.8% and 24.3%, respectively. This further approves the efficacy of the sequential layer-by-layer modelling of the FDM process via the LSTM network.