Application of neural network adaptive filter method to simultaneous detection of polymetallic ions based on ultraviolet-visible spectroscopy

A novel neural network adaptive filter algorithm is proposed to address the challenge of weak spectral signals and low accuracy in micro-spectrometer detection. This algorithm bases on error backpropagation (BP) and least mean square (LMS), introduces an innovative BP neural network model incorporating instantaneous error function and error factor to optimize the learning process. It establishes a network relationship through the input signal, output signal, error and step factor of the adaptive filter, and defines a training optimization learning method for this relationship. To validate the effectiveness of the algorithm, experiments were conducted on simulated noisy signals and actual spectral signals. Results show that the algorithm effectively denoises signals, reduces noise interference, and enhances signal quality, the SNR of the proposed algorithm is 3–4 dB higher than that of the traditional algorithm. The experimental spectral results showed that the proposed neural network adaptive filter algorithm combined with partial least squares regression is suitable for simultaneous detection of copper and cobalt based on ultraviolet-visible spectroscopy, and has broad application prospects.

noise and interference from the base zinc ions (Jin et al., 2024;Zhang D. Y. et al., 2021;Liu et al., 2017;Zou et al., 2018).These factors lead to weak spectral signals and poor accuracy, severely affecting the precision of spectral detection.
In actual detection, noise is ubiquitous, encompassing highfrequency noise, low-frequency noise, white noise, and various other types of noise signals.To mitigate the impact of these noise signals, they need to be removed (Zhou et al., 2019;Ford et al., 2018;Huang and Chen, 2021;Li and Zhao, 2023).Signal enhancement algorithms are mainly aimed at processing signals where the signal-to-noise ratio is low due to strong noise interference (Lee et al., 2015).How to reduce noise in signals has always been a focal research topic in signal processing.Presently, commonly used signal enhancement algorithms both domestically and internationally include wavelet signal enhancement algorithms, Savitzky-Golay denoising enhancement algorithms, and LMS algorithms (Chu et al., 2021;Huang et al., 2020).The LMS algorithm, due to its low computational complexity, rapid convergence and high stability, has been widely applied worldwide.However, through research on the LMS algorithm, it is found that it inherently has some flaws.For instance, the conventional LMS algorithm has a relatively slow convergence speed and requires a longer denoising time (Sibtain et al., 2022).Therefore, it is necessary to improve the convergence speed and make the algorithm stable in a shorter time.It is clear that while traditional methods provide accuracy, they lack real-time capability and efficiency.Advanced spectroscopic techniques offer speed and integration but are hindered by noise and interference issues.Existing signal enhancement algorithms each have their strengths and weaknesses, with the LMS algorithm being notable for its balance of simplicity and performance despite its slower convergence.
In this paper, a neural network adaptive filtering algorithm (NNAF) based on BP (backpropagation) and LMS (Least Mean Square) is studied to improve the accuracy and real-time performance of online detection of impurity metal ion concentration (Zhang and So, 2020;Liu et al., 2015;Zhang and Luo, 2023;Zheng et al., 2020;Shi et al., 2021).As a widely used learning mechanism in neural network, BP algorithm adjusts the weight by calculating the output error and propagating it back to the network (Mancini et al., 2021).LMS algorithm is an adaptive filtering algorithm based on gradient descent principle, which has good convergence and robustness.The proposed neural network adaptive filtering algorithm integrates adaptive filtering and neural network error compensation (LeCun et al., 2015;Zhang C. et al., 2021;Huang et al., 2023).It adopts a new BP neural network model, combining instantaneous error function and error factor to improve the learning process.The network relationship is established through the input signal, output signal, error and step factor of the adaptive filter, and the training optimization method suitable for this relationship is determined.The experimental results show that the neural network adaptive filtering algorithm (NNAF) shows superior denoising ability, effectively reduces noise interference and improves signal quality.

