# Towards Machine Learning for Error Compensation in Additive Manufacturing
## 3 Data-Driven Modelling in Additive Manufacturing
### Genetic Algorithm  
In Selective Laser Melting (SLM), the parameter settings will impact the outcome of the processed material. Properties such as the bead width, tensile strength, compressive strength and wear are some of the properties affected by the SLM configuration imposed. A multi-gene genetic programming is proposed in [98], to optimize the parameter setting with the evolutionary stage of the method called the Modified Multi-gene Genetic Programming (M-MGGP). Genetic Algorithms (GA) works on the basic principles of evolution as it is a meta heuristic to natural selection and the various subprocesses that occur spontaneously. The cycle of GA is initiated by the assessment of fitness score of all the agents in the current generation as shown in Figure 7, then with the selection of the top percentile of all models, the models are crossed over with one another arbitrarily and finally, mutated in order to introduce randomness. The cycle stops if the criteria is met or resets from the mutation phase onwards [99]. Figure 6: Flowchart of the Monte Carlo model. Figure 7: Flowchart of the GA cycle. M-MGGP is in the form of weighted sum of several genes with least square method for regression phase. Figure 8 shows gene 3 with \(p\) value lower than 0.05 is eliminated with the other two genes combined using the stepwise regression method. In the simulation tested together with two other methods namely ANN and normal Multi-gene Genetic Programming (MGGP), root mean square (RMSE) error shown in the proposed method is 63.8% lower than ANN and 47.9% lower relative to the normal MGGP method. The relatively better generalization ability of the M-MGGP method proposed is beneficial for rapid prototyping users in which the production time can be further decreased by optimizing the SLM process beforehand. In addition, the bead width increases with the increase in laser power and powder layer thickness meaning that by regulating the scanning speed of the SLM machine, a higher variation in bead width can be obtained. A squared correlation coefficient, \(R^{2}\), of up to 0.98 was recorded indicating good agreement with the experimental data. A mean standard error of 0.25 was recorded, outperforming ANN and the normal MGPP being benchmarked against. ### Genetic Algorithm  
Although additive manufacturing offers a number of unique capabilities like design freedom, its full potential might be hindered by a number of factors including the lack of available predictive models that correlate the properties of the processed parts to the processing parameters [100]. It includes part quality, repeatability, and the lack of material and process standards. A predictive model for learning and prediction of metallic part's porosity is developed using a Gaussian Process (GP) regression model in [101] using SLM based AM. GP is a discriminative machine learning process with the additional advantage of providing a full conditional, statistical description for the predicted variable that can primarily be used to establish confidence intervals and set hyperparameters which gives an alternative to regression problems [102]. GP models are formed from classical statistical models by substituting latent functions of parametric form by random processes with Gaussian prior. The Gaussian-based predictive model expresses the porosity as a function of laser power and scanning speed identified as two of the most influencing parameters on part porosity. The use of spatial covariance functions is extended with re-parameterization from the rather limited application in geographical spaces to generalize 2-dimensional spaces with different physical units. Then, a Bayesian updating methodology was adapted to estimate the statistical model's parameters and Kriging prediction [103] was employed to estimate the resulting porosity at various power-speed combinations. Figure 9 summarises the prediction methodology using the proposed model.