## 2 Materials and Methods
### Model Performance Evaluation  
In this study, the data of 61 coal samples were divided into training set (46) and prediction set (15) with the ratio of 3:1. The behavior of machine learning models is significantly influenced by hyperparameters during the training and prediction processes, which greatly affects the results [49]. Manual-based hyperparameter optimization for different models and data requires extensive domain knowledge and often requires a large number of experiments, making it both time-consuming and labor-intensive. The Optuna method applies the tree-structured parzen estimator to perform single-objective optimization, and its hyperparameter combinations are selected based on the estimation of probability distributions, which performs well in high-dimensional and complex search space [50]. With \(RMSE_{CV}\), all models were optimized based on different combinations of input variables and hyperparameters on the training set by 10-fold cross-validation, as shown in Table 11.  
The optimized model was trained and validated using leave-one-out cross-validation on the training set and then predicted on the unknown prediction set to comprehensively evaluate model performance. Leave-one-out cross-validation (LOOCV) enables the model to be validated n times (n is the number of samples) across different combinations of samples by taking 1 sample as the validation set and the other (n\(-\)1) samples as the training set each time. LOOCV can maximize data usage to comprehensively evaluate the generalization ability of the model and reduce the dependence on specific data features, effectively mitigating the risk of overfitting [51]. This approach is particularly suitable for small datasets [52]. To evaluate the performance of all four models, the coefficient of determination (\(R^{2}\)), the root mean square error (\(RMSE\)), and the relative prediction deviation (\(RPD\)) were employed to measure the accuracy of the training and prediction sets, which can be expressed by Equations (6)-(8).  
\[R^{2}=1-\sum_{i=1}^{n}\left(y_{i}-y_{i}^{\prime}\right)^{2}/\sum_{i=1}^{n}(y_ {i}-\overline{y})^{2} \tag{6}\]  
\[RMSE=\sqrt{\sum_{i=1}^{n}\left(y_{i}-y_{i}^{\prime}\right)^{2}/n} \tag{7}\]  
\[RPD=SD/RMSE \tag{8}\]  
where \(y_{i}\) is the true value, \(y_{i}^{\prime}\) is the predicted value, \(\overline{y}\) is the mean of the measured value, \(n\) is the data size, and \(SD\) is the validation set standard deviation. Generally, a desirable model should have a high \(R^{2}\) value and a low \(RMSE\) value. The model performance is excellent when \(R^{2}>0.90\) and \(RPD>3\)[53].  
By applying the optimal model to the pixel-by-pixel analysis of coal hyperspectral images, the distribution of coal quality indices is visualized. Specifically, for prediction at each pixel, a mask region centered on the pixel is selected. Then, the features within the region are extracted according to the feature extraction method before and finally imported into the optimal model for the prediction. The predicted values of all pixels are sorted by their original positions to generate a total predicted image. Finally, the maximum and minimum values of this image are used to set the color palette, and the visualization of coal quality indices is produced by assigning colors to the predicted values based on the color palette.