# Raster Angle Prediction of Additive Manufacturing Process Using Machine Learning Algorithm
## 4 Results and Discussion  
### Machine Learning Algorithm Results  
Values corresponding to the actual raster angle were written to evaluate the results of the analyzed data in the range of 0-1 during normalization. The minimum raster angle corresponds to 0\({}^{\circ}\), while the maximum value corresponds to 90\({}^{\circ}\). The model results, which were developed on the basis of the process parameters in Table 1 and an estimate connecting the raster angle to the process parameters, are shown in Figure 6.  
A graphical comparison process is shown between the actual and estimated raster angle values for each part using different ML algorithms. The model based on the RFR method predicted the raster angle very well with little deviation. Figure 5: Proposed machine learning flowchart. Various performance metrics have been used to measure the prediction performance of the proposed ML algorithms. The statistic we use with the abbreviation root mean square error (RMSE) is the square root of the difference between the estimated parameter value and the actual parameter value divided by the sample size. This method is expressed by the following equation:  
\[RMSE=\sqrt{\frac{1}{\eta}{\sum_{i=1}^{n}(y_{i}-\hat{y_{i}})^{2}}} \tag{10}\]  
Figure 6: Actual and predicted values obtained using different ML algorithms. R-squared (R\({}^{2}\)) is a statistical measure used to evaluate the performance of the model. A value close to \(1\) for this metric is a measure of success for the model. \[R^{2}=1-\frac{\sum(y_{i}-\hat{y_{i}})^{2}}{\sum(y_{i}-\overline{y})^{2}} \tag{11}\]  
The mean absolute error (MAE) is obtained by dividing the result by the number of samples as the sum of the absolute values of the differences between the actual and predicted values in the dataset. The lower the MAE value, the better the performance achieved. \[MAE=\frac{1}{N}{\sum_{i=1}^{N}}{|y_{i}-\hat{y_{i}}|} \tag{12}\]  
The mean squared error (MSE) is the difference between the model prediction and the target value. If the magnitudes of the error values are similar, MSE can be used. However, if one or more of the predicted values (large errors above the average) are obtained, this measurement may not be appropriate. As the MSE statistic takes the squares of the errors, it gives exaggerated results in the case of large deviations. \[MSE=\frac{1}{n}{\sum_{i=1}^{N}}(y_{i}-\hat{y_{i}})^{2} \tag{13}\]  
The explained variance score (EVS) is a statistical measurement that shows how the sub-dimensions affect the variables in the dataset because of factor analysis. As the score values approach one, the success of the algorithm increases. \[EVS(y,\hat{y})=1-\frac{Var(y-\hat{y})}{var(y)} \tag{14}\]  
The performance analysis results of the ML algorithms are presented in Table 2. Although 80% of the total data were used for training and 20% for testing, the lowest R\({}^{2}\) values were calculated in the SVM method as 0.692 and 0.685 in the training and test sets, respectively. Among the ML models examined, the SVM model performed worse than all other models on both the training and testing sets, as suggested by the performance metrics in Table 2. For a prediction model to be successful, the MSE, MAE, and RMSE criteria must be low, and the R\({}^{2}\) and EVS criteria must be close to one. The best-performing method in all sets is the RFR model. This model has the highest R\({}^{2}\) and EVS values and the lowest MSE, MAE, and RMSE values. In other ML algorithms, although the error rates are within the acceptable range, the success ranking according to the performance criteria is GPR, ANN, DTR, and SVM.