NNAF adaptive denoising algorithm 2.1 NNAF algorithm
The LMS algorithm is an adaptive filtering method, extensively employed in the realm of signal processing and noise reduction.Despite its broad application, its convergence rate remains relatively slow.The schematic of the LMS principle is depicted in Figure 1.The backpropagation (BP) algorithm is an optimization method used within neural networks.It operates by calculating output errors and backpropagating them through the network for weight adjustment.The structure of the BP is illustrated in Figure 2. The BP algorithm boasts significant competence in addressing non-linear and intricate issues.However, during the early phases of training, weight adjustments might render the network's output exceedingly sensitive.Noise at the inception can propagate throughout the entire network, resulting in unstable training outcomes.Therefore, by amalgamating the BP and LMS algorithms, a neural network adaptive filter method (NNAF) is proposed.
The NNAF algorithm leverages the noise reduction benefits of the LMS algorithm and the BP algorithm's strength in optimizing complex non-linear problems, incorporating a new BP neural network model.During the backpropagation process, instantaneous error functions and error factors are introduced to optimize the learning procedure.The network relationship is established using the adaptive filter's input signal, output signal, error, and step factor, and an optimized training procedure tailored to this relationship is identified.This algorithm successfully combines adaptive filtering with neural network error compensation.Through this approach, the NNAF algorithm effectively minimizes noise interference and enhances signal quality.

Implementation of the NNAF algorithm
The implementation of the NNAF adaptive denoising algorithm is primarily an efficient and intertwined process.This procedure integrates the strategies of LMS filtering and BP optimization, fully harnessing the strengths of both to enhance denoising performance.The schematic of this algorithm is depicted in Figure 3.
Where x(i) and e(i) are the input signals for the BP neural network, and u is the output of the neural network training results.The NNAF algorithm establishes a learning network structure, seeking the optimal learning step factor u through the error e(n) and input signal d(n).By learning from given sample data, it establishes a real-time data correlation model.The rules for updating the parameters of the NNAF algorithm are Equation 1, Equation 2 and Equation 3.
To ensure the convergence of the neural network algorithm, β must satisfy β < n λmax (where λ max is the maximum eigenvalue and is positive).Using u min ensures that u is still influenced by the changes in the output signal and error.In practical applications, u max and u min can be determined experimentally.To speed up convergence, instantaneous error function y and error factor ee proposed by this algorithm are shown in Equation 4 and Equation 5.
In Equation 4, the steepness of the Sigmoid function is directly determined by parameter a, which is inversely related to the speed at which the function curve rises.b characterizes the range of values of the dependent variable in the Sigmoid function, determining the height of the curve.ee e x| r − 1 ( 5 ) In Equation 5, ee represents the error factor, and r represents the rate of exponential growth.It can also be understood as the rate at which the correction factor is adjusted.The larger r is, the greater the instantaneous error, and the greater the correction to the step factor.At this time, the step factor at the initial moment is larger, which further updates the required weight vector value.Through experimental simulation, the optimal value of parameter a is 5, and the optimal value of parameter r is 6., as shown in Equation 6: The NNAF algorithm optimizes the learning process by incorporating an instantaneous error function y and error factor ee.It uses the input signal x(n), output signal y(n), error e(n), and step factor u of the adaptive filter to establish a network relationship and determines the training optimization learning steps for this relationship.The flowchart of the NNAF algorithm is shown in Figure 4. First, initialize the step vector u and process the input signal x(n) with LMS filtering.Then, the error e(n) between the target output and the filter output is backpropagated to BP.By calculating the gradient of the error and then updating the step factor in the negative direction of the gradient, the output of the filter becomes closer to the expected output.This also further reduces the error, achieving global optimization.Finally, the LMS algorithm and BP algorithm interactively feedback.When the error signal e(n) is less than 10 −4 , the iteration ends, and the filtered signal is output.

Simulated data
The simulation data is used to select the adaptive step factor of the neural network adaptive filter algorithm (NNAF) and verify the denoising performance.The pure signal uses sine wave signal provided by MATLAB software, and then adds noise with signalto-noise ratio (SNR) of 15 dB.The original signal and noisy signal are shown in Figure 5.

Experimental spectral signal
Add the standard solution of copper, cobalt and zinc, 7.5 ml of acetic acid-sodium acetate solution and 5.00 ml of nitroso R salt solution in turn into a 25 ml calibration flask and dilute with distilled water.Shake well to complete the reaction of the elements to be detected, and prepare a blank reagent reference in the same way.The solution to be tested and the reference solution were placed in a 1 cm cuvette and measured by the Optosky ATP2000 spectrophotometer in the wavelength range of 200-1,100 nm.The final concentration ranges were 0.5-5 mg/L for copper, and 0.3-3 mg/L for cobalt.All measured spectra were the average of 5 replicates.Frontiers in Chemistry frontiersin.org03 Wu and Zhou 10.3389/fchem.2024.1409527 4 Results and discussion

