# Application of Machine Learning to Express Measurement Uncertainty
## 3 Experimental Data, Comparative Analysis, and Discussion
### Experimental Data and Comparative Analysis  
As mentioned in the previous section, the training dataset has one input parameter (feature) and one output parameter (label). The mean distance between PD and AE sensors \(l_{sr}\) is the predicted value, while the temperature coefficient of sensitivity \(c_{T}\) is the feature. The dataset originated from [30] and was generated using MC simulation. The number of MC simulations was 10,000. In the simulations, a cube-shaped area filled with mineral oil with a side length of 0.60 m was considered. The PD location was unchanged (0.05 m, 0.54 m, 0.14 m) while the sensors' positions were randomized. The temperature coefficient of sensitivity was calculated using maximum change in the result for detecting the location of PD \(\Delta gmax\) and mineral oil's temperature change \(\Delta T\), \(c_{T}=\Delta gmax/\Delta T\). The considered data is for the mineral oil's temperature range of 40 \({}^{\circ}\)C [30]. The dataset's characteristics are visualized in Figures 3 and 4, while its basic statistical properties are given in Table 1. The dataset employed in this study can be retrieved from the following URL: [[https://doi.org/10.6084/m9.figshare.20401953.v1](https://doi.org/10.6084/m9.figshare.20401953.v1)]([https://doi.org/10.6084/m9.figshare.20401953.v1](https://doi.org/10.6084/m9.figshare.20401953.v1)) (accessed on 23 August 2022). Figure 3: Pair-plots between the feature and the target variable. A free, open-source, cross-platform framework, ML.NET is used to train the ML model. The ML.NET framework offers multiple machine learning algorithms. The framework can iteratively train multiple algorithms and rank them according to the appropriate performance metrics. A ranked list of the best training algorithms (top five) is suggested to the user. Several different classes (trainers) are available for solving regression problems, grouped into trainers for linear regression and binary logistic regression [40]. The development tool was Microsoft Visual Studio Community 2019. The training time was 120 s on a 64-bit Windows 10 PC with an Intel Core i7-8750H processor and 16 GB of RAM. The results of the training are presented in Figure 5.  
The trainers were ranked based on the value of \(R^{2}\). The _FastTreeRegression_ trainer that implements the DART algorithm (\(R^{2}=0.7666\)) achieved the best result. The second best was the _FastForestRegression_ trainer that implements the random forest algorithm (\(R^{2}=0.7658\)). The predictions of the model that implements the DART algorithm are presented in Figure 6.  
Figure 4: Heatmap representation of feature target correlation. Figure 5: The results of the training using ML.NET. \begin{table}
\begin{tabular}{c c c} \hline \hline
**Count** & **1799** & **1799** \\ \hline  & \(c_{T}\) **[m/\({}^{\circ}\)C]** & \(I_{sr}\) **[m]** \\
**Average value** & 0.001691 & 0.2083 \\
**Standard deviation** & 0.001168 & 0.0580 \\
**Minimum** & 0.000213 & 0.1008 \\
**25\%** & 0.000778 & 0.1594 \\
**50\%** & 0.001450 & 0.2132 \\
**75\%** & 0.002324 & 0.2516 \\
**Maximum** & 0.006055 & 0.3325 \\ \hline \hline \end{tabular}
\end{table} 
Table 1: Basic statistical characteristics of the employed dataset. To calculate the measurement uncertainty of the model using the expression (11), it is necessary to calculate the maximal \(L_{1}\) loss on the considered dataset. The ML_NET_ does not include this metric in the output results, so it was calculated additionally. The maximal \(L_{1}\) loss of the model on the considered dataset was 0.1078 m.  
Assuming the discrete uniform distribution, the model's standard type B measurement uncertainty is \(u_{B}=0.06\) m with a degree of statistical certainty of 57.7%. The number of predictions that did not fall into the standard measurement uncertainty interval was 53, i.e., 2.9%. Additionally, the expanded uncertainty was calculated. It used the coverage factor of \(\surd 3\), \(U_{B}\approx 0.11\) m, with the degree of statistical certainty of 100%.