# Performance Investigation of Coated Carbide Tools in
## 3 Results
### Machine Learning Models
#### 3.1.2 Regression with KNN and SVR  
Another two regression-based ML models were developed applying the KNN and SVR algorithms, with three input features (f\({}_{x}\), V\({}_{c}\), a\({}_{e}\)) and a single continuous output value (T\({}_{0.15}\)), as in the case of the ANN. In particular, the KNN model operates by identifying the 'k' most similar data points (neighbors) in the training set and computing the output as a weighted or unweighted average of their values, allowing it to capture complex, non-linear relationships within the data. A small 'k' allowed the model to capture finer details but risked overfitting, whereas a larger 'k' smoothed predictions but could lead to underfitting. Unlike parametric models, KNN does not make explicit assumptions about the underlying data distribution but instead relies on distance metrics such as Euclidean distance to determine similarity between points, as displayed in Figure 7a. Considering the hyperparameters of the model: the number of neighbors was equal to fourteen, the algorithm used to compute the nearest neighbor was selected to be 'kd_tree', the employed weight function for the predictions was set to 'distance', the 'leaf size' passed to KDTree was equivalent to twenty, and the metric to use for distance computation was the'minkowski'. Regarding the SVR model, it extends the principles of support vector machines (SVM) to regression tasks, aiming to compute a function that best fits the data while maintaining a margin of tolerance around the true values. Unlike traditional regression models, SVR does not minimize the error directly but instead seeks to keep predictions within a specified threshold, known as the epsilon-insensitive tube, where deviations within epsilon are not penalized, as schematically illustrated in Figure 7b. Firstly, the input data were standardized to ensure proper distance measurements within the kernel function. During training, SVR identified a subset of the training samples, known as support vectors, which defined the  
Figure 6: Evaluation of the ANN model predicting the lifespan of a tool based on milling conditions. regression function and contributed to predictions. By leveraging these support vectors and the non-linear mapping provided by the kernel, the SVR model effectively captured intricate patterns in the data, making it highly suitable for non-linear regression tasks where the relationship between inputs and outputs is relatively complex, as in the tool's lifespan case. The main hyperparameters of the developed SVR model were the following: the kernel that was selected was 'poly', the degree of the polynomial kernel function was equivalent to three, the independent term in the kernel function 'coef0' = 1.68, and the 'epsilon' of the SVR model was equal to 0.1. Table 3 presents the test set of the ML algorithms, which are additional milling experiments that were excluded from the training phase and instead used for validating the developed ML models. The table also illustrates the models' performance in predicting the tool's lifespan based on the applied values at certain milling conditions. To assess forecasting accuracy, three performance metrics were employed: mean squared error (MSE), mean absolute error (MAE), and the discrepancies between predicted and actual experimental values. These metrics were calculated using the following equations:  
\[MSE=\frac{1}{N}\sum_{k=1}^{N}(y_{k}-\hat{y_{k}})^{2} \tag{2}\]  
\[MAE=\frac{1}{N}\sum_{k=1}^{N}|y_{k}-\hat{y_{k}}| \tag{3}\]  
\[Error=\frac{|y_{k}-\hat{y_{k}}|}{y_{k}} \tag{4}\]  
where N represents the total number of data points, while y\({}_{\text{k}}\) and \(\hat{y_{\text{k}}}\) denote the actual and predicted values, respectively. Finally, it is worth mentioning that ML models typically require large datasets to generalize well. Nevertheless, when the underlying relationships in the data are not very complex, simpler ML models like regression could be effective even with small datasets [24].