# Raster Angle Prediction of Additive Manufacturing Process Using Machine Learning Algorithm
## 4 Results and Discussion
### Hyperparameter Optmization and Cross Validation  
The predictive performance and generalization capability of a model is determined by the values assigned to its hyperparameters [52]. The optimal values of the hyperparameters are chosen with the help of hyperparameter optimization. Bayesian is a widely used hyperparameter optimization technique. Bayesian optimization is a probabilistic model-based optimization technique that efficiently searches for the optimal hyperparameters by constructing a probabilistic surrogate model of the objective function. It iteratively selects hyperparameter configurations to evaluate based on an acquisition function, which balances exploration and exploitation. To prevent over-fitting problems, a K-fold cross-validation method is adopted during the optimization. Firstly, the dataset is split into training and testing datasets comprised of 80% and 20% of the completed dataset, respectively. Notice that the performance of the RFR model is superior to the available methods when tested using the K-fold cross-validation technique (K = 10) with different predictive performance evaluation metrics like MSE, MAE, RMSE, and R\({}^{2}\). In this study, a 10-fold cross-validation is combined with a Bayesian algorithm to optimize the hyperparameters. The results of MSE, MAE, RMSE, and R\({}^{2}\) using K-fold cross-validation in every fold on the 3D training and testing sets are presented in Figure 8. Figure 8 presents the mean squared error of RFR in a ten-fold cross-validation while Figure 8 shows the mean absolute error performance on every ten-fold K cross-validation test. Similarly, Figure 8 shows the root mean square error, and Figure 8 shows the R-squared. The results show that the prediction model predicts the raster angle with high accuracy. The raster angle prediction study may face several limitations that could impact the accuracy and generalizability of its findings. Firstly, the complexity of the FDM process and its dependence on various factors, such as the material properties, printing parameters, and geometric characteristics of printed objects, can pose challenges in accurately predicting raster angles. This complexity may result in difficulties in capturing all relevant variables and their interactions within the predictive models, potentially leading to suboptimal performance or limited predictive power. Secondly, the study's reliance on specific predictive models, such as RFR, may introduce limitations in terms of model assumptions and flexibility. These models typically require the careful tuning of hyperparameters and feature selection, and their performance may vary depending on the characteristics of the dataset and the underlying relationships between variables. Consequently, the predictive models developed in the study may not fully capture the nuances of raster angle prediction across different printing scenarios, thus restricting the applicability of the findings in real-world settings. Addressing these limitations would require the thorough validation of the models on diverse datasets and the consideration of alternative modeling approaches to enhance the robustness and reliability of raster angle prediction studies. For future raster angle prediction research, it is recommended to focus on several key areas to overcome current limitations and advance the field. Firstly, researchers should prioritize the collection of high-quality and diverse datasets that encompass a wide range of printing conditions, materials, and geometric complexities. This will enable more comprehensive model training and validation, leading to improved prediction accuracy and generalizability across different FDM systems. Additionally, exploring advanced machine learning techniques, such as deep learning architectures or ensemble methods, could offer new avenues for capturing intricate patterns and dependencies within the data, thereby enhancing the predictive capabilities of the models.