# Intelligent Measurement of Coal Moisture Based on Microwave Spectrum via Distance-Weighted kNN
## 3 Results and Discussion  
### Outlier Detection  
As mentioned previously, the existence of outliers can interfere with the spectral feature extraction by machine learning model and adversely affect prediction results. Therefore, the MD-ICM was used to detect and eliminate outliers. Since the number of samples in each group was less than the feature dimension, the principal component analysis (PCA) was performed to reduce the dimension before outlier detection. It should be mentioned that PCA was used only for outlier detection, and in the subsequent experiments, the model input was still the original feature dimension. The principal components representing more than 99.99% of the variance were retained to overcome the disadvantage of fewer data.  
The process of outlier detection is shown in Figure 5. In the first iteration, one sample with a distance longer than 3\(\sigma\) was detected and eliminated, as shown in Figure 5a. Then, the 3\(\sigma\) value was recalculated, and in the second iteration, another outlier sample was detected and eliminated, as shown in Figure 5b. In the third iteration, no outliers were detected, and the iteration ended, as shown in Figure 5c. Hence, a total of two outliers were detected and eliminated from this dataset. The same process of outlier sample elimination was used for the remaining data, and the obtained results are listed in Table 2. Finally, a total of 13 outliers were eliminated from 294 data samples of the six datasets. After the outlier elimination, the six datasets were mixed into one dataset containing 281 data samples to facilitate the application of the NCV method in the subsequent analysis.  
\begin{table}
\begin{tabular}{c c c c c} \hline \hline \multirow{2}{*}{**Sample Label**} & \multicolumn{5}{c}{**Index of Outliers**} \\ \cline{2-5}  & **1 st Iteration** & **2 nd Iteration** & **3 rd Iteration** & **4 th Iteration** \\ \hline Region-A & 49 & 42 & \(\backslash\) & \(\backslash\) \\ Region-B & 14/28 & \(\backslash\) & \(\backslash\) & \(\backslash\) \\ Region-C & 7 & \(\backslash\) & \(\backslash\) & \(\backslash\) \\ Region-D & 21 & \(\backslash\) & \(\backslash\) & \(\backslash\) \\ Region-E & 49 & 35 & 42 & \(\backslash\) \\ Region-F & 35/42 & 7 & 49 & \(\backslash\) \\ \hline \hline \end{tabular} Note: “\(\backslash\)” means stop iteration.  
\end{table}
Table 2: The results of outlier detection.  
Figure 5: The process of outlier detection, including (**a**) The first iteration; (**b**) The second iteration; (**c**) The third iteration. \(D(x_{i},\gamma)\) represents the Mahalanobis distance between samples \(x_{i}\) and \(\gamma_{i}\)\(\chi\) and \(\sigma\) represent the mean and standard deviation of the Mahalanobis distances, respectively.  
Table 3 shows the comparison of experimental results before and after data preprocessing. The measurement effect corresponding to the combination of DW-kNN for regression and MD-ICM for outlier detection is better than that without data preprocessing. This shows that the individual inferior spectral data caused by inevitable factors could interfere with the spectral feature extraction by machine learning models. These problems will seriously affect the prediction results. Through the detection and elimination of outliers based on the MD-ICM, inferior spectral data can be avoided, and the accuracy of the prediction results of coal MC can be effectively improved.