Analysis of Ammonia Nitrogen Content in Water Based on Weighted Least Squares Support Vector Machine (WLSSVM) Algorithm ()

Jinwu Ju^{}, Lanying Wang^{}

School of Computer Science of Sichuan University of Science and Engineering, Zigong, China.

**DOI: **10.4236/jsea.2016.92002
PDF
HTML XML
4,173
Downloads
4,896
Views
Citations

School of Computer Science of Sichuan University of Science and Engineering, Zigong, China.

Determination of ammonia nitrogen content in water is the basic item of the environmental water pollution, and is the key index to evaluate the water quality. This article designs a water quality monitoring system based on the on-line automatic ammonia nitrogen monitoring system, and establishes a forecasting model based on the weighted least squares support vector machine algorithm. The weighted least squares support vector machine algorithm increases the weight parameter setting, improves the speed and accuracy of prediction learning, and improves the robustness. In this article, a comparison between neural network model and weighted least square support vector machine model is made, which shows that the weighted least squares support vector machine model has better prediction accuracy.

Share and Cite:

Ju, J. and Wang, L. (2016) Analysis of Ammonia Nitrogen Content in Water Based on Weighted Least Squares Support Vector Machine (WLSSVM) Algorithm. *Journal of Software Engineering and Applications*, **9**, 45-51. doi: 10.4236/jsea.2016.92002.

Received 6 January 2016; accepted 15 February 2016; published 18 February 2016

1. Introduction

With the rapid development of social economy, water pollution has become an important environmental monitoring content. The determination of ammonia nitrogen content in water quality is the basic item of water quality monitoring, and is the key index to evaluate water quality. At present, the method of on-line water quality and ammonia nitrogen content determination system [1] is often used in electrochemical method or the method of spectro photometry. Electrochemical method is based on the electrode sensor, the determination of the size of the ammonia sensor electrode, the indirect determination of ammonia nitrogen content. Nessler’s points spectro photometric method based on light chromaticity determination, mercuric iodide and potassium iodide solution will react with ammonia and will generate red brown compound, chroma and water content of ammonia and nitrogen in a proportional relationship. The main disadvantage of electrochemical detection is that it is easy to interfere with the concentration of ions in water samples, and in the long run, the sensor can easily be contaminated, and the sensitivity of the sensor is obviously decreased. The disadvantages of the method of spectro photometry [2] are that the reagent cost is relatively high, the determination time is long, the determination data are small, and the determination process is easy to be influenced by the environmental changes and other factors.

The frequently used method to solve the data reliability is to establish a data prediction model. Neural network [3] [4] , support vector machine [5] and other forecasting methods can be used to establish data prediction model, but the neural network requires a large number of training sample data, not suitable for the determination of ammonia nitrogen content analysis. Support vector machine is less than the sample data required, suitable for the establishment of data prediction model. Least squares support vector machine (LS-SVM) is the improvement of basic support vector machine (SVM), which can solve the problem of its generalization ability, and it has a better prediction data bias, which has better prediction learning speed, but its prediction robustness is obviously decreased. Weighted least squares support vector machine (WLS-SVM) [6] based on the standard least squares support vector machine based on the increase of weight components, can get good results and improve the robustness of the algorithm.

This article aims to design the on-line automatic ammonia nitrogen monitoring system. The accuracy of the data fluctuates during measurement of ammonia nitrogen content by spectro-photometry. The weighted least squares support vector machine (WLS-SVM) is applied to the analysis of ammonia nitrogen content, and the model is established to improve the accuracy of the data.

2. Algorithm Principle

Support vector machine is proposed by Vapnik et al. This algorithm is based on the learning theory of limited sample, which is followed by the principle of structural risk minimization. The disadvantage of standard support vector machine is that it is relatively large in the prediction of abnormal data. The least squares support vector machine is based on the standard support vector machine, which is proposed by Suykens [7] et al. By changing the constraint condition and risk function of SVM, it can be used to improve the shortcomings of standard SVM, but its robustness is reduced. Weighted least squares support vector machine can improve the robustness of the least square support vector machine by adding weights to the error components.

