## 4 Machine Learning (ML) Algorithms and Results
### Presentation of the Results Obtained for Classical ML Models  
From all calculated classifiers, only those that delivered the best outcome for the test data were presented. During the learning process, the data were subjected to 10-fold cross-validation and 20% of the feature vector cases (records) in the database were used to obtain the final verification. During the experiments, the performance of the successively analysed ML algorithms was investigated. The effect of varied transducer angular step size on the accuracy obtained for given the ML algorithm was assessed in these studies. Although the basic transducer rotation step used for the measurement was 1.8\({}^{\circ}\), it is possible to reduce the angular measurement resolution and increase the rotation step by only considering a portion of the measurements (portion of basic steps) during the learning process. Thus, for this reason, the analysed rotation steps that the transducer took between successive measurements were equal to 1.8\({}^{\circ}\), 3.6\({}^{\circ}\), 9\({}^{\circ}\) and 21.6\({}^{\circ}\). The angular step size influences both the number of unique instances in the training set and the ML algorithm's resolution of differentiating unique cases. Using this method, the accuracy %Acc of proper prediction for different angular resolutions of measurements was calculated according to:  
\[\%Acc=\frac{PR}{NoR}\times 100 \tag{1}\] \begin{table}
\begin{tabular}{|c|c|c|c|c|c|} \hline
**Ensemble** & Boosted Trees & Bagged Trees & Subspace & Subspace KNN & RUSBoost-edTrees \\ \hline \multirow{2}{*}{Preset} & \multirow{2}{*}{Boosted Trees} & \multirow{2}{*}{Bagged Trees} & Subspace & Subspace KNN & RUSBoost-edTrees \\ \cline{3-6}  & & & Discriminant & Subspace KNN & RUSBoost-edTrees \\ \hline \multirow{2}{*}{Ensemble method} & \multirow{2}{*}{AdaBoost} & \multirow{2}{*}{Bag} & Subspace & Subspace & RUSBoost \\ \cline{3-6}  & & & Discriminant & Nearest neighbours & Decision Tree \\ \cline{3-6}  & & & & \multicolumn{1}{c|}{} & \\ \cline{3-6}  & & & & \multicolumn{1}{c|}{} & \\ \cline{3-6}  & & & & \multicolumn{1}{c|}{} & \\ \cline{3-6}  & & & & \multicolumn{1}{c|}{} & \\ \hline \end{tabular}
\end{table} 
Table 1: _Cont._  
Figure 6: Scheme of data workflow. where: \(PR\) is the number of properly predicted records and \(NoR\) is the number of all records in the database. Table 2 presents the best result obtained for all trained ML models for four angular resolutions: \(1.8^{\circ}\) (there were 51 angles, thus 51 classes as well considered between TD and RD), \(3.6^{\circ}\) (26 classes), \(9^{\circ}\) (11 classes), \(21.6^{\circ}\) (5 classes). Finally, to determine the total number of classes for all samples, the above values of the number of angle classes should be multiplied by ten, that is by the total number of the inspected steel grades. In the Table 2, in the row named \"Method\" by successive columns referring to the results achieved for different angular resolutions, the algorithm for which the best result was obtained was indicated. In the case of angular resolution \(1.8^{\circ}\), the greatest accuracy was reached for the ensemble bagged tree algorithm, while for other resolutions, it was artificial neural network (with different setup) that was the most accurate. Generally, in case of the highest number of classes (referring to the angular resolution of \(1.8^{\circ}\)--the highest angular resolution case) the Ensembles Bagged Trees models showed an advantage of 5-10% over the naive Bayes and kNNs methods. The ANN and SVM structures did not reach enough flexibility and failed to obtain the solution in this case. Along with the reduction of the class numbers (by reducing the angular resolution to 3.6), ANNs (especially narrow and medium neural network structures, for which the accuracies differed from each other by approx. 1% maximum) obtained 6-8% advantage over the Ensembled Subspace Discriminant and Bagged Trees, leaving kNN models far behind (which reached close to 20% of difference in accuracy in reference to the ANNs' result).