# Machine Learning Prediction of Turning Precision Using Optimized XGBoost Model
## 3 Proposed Method  
In the present study, the effects of the four machining parameters on the turning precision were predicted using a supervised MK model. Most supervised-learning problems can be categorized as either \"classification\" problems or \"regression\" problems. Classification problems involve predicting a discrete valued output, such as a number or a certain species. By contrast, regression problems involve predicting a continuous valued output, such as stock market movement or the price of goods. The present study considered a regression-type problem, in which the aim was to predict the machining error of the turning process, given a knowledge of the settings assigned to the four machining parameters. The data required to train the ML model were obtained from the Taguchi DOE factorial design described in the previous section, where the level settings for the four machining parameters are listed in Table 2.  
The machining error is calculated by the following equation:  
\[Error=\left|D_{target}-D_{measured}\right| \tag{1}\]  
where \(D_{target}\) is the diameter of the turning target size and \(D_{measured}\) is the diameter of the measured value after the turning process. The turning experiments were performed on a Feeler turning machine (model: FTC-10), as shown in Figure 2, using cylindrical S45C medium carbon steel specimens. The specifications of the workpiece and cutting tool are shown in Table 3. \begin{table}
\begin{tabular}{l c c c c} \hline \hline
**Facetor** & **Level** & **1** & **2** & **3** \\ \hline A. Depth of machining (mm) & 0.1 & 0.5 & 1.0 \\ B. Rotational speed (rpm) & 2000 & 2300 & 2500 \\ C. Feed rate (mm/rev) & 0.15 & 0.2 & 0.25 \\ D. Length of cantilever workpiece (mm) & 40 & 60 & 80 \\ \hline \end{tabular}
\end{table} 
Table 1: Factor and standard. \begin{table}
\begin{tabular}{c c c c c} \hline \hline
**Case** & **A. Depth of** & **B. Rotational** & **C. Feed Rate** & **D. Length of Cantilever** & **Machining Error** \\  & **Machining (mm)** & **Speed (rpm)** & **(mm/rev)** & **Workpiece (mm)** & **(mm)** \\ \hline
1 & 0.1 & 2000 & 0.15 & 40 & 0.013617 \\
2 & 0.1 & 2300 & 0.2 & 60 & 0.0308 \\
3 & 0.1 & 2500 & 0.25 & 80 & 0.02955 \\
4 & 0.5 & 2000 & 0.2 & 80 & 0.03207 \\
5 & 0.5 & 2300 & 0.25 & 40 & 0.0419 \\
6 & 0.5 & 2500 & 0.15 & 60 & 0.01425 \\
7 & 1 & 2000 & 0.25 & 60 & 0.00961 \\
8 & 1 & 2300 & 0.15 & 80 & 0.0053 \\
9 & 1 & 2500 & 0.2 & 40 & 0.01391 \\ \hline \hline \end{tabular}
\end{table} 
Table 2: Factor and standard. Experimental results by L9 orthogonal array. Figure 2: Feeler turning machine (Model: FTC-10) used in experiments. Prior to constructing the ML model, the experimental data obtained from the Taguchi experiments were pre-processed in order to accelerate the convergence of the training process and improve the prediction accuracy. Data pre-processing was performed using the min-max normalization [15] technique. In other words, the minimum and maximum values of each variable in the dataset were mapped to 0 and 1, respectively, and all the other values in between were scaled accordingly within the range of \([0,1]\). In other words, the normalization process was performed as  
\[X_{normalize}=\frac{x-x_{min}}{x_{max}-x_{min}}\in[0,\ 1] \tag{2}\]  
where \(X_{normalize}\) is the value after normalization and \(x_{max}\), \(x_{min}\), and \(x\) are the maximum, minimum, and original values, respectively. The normalization process is illustrated schematically in Figure 3.  
Following data processing, the model was trained and tested using the leave-one-out cross-validation technique [16]. Briefly, one data sample in the dataset was taken as an assessment set (i.e., a testing set), and all the other data samples were taken as a training set. The process was repeated until every data sample in the dataset had been taken as the assessment set once. As shown in Table 2, the Taguchi DOE design involved nine experimental runs.