# Neural Network-Based Analysis and Its Application to Spectroscopy for Mango
## 2 Equipment and Method
### Results and Discussion
#### 2.3.2 Establishing the Partial Least Squares Curve  
The instrument's model encompasses the training of multiple neural network layers involving 1000 training iterations, leveraging extensive data characteristics. Considering the presence of weak spectral information in some samples revealed by PLS analysis, the optimal model configuration is achieved with a selection of 12 principal factors exhibiting enhanced clustering efficiency for sugar levels. Consequently, the initial number of hidden layer units is assigned as 20. To address nonlinearities effectively, the tanh function is adopted as the activation function for the hidden layer. During model training, a challenge arises with the root-mean-square error (RMSE) curve demonstrating slow convergence. This issue is mitigated through adjustments in the epoch number after multiple dataset iterations through the network. Following network state initialization, single-step prediction is performed utilizing the neural network to update predicted values, thereby optimizing adaptation levels and enhancing curve adjustments. Key parameters of the BP neural network include a learning rate of 0.05, training duration set at 1000 epochs, and the adoption of RMSE as the error function [30]. Upon the completion of training, both the RMSE function and the loss function are minimized.  
A comparison of spectral curves post data preprocessing reveals the significant impact of various parameter combinations on the adjustment of R-square and RMSE values.  
\begin{table}
\begin{tabular}{c c c c c c} \hline \hline
**Point** & **Minimum** & **Maximum** & **Average** & **Standard** & **Coefficient** \\
**Positions** & **Minimum** & **Maximum** & **Average** & **Deviation** & **of Variation** \\ \hline
5-1 & 12.571 & 18.916 & 15.160 & 1.274 & 0.084 \\ \hline
5-2 & 11.635 & 20.125 & 15.948 & 2.534 & 0.158 \\ \hline
5-3 & 13.734 & 19.491 & 16.645 & 1.504 & 0.091 \\ \hline \hline \end{tabular}
\end{table}
Table 1: Overall statistical table of mango brix content data.  
Adjusted R-squared, often referred to as the model goodness-of-fit index, signifies the portion of variability in the dependent variable explained by the independent variable through regression. It essentially measures the equation's conformity to observed values. When employing a calibration set-to-training set ratio of 1:4, as per the Kennard-Stone algorithm, the adjusted R-squared and RMSE values are computed as 0.9055 and 0.2192, respectively. While the adjusted R-squared value nears unity in this scenario, the RMSE surpassing 0.1 signals inadequate model fitting and hints at overfitting tendencies, leading to local optimization issues, as demonstrated in Figure 8 [31]. Hence, this study employs a simulated annealing algorithm to optimize the model, in line with rigorous research principles [32].  
Figure 7: _Cont._  
In this study, the measured brix content value is utilized as the horizontal coordinate, and the residual difference between the predicted and measured values serves as the longitudinal coordinate, enabling the construction of the residual diagram, as illustrated in Figure 9. The analysis of the residual graph reveals a lack of systematic patterns and predictability in the differences between the prediction and measurement sets within this regression model. This observation indicates that the points in the residual graph adhere to the essential criteria for the model's validity ([PERSON] et al., 2016).