## 3 Experiment and Results Discussion
### COD Detection Compensation Based on Fusion of UV-Vis Spectroscopy and Environmental Factors
#### 3.2.2 Data Processing of UV-Vis Spectroscopy and Environmental Factors  
The traditional view is that data fusion has a strong anti-interference ability and can incorporate complementary information from multiple sources of data. With in-depth research, the application of multi-source information fusion algorithms has been explored. A better quantitative calibration model can be obtained using specific methods to select specific wavelength features. This enhances the predictive ability and robustness of the model. Therefore, selecting appropriate UV-Vis spectroscopy features and using their corresponding feature data as an input vector is very important. Figure 9: Feature-level fusion of UV-Vis spectroscopy and environmental factors. Spectral data processing. Firstly, the Stability Competitive Adaptive Reweighted Sampling (SCARS) algorithm is employed to extract features from the original spectral data. It is crucial to determine the optimal number of latent variables (LVs) for the PLS model in order to effectively filter the feature wavelengths using the SCARS algorithm. The initial maximum LV score for the PLS model is set to 15, and although the Monte Carlo sample count is set to 3000, this is not strictly necessary. The root mean square error of cross-validation (RMSECV) for PLS models across different LV values is illustrated in Figure 10. The minimum RMSECV value of 6.2604 occurs when the LV is nine, indicating that the optimal number of LVs for the PLS model is nine. After multiple attempts to select suitable SCARS parameters, this paper sets the Monte Carlo sampling frequency to 200, the LV to nine, and the number of cross-validation groups to 10. It is shown that as the number of samples increases, the number of preferred wavelength variables gradually decreases in Figure 11. During the sampling process, from iterations 1 to 142, the RMSECV value continuously decreases, indicating that the variables removed during the filtering process are not related to COD. After 142 samples, as the number of samples increases, the RMSECV value begins to rise, indicating that the variables removed during the filtering process are related to COD, leading to an increase in the RMSECV value. Different colored lines represent the changes in regression coefficients for different iterations. The smallest RMSECV value (6.15) occurs when the sampling frequency reaches 142 times, and its corresponding subset of characteristic wavelengths is the best. This subset contains 14 wavelengths at 195.83 nm, 197.27 nm, 202.07 nm, 204.95 nm, 205.43 nm, 206.39 nm, 210.23 nm, 212.15 nm, 215.98 nm, 216.46 nm, 216.94 nm, 220.29 nm, 238.48 nm, and 241.35 nm, which are the optimal wavelength points after feature extraction using the SCARS wavelength selection method. It can be seen that the highest absorbance value of UV-Vis spectroscopy occurs at around 1.4. However, the highest values of pH, temperature, and conductivity are 8.5, 33, and 137.7, respectively, from the actual UV-Vis spectroscopy shown in Figure 2 and the environmental factor data collected in Table 2. The spectral absorbance value is much smaller than the environmental factors value, and there is no comparability between them. If the spectral absorbance and environmental factor data are directly fused, the environmental factor data will play a dominant role in the model. The UV-Vis spectroscopy information is ignored, resulting in the failure of data fusion. Therefore, it is necessary to normalize the absorbance corresponding to fourteen wavelengths and three environmental factors before fusion (data alignment). In this way, two types of data are comparable at the same latitude, and then fusion, modeling, and other operations can be performed. Figure 10: The variation curve of RMSECV with LV. 2. Environmental factor data processing. Section 2.5 measured the environmental factors of the collected water samples and obtained pH, temperature, and conductivity data.