## 3 Results  
### Spectral Data Analysis  
In this section, we provide a statistical summary for each wavelength of spectral data obtained from the milk samples. This analysis sheds light on the data distribution and the potential impacts on key milk components such as protein and fat.  
The dataset was measured across wavelengths ranging from 610 nm to 860 nm, and histograms for each of these wavelengths were created. These histograms illustrate the frequency distribution of the spectral data, revealing the extent of variation within the dataset. For instance, while most data points at 610 nm are concentrated in the ranges of 7 and 8, a wider distribution is observed at 860 nm.  
Furthermore, the relationships between the protein and fat content and these spectral wavelengths are displayed in a correlation matrix. This heatmap visually represents how different wavelengths contribute to the predictions of protein and fat content. Areas of strong correlation are highlighted in red, whereas areas of weak correlation are shown in blue. Notably, a strong positive correlation between protein and fat content suggests that high protein content is generally associated with high fat content.  
At 610 nm, the minimum value is 5, the maximum value is 12.4, and the average is 7.37. Similarly, at 860 nm, the minimum is 93.2, the maximum is 243.8, and the average is 136.69. These summary statistics provide an overall view of the data distribution at each wavelength, and the standard deviations indicate the variability of the data depending on the wavelength.  
Table 2 provides detailed statistical analysis for each wavelength, including mean, median, mode, range, variance, and standard deviation.  
During the model setup, determining which spectral features are more informative is of critical importance. A correlation analysis reveals which wavelengths are more strongly associated with predictions of protein and fat content, as illustrated in Figure 3. This information guides which features should be prioritized to enhance the predictive  
\begin{table}
\begin{tabular}{c c} \hline \hline
**Parameter** & **Value** \\ \hline n\_estimators & 100 \\ max\_depth & 3 \\ learning\_rate & 0.1 \\ subsample & 1 \\ \hline \hline \end{tabular}
\end{table}
Table 1: Hyperparameter settings for the final XGBoost model.  
capability of the model. Generally, the spectral data analysis depicted in Figure 4 plays a vital role in developing strategies for accurately predicting milk components.  
This detailed analysis of spectral data allows for a targeted approach to feature selection, focusing on those wavelengths that show the strongest correlations with the compo  
\begin{table}
\begin{tabular}{c c c c c c c c c} \hline \hline  & **610 nm** & **680 nm** & **730 nm** & **760 nm** & **810 nm** & **860 nm** & **Protein** & **Fat** \\ \hline
**Count** & 2399.0 & 2399.0 & 2399.0 & 2399.0 & 2399.0 & 2399.0 & 2399.0 & 2399.0 & 2399.0 \\
**Mean** & 7.374 & 24.742 & 92.403 & 137.979 & 178.570 & 136.686 & 3.323 & 3.047 \\
**Std** & 1.394 & 7.037 & 18.302 & 36.928 & 46.704 & 42.160 & 0.262 & 1.350 \\
**Min** & 5.0 & 17.7 & 71.2 & 98.0 & 127.9 & 93.2 & 2.4 & 0.001 \\
**25\%** & 6.2 & 20.8 & 79.8 & 114.2 & 149.3 & 111.0 & 3.2 & 3.3 \\
**50\%** & 7.4 & 21.8 & 84.5 & 122.2 & 158.3 & 117.9 & 3.3 & 3.6 \\
**75\%** & 7.4 & 25.0 & 98.3 & 145.6 & 187.8 & 139.1 & 3.5 & 3.8 \\
**Max** & 12.4 & 44.7 & 140.6 & 298.5 & 295.1 & 243.8 & 4.0 & 4.6 \\ \hline \hline \end{tabular}
\end{table}
Table 2: Statistical analysis of the data.  
Figure 4: Distribution of spectral data across different wavelengths.  
Figure 3: Relationship between protein and fat content in milk.