Comparison of convergence performance
In order to verify the effectiveness of NNAF algorithm, the performance of NNAF algorithm is compared with other commonly used algorithms.The comparison of the convergence error performance of the three algorithms is shown in Figure 5.The input signal is a noisy sine wave, and the simulation parameters are set as follows.
1) The order L of the filter is set 10.The initial weight w(n) of the adaptive filter is defined as 0, and added noise v(n) is a zero-mean independent Gaussian random sequence with a variance of 0.04.2) For the fixed-step LMS algorithm, its learning step factor u is a small positive number, step factor u set to 0.008.For the variable step-size algorithm, its step size is variable.u max and u min are 0.009, 0.0006 in the algorithm respectively.3) Average statistical time is 20, and the sample size is 1,000.The greed algorithm is used in the NNAF model to find training samples, with some data shown in Table 1.4) A BP model is established, which includes an input vector with 10 components (assuming the input signal of the adaptive filter is 12 and the deviation is 2) and 25 hidden units.The model is Flowchart of the NNAF algorithm.
Frontiers in Chemistry frontiersin.org04 Wu and Zhou 10.3389/fchem.2024.1409527trained through the neural network to scan the output results, thereby generating the optimal step size factor u.
It can be observed from Figure 6 that the NNAF algorithm allows the adaptive filter to achieve higher convergence speed compared with the other three algorithms.

Noise elimination of simulation data
The denoising effect of NNAF method was compared with that of other denoising methods.The comparison of denoising effects using different methods is shown in Figure 7.In Figure 7A, the denoised signal using fixed step LMS method retained a lot of noise, Error convergence curve diagram.
and the denoising effect was obviously poor.In Figure 7B, the denoised signal using variable step LMS method was relatively smooth, but the denoising effect at the beginning is not good.In Figure 7C, the denoised signal using the proposed NNAF method is smooth and retains the peak characteristics, which is in good agreement with the original signal, so it has good denoising performance.
In order to further verify the performance of the proposed NNAF method, different signal-to-noise ratios are added to the original signal.The signal-to-noise ratio (SNR) and root mean square error (RMSE) of denoised signals obtained by different methods are shown in Table 2. Compared with other methods, the denoised signal using NNAF method has the highest SNR and the smallest RMSE under different signal-to-noise ratios.Therefore, the simulation results strongly show that the proposed NNAF algorithm achieves superior denoising performance, which verifies its theoretical feasibility.

Spectral processing
The proposed NNAF method was applied to the experimental ultraviolet-visible spectral signal.Figure 8A shows absorption spectra of copper (Cu) in the wavelength range of 200-1,100 nm, where the concentration of copper ranged from 0.5 to 6.0 mg/L.Figure 8B shows absorption spectra of cobalt (Co), where the concentration of cobalt ranged from 0.3 to 3.0 mg/L.As can be seen from Figure 8, the spectral signals of copper and cobalt are seriously disturbed by noise.The maximum absorbance of copper and cobalt are at the wavelengths of 484.66 nm and 503.47 nm, respectively.In order to evaluate the linearity, the calibration curves of copper and cobalt at the maximum absorbance were constructed.As can be seen from Figures 8C, D, the linearity of copper and cobalt is poor.The linear equation and linear coefficient of copper is: Abs = 0.1359 C Cu + 0.0061 (R2 = 0.9908).The linear equation and linear coefficient of cobalt is Abs = 0.1834 C Co + 0.5801 (R2 = 0.9926).Therefore, it is necessary to denoise the experimental spectrum and improve the detection accuracy.
The Optosky ATP2000 micro spectrometer has the advantages of intelligence, miniaturization, modularization and fast detection speed, but it adopts single beam structure and CCD detector, which leads to noise affecting the detection performance of spectrometer.Therefore, the spectral signal is disturbed by noise, the accuracy of simultaneous detection of copper and cobalt will be seriously affected if the spectral data is directly modeled without denoising pretreatment.The proposed NNAF method is used to process spectral signal and eliminate highfrequency and low-frequency noise.Figure 9A shows the denoising signal of copper.Figure 9B shows the denoising signal of cobalt.As can be seen from Figures 9A, B, the denoised signals of copper and

