# Density Prediction in Powder Bed Fusion Additive Manufacturing: Machine Learning-Based Techniques
## 4 Results  
In this study, different ML techniques have been utilized to optimize the process parameter for the density of SS316L. The input process parameters are used to predict the build part's density, based on the parameters shown in Appendix A (Table A1). The linear regression, ANN, KNN, and SVM models are applied to training data to predict the density of the model. The predicted and actual data of density were compared with R-squared value, correlation factor, and various error bars, and mean absolute percentage error (MAPE), mean absolute error (MAE), and mean absolute deviation (MAD) were obtained. The ANN model with stochastic average gradient is used here to predict the density of the building part. The ANN model with different hidden layer numbers was developed. The developed ANN model uses the feedforward network with the 1200 layers and sigmoid activation function. Figure 7A compares actual vs. predicted density values for the ANN model. The predicted model shows a reasonably good comparison with actual density values. The 1200 set of neurons provides good accuracy with a 0.955 R-squared value, as shown in Figure 7B. The statistical line fit between actual and predicted density is also mentioned in the form of a mathematical equation. The hidden layer extracts data from one set of neurons (input layer) and provides it to the output layers. The layers do not provide any explanation about the developed relationship. Hence, they are referred to as hidden layers. The output layer offers the result in an understandable form. Many hidden layers make a complex structure and increase the accuracy in predicting the test data. However, it may lead to over-fitting the model. Over-fitting is when the model adjusts itself to fit too precisely with the training data set. In other words, it decreases the training error. However, the model may not be accurate for future predictions with new data. The over-fitting must be avoided by stopping the learning phase of a model at some level. Figure 7: _Cont._  
The KNN model is also developed to predict density with 70% of training data. The KNN is an instant-based learning model unusual from general explicit algorithms learning. KNN model is cross verified with the minimum RMSE value, and with the eight neighbors, the optimum value of RMSE was found to be 1.2331, as shown in Figure 8.  
The actual vs. predicted density value with the KNN model is compared as shown in Figure 9A. The predicted KNN model shows a sensibly good comparison with actual density values. The developed model accurately predicts the testing data set with a 0.863 R-squared value, as shown in Figure 9B. The only limitation of the KNN model is the sensitivity to the unbalanced data set, where most entities belong to one or a few classes, and infrequent classes are often dominated in most neighborhoods. This can be alleviated through the balanced sampling of more popular classes in the training stage, possibly coupled with ensembles. Figure 8: The optimum value of k- numbers for RMSE. Figure 7: ANN model: (**A**) density prediction actual vs. predicted value and (**B**) statistical correlation between actual vs. predicted value. The actual vs. predicted density value with the SVM model is compared as shown in Figure 10A. The predicted SVM model shows a rationally good comparison with actual density values. SVM model with the polynomial kernel was developed for density prediction. Figure 10: _Cont._  
Figure 9: KNN model: (**A**) comparison of the actual and predicted density of AM SS316L and (**B**) statistical correlation between actual and predicted values for the applied model. The developed model accurately predicts density with an R-squared value of 0.923, as shown in Figure 10B. The SVM model was validated with RMSE value with different cost functions, as shown in Figure 11. The cost value ensures the smoothness of the hyperplane by selecting the different cost values. This graph shows the optimum value of the cost function for the minimum RMSE value.