# Advancing Visible Spectroscopy through Integrated Machine Learning and Image Processing Techniques
## 4 Results and Discussions  
In this study, polynomial regression models spanning degrees 2 to 5 were formulated and assessed. However, upon examination, it was noted that these models yielded notable errors and struggled to accurately depict the inherent patterns within the dataset. The resultant curves displayed a poor alignment with the data points, highlighting the constraints associated with the selected polynomial degrees, as illustrated in Figure 3.  
According to Figure 3, the coefficient of determination for polynomial regression for the second degree is 97.77%, the third degree is 98.31%, the fourth degree is 98.69%, the fifth degree is 99.71%, the sixth degree is 99.77%, and the seventh degree is 99.72%. It can be seen that the fifth degree, sixth degree, and seventh degree polynomial regressions are equivalent. However, among all, the sixth degree of polynomial regression has the highest coefficient of determination. Notably, the sixth degree polynomial regression model highlights enhanced performance, displaying superior alignment with the dataset and diminished errors. For a more clear interpretation, the sixth degree polynomial regression has been shown with training data in Figure 4.  
After applying sixth-degree polynomial regression, the machine learning model generates a curve, as shown in Figure 5. Table 3 provides a comparison between the wavelengths in the dataset and the corresponding wavelengths at certain points after training. The results presented in Table 4 indicate the performance of the proposed methodology in predicting the dominant wavelengths emitted by various vapour sources compared to their known or original values. The methodology involves a combination of polynomial regression and machine learning algorithms to analyse spectral data extracted from images. Figure 4: Graph of 6 th degree of polynomial with respect to training data. Figure 3: Different degree of polynomial with respect to training data. Figure 5: Predicted vs. original wavelengths and error percentage for different vapours. \begin{table}
\begin{tabular}{c c c c c c c c c} \hline \hline \multirow{2}{*}{**Hue**} & \multicolumn{2}{c}{**Training**} & \multirow{2}{*}{**Polynomial Regression**} & \multirow{2}{*}{**Hue**} & \multicolumn{2}{c}{**Training**} & \multirow{2}{*}{**Polynomial Regression**} & \multirow{2}{*}{**Hue**} & \multicolumn{2}{c}{**Training**} & \multirow{2}{*}{**Polynomial Regression**} \\  & **Data [48]** & & & & **Data [48]** & & & **Data [48]** & & \\ \hline
0 & 610 & 613. The original wavelengths (in nm) for various vapour lamps are as follows: sodium (589), neon (588.2), copper (578.2), mercury (546.074), and helium (587.562) [22, 23, 24, 25, 26]. For sodium (Na), the predicted dominant wavelength is found to be 588.73231 nm, while the original value is 589 nm. This results in a very low error percentage of 0.04%, indicating a highly accurate prediction. Similarly, for neon (Ne), the predicted wavelength is 588.14 nm, slightly lower than the original value of 588.2 nm, resulting in an error percentage of only 0.01%. This demonstrates a high level of precision in predicting the dominant wavelength of neon vapour. \begin{table}
\begin{tabular}{c c c c} \hline \hline
**Vapour** & \begin{tabular}{c} **Predicted** \\ **Wavelength (nm)** \\ \end{tabular} & \
\begin{tabular}{c} **Original** \\ **Wavelength (nm)** \\ \end{tabular} &
\begin{tabular}{c} **Error Percentage** \\ **Error Percentage** \\ \end{tabular} \\ \hline Sodium & 588.73231 & 589 & 0.04\% \\ Neon & 588.14 & 588.2 & 0.01\% \\ Copper & 572.38412 & 578.2 & 1\% \\ Mercury & 566.5212 & 546.074 & 3.7\% \\ Helium & 587.97620 & 587.562 & 0.07\% \\ \hline \hline \end{tabular}
\end{table} 
Table 4: Predicted wavelength of different vapours. \begin{table}
\begin{tabular}{c c c c c c c c} \hline \hline
**Hue** & \begin{tabular}{c} **Training** \\ **Data [48]** \\ \end{tabular}  & **Polynomial Regression** & **Hue** & \ \begin{tabular}{c} **Training** \\ **Data [48]** \\ \end{tabular}  & **Polynomial Regression** & **Hue** &