Simultaneous detection of copper and cobalt
In order to evaluate the performance of NNAF algorithm in experimental spectrum processing, we prepared 10 groups of mixed solutions containing different proportions of copper and cobalt, in which the zinc concentration was fixed at 20 g/L for reference.PLS (partial least square method) and NNAF-PLS (neural network adaptive filter algorithm combined with partial least square method) were used to simultaneously detect copper and cobalt.The root mean square error of prediction values (RMSEP) and average relative deviation (ARD) are used as evaluation indexes, and the predicted concentrations of cop-per and cobalt are shown in Table 3.It can be concluded from Table 3 that the prediction performance of NNAF-PLS method is far superior to that of PLS method.Using NNAF-PLS method to detect copper and cobalt simultaneously, the RMSEP for copper and cobalt were 0.104 and 0.048, respectively; the ARD of copper and cobalt were 3.342% and 2.521%, respectively, which meets industrial production indicators.
Figure 10 shows the calibration curve between the predicted value and the actual value of copper and cobalt.From Figure 10, it  Frontiers in Chemistry frontiersin.org08 Wu and Zhou 10.3389/fchem.2024.1409527can be seen that the predicted values and the actual values of copper and cobalt are almost the same, and the correlation coefficient (R 2 ) of copper is 0.9975 and that of cobalt is 0.9987.The experimental results show that this proposed NNAF method is suitable for on-line detection of copper and cobalt in zinc hydro-metallurgy, and has broad application prospects.

Conclusion
This paper presents a neural network adaptive filter algorithm (NNAF) based on error backpropagation (BP) and the least mean square (LMS).Through in-depth research and experimental processing of actual signals, we found that this algorithm can effectively reduce noise interference and improve signal quality, showing great potential for application.The algorithm fully leverages the advantages of both BP and LMS.It not only utilizes BP's efficacy in error backpropagation but also incorporates the denoising characteristics of LMS, further enhancing the performance of the denoising algorithm.The experimental spectral results showed that the proposed neural network adaptive filter algorithm (NNAF) combined with partial least squares regression is suitable for simultaneous detection of copper and cobalt based on ultraviolet-visible spectroscopy.The work in this paper is an effective attempt to detect polymetallic ions online in the process of zinc hydrometallurgy, and the proposed neural network adaptive filter method is also suitable for other spectral signals, such as infrared spectra, Raman spectra, and more.

FIGURE 3
FIGURE 3Schematic diagram of the NNAF algorithm.

FIGURE 5
FIGURE 5 Simulated original signal and noisy signal.(A) Original signal.(B) Noisy signal.

FIGURE 7
FIGURE 7 Comparison of denoising effects using different methods.(A) Fixed step LMS algorithm.(B) Variable step LMS algorithm.(C) NNAF algorithm.
show the calibration curves of the denoised copper and cobalt signals at the maximum absorbance.The correlation coefficients of Cu and Co are 0.9952 and 0.9967, respectively.The results show that the proposed NNAF method significantly improves the linear relationship between copper and cobalt, which is beneficial to improve the accuracy of simultaneous detection of copper and cobalt.

FIGURE 8
FIGURE 8 Acquisition of spectral signal.(A) Absorbance spectra of Cu. (B) Absorbance spectra of Co. (C) Calibration curves of copper.(D) Calibration curves of cobalt.

FIGURE 9
FIGURE 9 Spectral processed signal using NNAF method.(A) Absorbance spectra of Cu. (B) Absorbance spectra of Co. (C) Calibration curves of copper.(D) Calibration curves of cobalt.

FIGURE 10 Predicted
FIGURE 10 Predicted and actual values of copper and cobalt.(A) Copper.(B) Cobalt.

TABLE 2
The calculation results of the denoised signal by different methods.
cobalt are smooth, and the signal shape is consistent with the expectation.In order to evaluate the performance of NNAF method, Figures9C, D

TABLE 3
The predicted results of copper and cobalt by PLS and NNAF-PLS methods.