2.1. Support Vector Machine Theory

The training set D with a given sample number is N, and D region is expressed as:, in which x is the input data, y is the output data. Using a nonlinear mapping, the sample data from the

original space to high dimensional feature space is mapped. In this space,

the optimal decision function is constructed:, the parameters & b are to be determined, is weight vector, b is threshold value.

The objective optimization function of support vector machine is:

(1)

The error component in above objective optimization function is,; the parameter C is regularization parameter and can be used to balance error and complexity.

2.2. Weighted Least Square Support Vector Machine Theory

The objective optimization function of least squares support vector machine is based on the principle of different structural risk selected.

(2)

In order to improve the robustness of the least squares support vector machine algorithm, on the basis of the above optimization function, weights are added [8] [9] . Lagrange method is used to solve the above optimization function,

(3)

In above function, is the multiplier, solving partial derivative, , , ,

Setting it to zero, the optimization problem can be converted into linear equation as follows:

(4)

Setting Ω is N × N symmetric matrices, such as (5) formula:

(5)

Defined kernel function, conform to (6) formula Mercer condition.

(6)

Obtained the model of weighted least squares support vector machine is:

(7)

The selected of kernel function can be constructed by different support vector machine, and the radial basis function (RBF) has the characteristics of fast learning speed, and its formula is (8).

(8)

The regularization parameter C and kernel width parameter σ are two adjustable parameters of the algorithm, and their values are determined by the generalization performance and learning ability of the algorithm.

We can use the search method to choose the parameters, and then use the cross validation method to find the optimal parameters of the objective function to find the best parameters.

3. Water Quality Online Automatic Ammonia Nitrogen Monitoring System

Water quality online automatic ammonia nitrogen monitoring system, based on the method of nano-determina- tion of ammonia nitrogen content of the measurement, the overall structure of the system is shown in Figure 1. The system is shown in Figure 2. The system is composed of industrial computer, PLC controller, LCD touch screen, spectro-photometer, reactor, metering device, injection pump, multi solenoid valve and all kinds of reagent. Through LCD touch screen display software interface, through the PLC controller, on the other hand, the measurement of the reactive color data of the reactor is used to calculate the content of ammonia nitrogen. The basic working process is as follows:

Figure 1. Overall structure system diagram.

Figure 2. Overall structure of the system.

A) Control of multi pass solenoid valve, access to water samples, drive the injection pump, pump the water samples into the metering device.

B) Once achieve the specified capacity of the metering device, switch to the solenoid valve, pump the water sample from the metering device into the reactor.

C) Switch the multi pass solenoid valve, the masking agent is pumped into the metering device, to achieve the specified capacity, pumping into the reactor.

D) Switch to the solenoid valve, the nano’s reagent is pumped into the metering device, to achieve the specified capacity, pumped into the reactor.

E) Standing 10 minutes, then measure the output of the spectrophotometer, and get the intensity of the measurement.

F) Switch to the solenoid valve, the reactor solution to the liquid bottle.

G) Switch to the solenoid valve, the distilled water is pumped into the metering device, to achieve the specified capacity, pumping into the reactor. Again, the output of the spectrophotometer is measured, and the reference intensity is obtained.

H) After the completion of the reactor, and then the waste water is pumped into the waste liquid bottle. Complete the whole measurement process.

4. Measurement Results and Analysis of the Monitoring System

Water quality monitoring system of on-line automatic ammonia nitrogen, based on the measurement data to calculate the final ammonia nitrogen content, and its input data for measuring the zero point of light intensity, reference intensity and measuring intensity, select the 40 groups of ammonia nitrogen standard solution, its ammonia nitrogen content from 0 mg/L, with 0.25 mg/L increments, until 10 mg/L. A set of measurement results of the monitoring system is used as sample data, the total sample data are 40, the first 20 are training samples, and the 20 is the test sample, and the training sample data are shown in Table 1. Neural network model and WLS-SVM model were used to predict and analyze the experimental results. The experimental results are shown in Table 2.

