## 3 Examination of Machine Learning Analysis Using Simulation Spectra
### Solid-Liquid Phase Fraction Analysis by Supervised Machine Learning Method  
To evaluate the performance of the supervised machine learning method, the simulated dataset was randomly divided into training and testing data groups after dimensionality reduction by PCA. Of the original dataset including 1701 spectra, 1500 were for the training data group and 201 were for the test data group. The test data group was analyzed by the ML model built using the training data group, and the difference between the analyzed solid fraction and the original solid fraction was evaluated by the root mean square error (RMSE) shown by the equation:  
\[\text{RMSE}=\sqrt{\frac{1}{n}\sum_{i=1}^{n}(f_{i}-y_{i})^{2}}. \tag{4}\]  
Here, \(n\) is the number of spectra analyzed, \(f_{i}\) is the solid-phase fraction estimated by the ML analysis, and \(y_{i}\) is the original solid-phase fraction set when the dataset was created. For the ML analysis, we tested SVR and ETR in addition to KNN. KNN and ETR showed higher performance than SVR when the training data contained statistical errors, and KNN had the lowest computational cost, so we adopted KNN in this study. The computational cost is also important in analyzing more than 10,000 spectra of all pixels of a two-dimensional detector in NTSI. In KNN, it is necessary to optimize the hyperparameter \(K\) of the training data, and in this study it was determined by 10-fold cross validation (CV). First, the result of the solid-phase fraction analysis by KNN is shown in Figure 5. In this case, the Gaussian distribution error was not added to the simulated spectrum dataset (\(\sigma\) = 0%). Here, \(K\) = 2 was used due to optimization. The horizontal axis of the diagram is the original solid-phase fraction, and the vertical axis is the solid-phase fraction estimated by KNN. The analyzed results of the test data shown by the red circle are in good agreement with the ideal values shown by the black line. In the figure, we also show the analysis results of the training data (blue triangles) in order to see how accurate the  
Figure 4: Representation of the simulated spectral dataset (\(\sigma\) = 0%) dimensionally reduced to the first three principal components of principal component analysis (PCA). analysis can be when analyzing the data used for training. Although this depends on the type of ML algorithm used, if there is a difference between the training and test data distributions there is a possibility that overlearning is occurring. In this case, there appears to be no problem. Next, we analyzed simulated datasets with Gaussian distribution errors (\(\sigma=1\), \(2\), \(3\),..., \(9\), \(10\%\)) using the ML models built by the training spectra, including the errors, which is the subject of this research. For example, the ML analysis results for the dataset that included an error of \(\sigma=5\%\) were divided and analyzed as mentioned above and shown in Figure 6. Here, the hyperparameter \(K=10\) was the optimal value. As can be seen from the figure, the variance of both the training and test data groups increases around the black line, which is the set value of the solid-phase fraction. However, the estimated values follow the black line as a whole and the solid-phase fraction is considered to give results with a certain accuracy. Since the variances of the training and test data groups are about the same, note that our ML model did not fail with regard to overlearning. Figure 7 shows the difference in RMSE when the ML models were built from each dataset created by changing the simulated statistical error, \(\sigma\). The horizontal axis of the diagram is the magnitude of the statistical error \(\sigma\) in the test data and the vertical axis is the RMSE. This figure shows the difference in RMSE depending on the statistical error (\(<\)5%) of the training data. If the statistical error contained in the test data is small, it is more accurate to perform the analysis using an ML model built using the training data of small \(\sigma\).