A water quality comprehensive evaluation method based on BP neural network
Patent Information
- Application Number
- CN202610791189.3
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2026-06-03
- Publication Date
- 2026-10-16
AI Technical Summary
S2、依据水体功能确定水体评价指标i及水体评价标准;
1、本发明综合评价能力突出,通过BP神经网络整合溶解氧DO、高锰酸盐指数CODMn、化学需氧量CODcr、氨氮NH3-N、总磷TP和总氮TN6项关键水质指标,充分挖掘多指标间的复杂关联,规避传统方法单一参数主导的弊端,更全面、精准地反映水质实际状态。
Smart Images

Figure CN122928082A_ABST
Abstract
Description
Technical Field
[0001] This invention relates to the field of water quality assessment technology, and in particular to a comprehensive water quality assessment method based on a BP neural network. Background Technology
[0002] With the increasing importance of water resource protection and management, water quality assessment has become a crucial link in ensuring water ecological security. Traditional water quality assessment methods, such as the single-factor index method and the Nemerow index method, while capable of evaluating water quality to a certain extent, also have significant shortcomings. The single-factor method relies on a single indicator to dominate the evaluation result, ignoring the coupling effect of multiple indicators and failing to comprehensively reflect the overall water quality status. The Nemerow index method has strong subjectivity in weight assignment and insufficient precision in responding to complex water quality fluctuations, making it difficult to accurately reflect the complex relationships and combined effects among multiple water quality indicators. In practical applications, traditional water quality assessment methods have limitations in accurately assessing water quality status and analyzing long-term stability. There is an urgent need for a water quality assessment technology that can comprehensively consider the influence of multiple indicators and improve the accuracy of the assessment. With the development of artificial intelligence technology, artificial neural networks have been widely used in the field of water quality assessment. Back Propagation (BP) artificial neural networks, as a type of multilayer feedforward neural network, possess excellent nonlinear mapping capabilities and self-learning abilities, enabling them to automatically learn the complex relationships between inputs and outputs from large amounts of data. Applying them to water quality assessment allows for the construction of suitable network models and the integration of various water quality index data, achieving an objective and comprehensive evaluation of water quality. However, existing water quality assessment systems based on BP neural networks still have shortcomings in terms of structural design, data processing procedures, and integration with traditional assessment methods, requiring further improvement and refinement. Therefore, this invention proposes a comprehensive water quality assessment method based on BP neural networks to address the problems existing in the current technology. Summary of the Invention
[0003] To address the aforementioned problems, this invention proposes a comprehensive water quality evaluation method based on a backpropagation (BP) neural network. This BP neural network-based comprehensive water quality evaluation method solves the problems of single parameter dependence and weight subjectivity in traditional evaluation methods. Through standardized preprocessing, optimized network structure, and comparison of multiple methods, it achieves efficient and accurate assessment of water quality levels.
[0004] To achieve the objectives of this invention, the invention is implemented through the following technical solution: a comprehensive water quality evaluation method based on a BP neural network, comprising the following steps: S1. Collect water samples; S2. Determine the water body evaluation index i and water body evaluation standards based on the water body function; S3, the water quality evaluation index Ci of the water sample is determined; S4. Establish a sufficient model training sample set; S5. Preprocess the water quality evaluation index Ci, including normalization, to eliminate the influence of dimensions. S6. Construct a 3-layer BP artificial neural network model and determine the input layer, hidden layer, and output layer; S7. Perform nonlinear transformation on the input data using an activation function to determine the transfer function of the model's output layer; S8. Determine the network training parameters, train the model using the backpropagation algorithm, adjust the network weights and thresholds, and achieve accurate evaluation of water quality categories. S9. Input water quality data and output water quality classification results, including Class I-V.
[0005] S10. Comparative evaluation of the same water body is conducted by combining the improved Nemerow index method, and the results of the two methods are cross-validated to ensure the reliability and objectivity of the evaluation results.
[0006] A further improvement is made in S2, where the water quality evaluation indicators include dissolved oxygen (DO) and permanganate index (COD). Mn Chemical oxygen demand (CODcr), ammonia nitrogen (NH3-N), total phosphorus (TP), and total nitrogen (TN).
[0007] A further improvement is made in S4, where, when establishing the training sample set, linear interpolation is performed using the linspace function with equal intervals and uniform distribution to expand the sample data to meet the sample size required for modeling, thereby enhancing the practicality and recognition effect of the BP neural network model.
[0008] A further improvement is made in S5, where the normalization process is as follows: For each evaluation factor data, a formula is used to normalize the data to the interval [-1, 1]. This normalization eliminates dimensional differences and converts the data into a format suitable for BP neural network input, thereby improving training efficiency and stability. The formula is as follows: X'i , In the formula: Xi is the value of the sample data before normalization; X'i is the value of the sample data after normalization; Xmax is the maximum value of the sample data; and Xmin is the minimum value of the sample data.
[0009] Further improvements are made in S6, where the number of input layer neurons in the 3-layer BP artificial neural network model depends on the number of selected water quality evaluation indicators, i.e., the number of input layer neurons is 6, and each cross-section requires a comprehensive evaluation result. The output layer has 1 neuron, and the number of hidden layer nodes is calculated using an empirical formula and repeatedly trained using a function. This results in a BP network with strong approximation ability to the function and small error. Considering both network performance and training speed, the network structure is optimized using the following empirical formula: N= , In the formula: m is the number of output layer neural units; n is the number of output layer neurons; a is an empirical integer, 1-10.
[0010] A further improvement is made in S7, where the activation function is the Sigmoid function, which performs a non-linear transformation on the input data to enhance the network's expressive power. The expression is as follows: f , Both the input layer and the hidden layer use this function, while the transfer function of the output layer uses a linear function to meet the output requirements of water quality evaluation results.
[0011] A further improvement is made in S8, where the model training process includes: taking the preprocessed water quality data as input and the corresponding water quality category as output, using the gradient descent algorithm for backpropagation of error, using the mean squared error mse as the loss function, setting the number of training iterations, the minimum training rate and the training error target, and iteratively adjusting the network parameters until the network output error meets the preset accuracy requirements.
[0012] The further improvement is that in S9, the water quality classification result will divide the output value in the range of [0,1], corresponding to the 5 levels of water quality, namely: Class I - [0,0.2]; Class II - (0.2,0.4]; Class III - (0.4,0.6]; Class IV - (0.6,0.8]; Class V - (0.8,1.0).
[0013] A further improvement is made in S10, where a database is accessed to store the results of each water quality assessment for subsequent data analysis and historical data query.
[0014] The beneficial effects of this invention are as follows: 1. This invention has outstanding comprehensive evaluation capabilities, integrating dissolved oxygen (DO) and permanganate index (COD) through a BP neural network. Mn The study uses six key water quality indicators, including chemical oxygen demand (CODcr), ammonia nitrogen (NH3-N), total phosphorus (TP), and total nitrogen (TN), to fully explore the complex relationships between multiple indicators and avoid the drawbacks of traditional methods that rely on a single parameter, thus providing a more comprehensive and accurate reflection of the actual water quality status.
[0015] 2. The preprocessing and model optimization of this invention are highly effective. It adopts interval symmetric normalization and rigorous data cleaning to improve data quality and model training stability. It scientifically determines the number of hidden layer nodes through empirical formulas and combines dynamic learning rate adjustment to accelerate model convergence. The evaluation accuracy is high and the computational efficiency is faster than traditional methods.
[0016] 3. The results of this invention have excellent reliability and comparability, supporting and improving the comparison of Nemerow index method results. The reliability of the evaluation results is enhanced through double verification. In practical applications, the classification dispersion is reduced, accurately presenting the distribution of water quality categories and providing multi-dimensional reference for decision-making. Attached Figure Description
[0017] Figure 1 This is a diagram of the topology of the 3-layer BP neural network of the present invention; Figure 2 This is a schematic diagram of the BP neural network model for water quality assessment in this invention; Figure 3 This is a schematic diagram of the process of the present invention. Detailed Implementation
[0018] To enhance understanding of the present invention, the present invention will be further described in detail below with reference to embodiments. These embodiments are only used to explain the present invention and do not constitute a limitation on the scope of protection of the present invention.
[0019] according to Figure 1 , 2 As shown in Figure 3, this embodiment proposes a comprehensive water quality evaluation method based on a BP neural network. The flowchart is shown below. Figure 3 As shown, the specific steps are as follows: Monitoring points were set up in accordance with the "Technical Specifications for Surface Water Monitoring" and water samples were taken twice a month.
[0020] Water quality evaluation indicators are determined based on the water body's function and water quality status, including dissolved oxygen (DO) and permanganate index (COD). Mn The water quality assessment indicators are: chemical oxygen demand (CODcr), ammonia nitrogen (NH3-N), total phosphorus (TP), and total nitrogen (TN). The boundary concentration values for each indicator are defined according to the "Surface Water Environmental Quality Standard" (GB3838-2002). The standard values for each water quality assessment indicator are shown in Table 1 below.
[0021] Table 1 Standard values of various water quality evaluation indicators
[0022] The concentrations of various water quality evaluation indicators were determined according to the basic item analysis methods in the "Surface Water Environmental Quality Standard" (GB3838-2002). The determination methods for each water quality evaluation indicator are shown in Table 2 below.
[0023] Table 2. Methods for determining water quality evaluation indicators
[0024] When establishing the training samples, the water quality categories I to V in the "National Surface Water Environmental Quality Standard" (GB3838-2002) were used as the evaluation criteria for the BP neural network. The water quality standard intervals were entered using Python 3.9, and linear interpolation was performed using the linspace function with equal intervals and uniform distribution. 100 sets of water quality data were generated for each water quality category, for a total of 500 sets of water quality data, to expand the sample data scale and meet the requirements of the model construction for the number of samples, thereby improving the practicality of the BP neural network model.
[0025] Different water quality monitoring indicators use different units of measurement, making direct comparison impossible. Therefore, these data with different units of measurement must be normalized before evaluation to improve training efficiency and stability. The normalization formula used is as follows: In the formula: Xi is the value of the sample data before normalization; X'i is the value of the sample data after normalization; Xmax is the maximum value of the sample data; Xmin is the minimum value of the sample data; and the output range of the sample data after normalization is [-1, 1].
[0026] The water quality indicators selected in this invention are dissolved oxygen (DO), permanganate index (CODMn), chemical oxygen demand (CODcr), ammonia nitrogen (NH3-N), total phosphorus (TP), and total nitrogen (TN). The number of input layer neurons depends on the number of selected water quality evaluation indicators, i.e., there are 6 input layer neurons. Only one comprehensive evaluation result is needed for each cross-section, and there is 1 output layer neuron.
[0027] In the construction of a BP neural network, the number of hidden layer nodes directly affects the network's training effect, generalization ability, and computational efficiency. The number of hidden layer neurons was calculated using an empirical formula (Equation 1). Simultaneously, a function was used for repeated training. After 3000 training iterations, comparison showed that a BP network with 4 hidden layer neurons had a stronger ability to approximate the function and a smaller error. Considering both network performance and training speed, the number of hidden layer neurons was set to 6. Therefore, the created BP neural network structure was 6×4×1. The BP neural network water quality evaluation model established during the research process is shown in Figure 2.
[0028] N= (1) In the formula: m is the number of neural units in the input layer, n is the number of neurons in the output layer, and a is an empirical integer.
[0029] The sigmoid function (Equation 2) is continuously differentiable and can transform input data in the range (-∞, +∞) to (0, 1), adjusting node weights during backpropagation when errors are favorable. This invention selects the sigmoid function as the activation function for both the input and hidden layers, and uses a linear function as the transfer function for the output layer.
[0030] (2) Determine the network training parameters and set the performance function to mean squared error (MSE). Set the number of training iterations to 3000, the minimum training rate to 0.001, and the training error to 0.001. Train the model using the backpropagation algorithm, adjust the network weights and thresholds, and achieve accurate evaluation of water quality categories.
[0031] The five standard categories of water quality standard values are divided into the numerical range of [0,1] to obtain the graded evaluation standards corresponding to the BP network output, as shown in Table 3.
[0032] Table 3 Standardized water quality grading standards corresponding to surface water levels
[0033] After normalizing the monthly water quality sample data from the sampling points, the data was input into a 6×4×1 backpropagation network model. The BP neural network model was used for network simulation calculations to evaluate the water quality, and the monthly water quality category values for each monitoring point were finally output, as shown in Table 4.
[0034] Table 4. Monthly water quality category values of two water samples from the sampling point, output by the evaluation network.
[0035] Based on the water quality level range, the monthly evaluation results of the two water samples at the monitoring point output by the BP neural network in Table 4 are classified into water quality levels, and then the corresponding comprehensive water quality evaluation results are obtained, as shown in Table 5.
[0036] Table 5. Water quality categories corresponding to two water samples from the sampling point after processing by a BP neural network.
[0037] This study combines the improved Nemerow index method with the BP neural network method to conduct a systematic comparative evaluation of the same water body. The BP neural network method, leveraging its unique nonlinear mapping advantage, can deeply uncover the complex coupling relationships hidden among water quality indicators. A consistency statistical analysis is performed on the water quality rating results of the two methods, and the differences between them in terms of indicator weighting logic and evaluation calculation process are analyzed in depth to trace the underlying mechanisms of these differences. Through a dual-method cross-validation mechanism, the potential limitations of a single evaluation method are effectively mitigated, resulting in a more comprehensive and accurate reflection of water quality status. This provides a scientific and reliable basis for decision-making in water resource protection and pollution control, and strongly supports the precise implementation of water quality management.
[0038] This water quality comprehensive evaluation method based on BP neural network has outstanding comprehensive evaluation capabilities, integrating dissolved oxygen (DO) and permanganate index (COD) through BP neural network. Mn This invention analyzes six key water quality indicators: chemical oxygen demand (CODcr), ammonia nitrogen (NH3-N), total phosphorus (TP), and total nitrogen (TN). It fully explores the complex relationships between these indicators, avoiding the drawbacks of traditional methods that rely on a single parameter, and provides a more comprehensive and accurate reflection of the actual water quality status. The preprocessing and model optimization of this invention are highly effective. Interval symmetric normalization and rigorous data cleaning improve data quality and model training stability. The number of hidden layer nodes is scientifically determined using empirical formulas, combined with dynamic learning rate adjustment, accelerating model convergence. The evaluation accuracy is high, and the computational efficiency is faster than traditional methods. The results of this invention exhibit excellent reliability and comparability. It supports and improves the comparison of results using the Nemerow index method. Double validation enhances the reliability of the evaluation results. In practical applications, classification dispersion is reduced, accurately presenting the distribution of water quality categories and providing multi-dimensional references for decision-making.
[0039] The foregoing has shown and described the basic principles, main features, and advantages of the present invention. Those skilled in the art should understand that the present invention is not limited to the above embodiments. The embodiments and descriptions in the specification are merely illustrative of the principles of the invention. Various changes and modifications can be made to the invention without departing from its spirit and scope, and all such changes and modifications fall within the scope of the present invention as claimed. The scope of protection of the present invention is defined by the appended claims and their equivalents.
Claims
1. A comprehensive water quality evaluation method based on a BP neural network, characterized in that, Includes the following steps: S1. Collect water samples; S2. Determine the water body evaluation index i and water body evaluation standards based on the water body function; S3, the water quality evaluation index Ci of the water sample is determined; S4. Establish a sufficient model training sample set; S5. Preprocess the water quality evaluation index Ci, including normalization, to eliminate the influence of dimensions. S6. Construct a 3-layer BP artificial neural network model and determine the input layer, hidden layer, and output layer; S7. Perform nonlinear transformation on the input data using an activation function to determine the transfer function of the model's output layer; S8. Determine the network training parameters, train the model using the backpropagation algorithm, adjust the network weights and thresholds, and achieve accurate evaluation of water quality categories. S9. Input water quality data and output water quality classification results, including Class I-V. S10. Comparative evaluation of the same water body is conducted by combining the improved Nemerow index method, and the results of the two methods are cross-validated to ensure the reliability and objectivity of the evaluation results.
2. The water quality comprehensive evaluation method based on BP neural network according to claim 1, characterized in that: In S2, the water quality evaluation indicators include dissolved oxygen (DO) and permanganate index (COD). Mn Chemical oxygen demand (CODcr), ammonia nitrogen (NH3-N), total phosphorus (TP), and total nitrogen (TN).
3. The water quality comprehensive evaluation method based on BP neural network according to claim 2, characterized in that: In step S4, when establishing the training sample set, linear interpolation is performed using the linspace function with equal intervals and uniform distribution to expand the sample data to meet the sample size required for modeling, thereby enhancing the practicality and recognition effect of the BP neural network model.
4. The water quality comprehensive evaluation method based on BP neural network according to claim 3, characterized in that: In step S5, the normalization process is as follows: For each evaluation factor data, the data is normalized to the interval [-1, 1] using a formula. Normalization eliminates dimensional differences and converts the data into a format suitable for BP neural network input, thereby improving training efficiency and stability. The formula is as follows: X'i , In the formula: Xi is the value of the sample data before normalization; X'i is the value of the sample data after normalization; Xmax is the maximum value of the sample data; and Xmin is the minimum value of the sample data.
5. The water quality comprehensive evaluation method based on BP neural network according to claim 4, characterized in that: In step S6, when constructing a 3-layer BP artificial neural network model, the number of neurons in the input layer depends on the number of selected water quality evaluation indicators, i.e., the number of neurons in the input layer is 6, and each cross-section requires a comprehensive evaluation result. The number of neurons in the output layer is 1, and the number of nodes in the hidden layer is calculated using an empirical formula. The network is then repeatedly trained using a function to ensure that the constructed BP network has a strong ability to approximate the function and a small error. Considering both network performance and training speed, the network structure is optimized using the following empirical formula: N= , In the formula: m is the number of output layer neural units; n is the number of output layer neurons; a is an empirical integer, 1-10.
6. The water quality comprehensive evaluation method based on BP neural network according to claim 5, characterized in that: In step S7, the activation function is the Sigmoid function, which performs a non-linear transformation on the input data to enhance the network's expressive power. The expression is: f , Both the input layer and the hidden layer use this function, while the transfer function of the output layer uses a linear function to meet the output requirements of water quality evaluation results.
7. The water quality comprehensive evaluation method based on BP neural network according to claim 6, characterized in that: In S8, the training process of the model includes: taking the preprocessed water quality data as input and the corresponding water quality category as output, using the gradient descent algorithm for backpropagation of error, using the mean squared error mse as the loss function, setting the number of training iterations, the minimum training rate and the training error target, and iteratively adjusting the network parameters until the network output error meets the preset accuracy requirements.
8. The water quality comprehensive evaluation method based on BP neural network according to claim 7, characterized in that: In S9, the water quality classification results will divide the output value in the range of [0,1], corresponding to 5 levels of water quality: Class I - [0,0.2]; Class II - (0.2,0.4]; Class III - (0.4,0.6]; Class IV - (0.6,0.8]; Class V - (0.8,1.0).
9. The water quality comprehensive evaluation method based on BP neural network according to claim 8, characterized in that: In step S10, the database is accessed, and the results of each water quality assessment are stored in the database for subsequent data analysis and historical data query.