Table 1. Training sample data sheet.

Table 2. Analysis of the experimental results data sheet.

Figure 3. Comparison of the forecast data with actual measurement results.

Using the neural network model and WLS-SVM model to analyze and forecast the ammonia nitrogen content, the monitoring system of the actual measurement results and the two groups of forecasting data, as shown in Figure 3. According to Table 2, based on neural network model, the maximum relative error is 12.66%, the average relative error is 5.47%. Based on WLS-SVM model, the average relative error is 2.87%, the average relative error is 1.25%, and the accuracy of WLS-SVM model is significantly higher.

5. Conclusion

This article introduces that during on-line monitoring system on the water quality, the WLS-SVM model is applied to the analysis and prediction of ammonia nitrogen content measurement data. The forecast results compared with the actual results show that the WLS-SVM model is a very effective forecasting model, which can be applied to the actual data analysis and forecasting. WLS-SVM model only needs two changeable model parameters, the regularization parameter C and kernel width parameter, which can be used cross validation method to determine the parameters of the model. The model has a fast convergence speed, high forecast accuracy and wide application prospect.

Foundation Item

Sichuan University of Science and Engineering Incubation Project (2012PY12), Artificial Intelligence Key Laboratory Project of Sichuan Province (2013RZY03), Enterprise Informatization and the Internet of Things Measurement and Control Technology Key Laboratory Project (2013WZY04, 2014WYY01), Luzhou Lao Jiao scholarship (15LJZK04).

Conflicts of Interest

The authors declare no conflicts of interest.

[1] | Ma, S.Q. and Liang, B. (2015) The Study on the Method of Using Automatic Analyzer to Detect the Ammonia of Water. Shandong Chemical Industry, No. 44, 62-64. |

[2] | Yu, J.M. (2013) Research on the Factors Affecting the Determination of Ammonia Nitrogen. Jiangxi Chemical Industry, No. 4, 11-14 |

[3] | Tong, M.M., Zhang, Y. and Qi, M.X. (2006) The Mixed Inflammable Gas Analysis Based on BP Neural Network. Acta Metrologica Sinica, 27, 169-171. |

[4] | Hou, D.B., Chen, Y., Zhao, H.F., et al. (2013) Water quality anomaly detection method based on RBF neural network and wavelet analysis. Transducer and Microsystem Technology, 32, 138-141. |

[5] | Huang, M. and Cheng, X.P. (2008) Real-Time Tracking on Athletes Based on Support Vector Regression Particle Filter. Journal of Southwest Agricultural University (Natural Science), 30, 165-169. |

[6] | Zeng, Y., Cheng, X.W., Wang, H.Q., et al. (2014) On Analysis of Sewer Combustible Gas Based on Weighted LS-SVM. Journal of Southwest China Normal University (Natural Science), 39, 94-99. |

[7] |
Suykens, J.A.K. and Vandewalle, J. (1999) Least Squares Support Vector Machine Classifiers. Neural Processing Letters, 9, 293-300. http://dx.doi.org/10.1023/A:1018628609742 |

[8] |
Wen, W., Hao, Z. and Yang, X. (2008) A Heuristic Weight-Setting Strategy and Iteratively Updating Algorithm for Weighted Least Squares Support Vector Regression. Neurocomputing, 71, 3096-3103. http://dx.doi.org/10.1016/j.neucom.2008.04.022 |

[9] |
Suykens, J.A.K. and Vandewalle, J. (2000) Recurrent Least Squares Support Vector Machines. IEEE Transactions on Circuits and System—I, 47, 1109-1114. http://dx.doi.org/10.1109/81.855471 |

Journals Menu

Contact us

+1 323-425-8868 | |

customer@scirp.org | |

+86 18163351462(WhatsApp) | |

1655362766 | |

Paper Publishing WeChat |

Copyright © 2023 by authors and Scientific Research Publishing Inc.

This work and the related PDF file are licensed under a Creative Commons Attribution 4.0 International License.