A complex water quality parameter prediction method and system based on deep learning

By improving the DBSCAN algorithm and deep learning technology, the core tensors and local feature sequences of water quality parameters are extracted and the adaptive scale of gated circulation units is calculated, which solves the problem that traditional water quality parameter prediction methods are difficult to deal with the coupling association of multiple water quality parameters, and achieves more accurate and reliable water quality parameter prediction.

CN119599224BActive Publication Date: 2025-04-04HUNAN YI KANG ENVIRONMENTAL PROTECTION TECHCO
View PDF 2 Cites 0 Cited by

Patent Information

Application Number
CN202510157193.X
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2025-02-13
Publication Date
2025-04-04
Estimated Expiration
2045-02-13

AI Technical Summary

Technical Problem

Traditional water quality parameter prediction methods are difficult to cope with the coupling association of multiple water quality parameter types, resulting in poor prediction results.

Method used

Using a complex water quality parameter prediction method based on deep learning, water quality parameter prediction is carried out by improving the DBSCAN algorithm, extracting core tensors and local feature sequences, and calculating the adaptive scale of the gated cycle unit and the multi-scale water quality parameter characteristics.

Benefits of technology

It improves the accuracy and reliability of water quality parameter prediction, can better deal with changes in complex water quality parameters, and provides prediction uncertainty evaluation results.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN119599224B_ABST
    Figure CN119599224B_ABST
Patent Text Reader

Abstract

This invention discloses a method and system for predicting complex water quality parameters based on deep learning, comprising: S1: collecting raw water quality parameter data and preprocessing it to obtain preprocessed water quality parameter data; S2: extracting water quality parameter data point clusters from the preprocessed water quality parameter data using an improved DBSCAN algorithm; S3: extracting feature fusion vectors and combining them with the water quality parameter data point clusters to extract coupled feature vectors; S4: calculating the adaptive scale and multi-scale water quality parameter features of the gated recurrent unit, and then performing water quality parameter prediction; S5: adding Gaussian noise to the preprocessed water quality parameter data and performing simulation calculations, and then calculating the confidence intervals for predicted pH values, predicted ammonia nitrogen concentrations, and predicted chemical oxygen demand based on the simulation results. This invention can solve the problem that traditional water quality parameter prediction methods are unable to cope with the poor prediction results caused by the coupling and correlation of multiple water quality parameter types.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present invention relates to the technical field of water quality monitoring, and in particular to a method and system for predicting complex water quality parameters based on deep learning. Background Art

[0002] Water quality parameter prediction is an estimation of the future trend of various physical and chemical indicators in water bodies, which is very important for water resources management, environmental protection and other fields. However, water quality parameter monitoring has the characteristics of mutual coupling and high correlation among various parameters, which makes accurate prediction challenging. Traditional methods such as physical model method, statistical regression method and machine learning perform well in the scenario of single water quality parameter prediction, but they are powerless when dealing with complex water quality parameters. The physical model method is based on the principle of water quality change, but the calculation is complex and time-consuming; the statistical regression method is simple and easy, but it is difficult to deal with nonlinear and non-stationary water quality changes; traditional machine learning algorithms have shortcomings in dealing with high-dimensional and complex coupled water quality parameters, and often overfitting or underfitting occurs, resulting in poor prediction accuracy. Therefore, a new technical method is urgently needed to more accurately predict the trend of water quality parameters and provide strong support for water resources management and environmental protection. Summary of the invention

[0003] In view of this, the present invention aims to provide a complex water quality parameter prediction method and system based on deep learning, so as to solve the problem that traditional water quality parameter prediction methods are difficult to cope with the poor prediction effect caused by the coupling association of multiple water quality parameter types.

[0004] A complex water quality parameter prediction method based on deep learning, including:

[0005] S1: Collecting original water quality parameter data and preprocessing it to obtain preprocessed water quality parameter data; the preprocessed water quality parameter data includes pH value time series data, ammonia nitrogen concentration time series data and chemical oxygen demand time series data;

[0006] S2: Improve the traditional DBSCAN algorithm by calculating the adaptive neighborhood radius, the minimum number of samples, and the neighborhood distance between each data point; use the improved DBSCAN algorithm to extract water quality parameter data point clusters from the preprocessed water quality parameter data, including:

[0007] Firstly, based on the traditional DBSCAN algorithm, the adaptive neighborhood radius and the minimum number of samples are calculated by combining the multi-layer perceptron and the sigmoid function;

[0008] Secondly, the time dimension weight is introduced to calculate the neighborhood distance between data points, and the traditional DBSCAN algorithm is improved to obtain the improved DBSCAN algorithm;

[0009] Finally, the water quality parameter data point clusters were calculated based on the improved DBSCAN algorithm;

[0010] S3: Extract the core tensor, the local feature sequence of pH value, the local feature sequence of ammonia nitrogen concentration and the local feature sequence of chemical oxygen demand according to the pre-processed water quality parameter data and the water quality parameter data point clusters; then extract the feature fusion vector; finally, combine the water quality parameter data point clusters to extract the coupling feature vector;

[0011] S4: According to the coupling characteristic vector, the local characteristic sequence of pH value, the local characteristic sequence of ammonia nitrogen concentration and the local characteristic sequence of chemical oxygen demand, the adaptive scale and multi-scale water quality parameter characteristics of the gated cycle unit are calculated to predict the water quality parameters and obtain the predicted values ​​of the pH value time series data, the ammonia nitrogen concentration time series data and the chemical oxygen demand time series data at the next moment;

[0012] S5: Add Gaussian noise to the pretreated water quality parameter data and perform simulation calculations. Then, based on the simulation calculation results and the normal distribution assumption method, calculate the confidence interval of the predicted pH value, the confidence interval of the predicted ammonia nitrogen concentration, and the confidence interval of the predicted chemical oxygen demand.

[0013] Furthermore, the S1 step further includes:

[0014] S11: using a pH sensor, an ammonia nitrogen concentration sensor and a chemical oxygen demand sensor to collect data of three water quality parameters at intervals of 15 minutes; arranging the collected pH value, ammonia nitrogen concentration and chemical oxygen demand data in chronological order to construct original water quality parameter data; each data point in the original water quality parameter data contains the measurement values ​​of the above three water quality parameters at the same time point;

[0015] S12: For the original water quality parameter data, the linear interpolation method based on adjacent time points is used to fill the missing values, and then the 3σ principle is used to detect and eliminate outliers to obtain the water quality parameter data after preliminary preprocessing;

[0016] S13: The water quality parameter data after preliminary preprocessing is mapped to the interval [0,1] using a linear normalization formula to obtain the preprocessed water quality parameter data.

[0017] Furthermore, the S2 step further includes:

[0018] S21: Calculate the adaptive neighborhood radius and the minimum number of samples based on the preprocessed water quality parameter data. The calculation method is:

[0019] ;

[0020] in, is the minimum number of samples, is the adaptive neighborhood radius, is the neighborhood radius matrix, is the sigmoid function, is a multi-layer perceptron, They are pH value time series data, ammonia nitrogen concentration time series data and chemical oxygen demand time series data. is the neighborhood radius bias vector;

[0021] S22: traverse and calculate the neighborhood distance between each data point in the pre-processed water quality parameter data, and the calculation method is:

[0022] ;

[0023] in, is the neighborhood distance between the i-th and j-th data points, i and j are the first data index and the second data index respectively, , is the pH value time series data of the ith data point, is the pH value time series data of the jth data point, is the time series data of ammonia nitrogen concentration at the ith data point, is the time series data of ammonia nitrogen concentration at the jth data point, is the time series data of chemical oxygen demand of the ith data point, is the time series data of chemical oxygen demand at the jth data point, is the time dimension weight, To take the absolute value, n is the total number of data points in the preprocessed water quality parameter data;

[0024] S23: The traditional DBSCAN algorithm is improved according to the adaptive neighborhood radius, minimum sample number and domain distance obtained in steps S21 and S22 to obtain an improved DBSCAN algorithm; the pre-processed water quality parameter data is then input into the improved DBSCAN algorithm to calculate the water quality parameter data point clusters, and the calculation method is:

[0025] ;

[0026] in, is the kth water quality parameter data point cluster, It is the improved DBSCAN algorithm.

[0027] Furthermore, the S3 step includes:

[0028] Construct a local feature extraction convolutional network using The convolution kernel performs a convolution operation to obtain a preliminary feature map. Then, in the preliminary feature map, for each convolution kernel coverage range, its maximum and minimum values ​​are calculated, and then the maximum and minimum values ​​are stored in the maximum value matrix and the minimum value matrix respectively. Finally, the maximum value matrix and the minimum value matrix are channel-joined as the calculation result of the local feature extraction convolution network.

[0029] Furthermore, the S3 step further includes:

[0030] S31: Extract the core tensor based on the preprocessed water quality parameter data and water quality parameter data point clusters. The calculation method is:

[0031] ;

[0032] ;

[0033] in, is the input layer feature, For splicing operation, is the long short-term memory network, is the core tensor, is a high-order singular value decomposition;

[0034] S32: Calculate the local characteristic sequence of pH value, the local characteristic sequence of ammonia nitrogen concentration and the local characteristic sequence of chemical oxygen demand according to the pre-treated water quality parameter data. The calculation method is:

[0035] ;

[0036] ;

[0037] ;

[0038] in, They are the local characteristic sequence of pH value, the local characteristic sequence of ammonia nitrogen concentration and the local characteristic sequence of chemical oxygen demand. is the local feature weight matrix, Convolutional network for local feature extraction, is the local feature bias vector, is a time series converter;

[0039] S33: Perform feature fusion on the local feature sequence of pH value, the local feature sequence of ammonia nitrogen concentration and the local feature sequence of chemical oxygen demand to obtain a feature fusion vector, which is calculated as follows:

[0040] ;

[0041] ;

[0042] ;

[0043] ;

[0044] in, is the local feature fusion vector, are the importance scores of the local characteristic sequence of pH value, the local characteristic sequence of ammonia nitrogen concentration and the local characteristic sequence of chemical oxygen demand, respectively. is the weighted feature fusion vector, is the feature fusion vector;

[0045] S34: Combine the feature fusion vector, core tensor and water quality parameter data point cluster to extract the coupling feature vector, which is calculated as follows:

[0046] ;

[0047] ;

[0048] in, is the preliminary coupling eigenvector, is the coupled eigenvector.

[0049] Furthermore, the S4 step further includes:

[0050] S41: Calculate the adaptive scale of the gated cycle unit according to the coupling characteristic vector, the local characteristic sequence of pH value, the local characteristic sequence of ammonia nitrogen concentration and the local characteristic sequence of chemical oxygen demand. The calculation method is:

[0051] ;

[0052] in, is the adaptive scale of the gated recurrent unit, is the adaptive scale weight matrix, is the adaptive scale bias vector;

[0053] S42: Construct a multi-scale gated cyclic unit to extract multi-scale features from the pre-processed water quality parameter data to obtain multi-scale water quality parameter features. The calculation method is:

[0054] ;

[0055] ;

[0056] ;

[0057] ;

[0058] in, They are the first scale water quality parameter characteristics, the second scale water quality parameter characteristics, and the third scale water quality parameter characteristics. are gated recurrent units with time steps of 5, 10, and h, respectively. is the multi-scale water quality parameter characteristic, is the attention mechanism;

[0059] S43: Combine the coupled eigenvectors with the multi-scale water quality parameter characteristics to predict water quality parameters. The calculation method is:

[0060] ;

[0061] in, They are respectively the predicted values ​​of pH value time series data, ammonia nitrogen concentration time series data and chemical oxygen demand time series data at the next moment.

[0062] Furthermore, the step S5 further includes:

[0063] S51: simulate the pre-processed water quality parameter data N times. In each simulation, Gaussian noise is added to the pre-processed water quality parameter data as input data. The calculation method is:

[0064] ;

[0065] in, is the input data after adding noise in the mth simulation, is the Gaussian noise matrix at the mth simulation, and N is the total number of simulations;

[0066] S52: for the input data after adding noise during N simulations, the calculation methods of S2 to S4 are used in sequence to calculate the predicted values ​​of the pH value time series data, the ammonia nitrogen concentration time series data and the chemical oxygen demand time series data at the next moment;

[0067] S53: for the predicted values ​​of the pH time series data, ammonia nitrogen concentration time series data and chemical oxygen demand time series data at the next moment obtained by each simulation calculation, the mean value method is used to calculate the mean and standard deviation of the pH value prediction value, the mean and standard deviation of the ammonia nitrogen concentration prediction value, and the mean and standard deviation of the chemical oxygen demand prediction value;

[0068] S54: Based on the normal distribution assumption, the confidence interval of the predicted pH value, the confidence interval of the predicted ammonia nitrogen concentration, and the confidence interval of the predicted chemical oxygen demand are calculated according to the mean and standard deviation of the predicted pH value, the mean and standard deviation of the predicted ammonia nitrogen concentration, and the mean and standard deviation of the predicted chemical oxygen demand.

[0069] The present invention also discloses a complex water quality parameter prediction system based on deep learning, comprising:

[0070] Water quality parameter data acquisition and preprocessing module: collects original water quality parameter data and performs preprocessing to obtain preprocessed water quality parameter data; the preprocessed water quality parameter data includes pH value time series data, ammonia nitrogen concentration time series data and chemical oxygen demand time series data;

[0071] Water quality parameter data point cluster extraction module: improve the DBSCAN algorithm by calculating the adaptive neighborhood radius, the minimum number of samples and the neighborhood distance between each data point; use the improved DBSCAN algorithm to extract water quality parameter data point clusters from the preprocessed water quality parameter data;

[0072] Coupling feature vector extraction module: extract the core tensor, local feature sequence of pH value, local feature sequence of ammonia nitrogen concentration and local feature sequence of chemical oxygen demand according to the pre-processed water quality parameter data and water quality parameter data point clusters, then extract the feature fusion vector, and finally combine the water quality parameter data point clusters to extract the coupling feature vector;

[0073] Water quality parameter prediction module: According to the coupling characteristic vector, the local characteristic sequence of pH value, the local characteristic sequence of ammonia nitrogen concentration and the local characteristic sequence of chemical oxygen demand, the adaptive scale and multi-scale water quality parameter characteristics of the gated cycle unit are calculated, and then the water quality parameters are predicted to obtain the predicted values ​​of the pH value time series data, the ammonia nitrogen concentration time series data and the chemical oxygen demand time series data at the next moment;

[0074] Water quality parameter prediction confidence assessment module: Gaussian noise is added to the preprocessed water quality parameter data, and simulation calculations are performed. Based on the simulation calculation results and the normal distribution assumption method, the confidence interval of the pH value prediction value, the confidence interval of the ammonia nitrogen concentration prediction value, and the confidence interval of the chemical oxygen demand prediction value are calculated.

[0075] Compared with the prior art, the present invention has the following beneficial effects:

[0076] (1) The present invention combines a multi-layer perceptron to calculate adaptive parameters and introduces time dimension weights, improves the DBSCAN algorithm, extracts water quality parameter data point clusters, and provides feature-level support for extracting coupled feature vectors; secondly, the coupled feature vectors are used to model the interrelated states of water quality parameters to represent the intricate relationships between water quality parameters; finally, a multi-scale gated recurrent unit is designed to extract the features of water quality parameters at various time scales, and predict water quality parameters while providing prediction uncertainty assessment results, which can solve the problem that traditional water quality parameter prediction methods are difficult to cope with the poor prediction effect caused by the coupled association of multiple water quality parameter types.

[0077] (2) In order to solve the problem that the fixed parameters of the traditional DBSCAN algorithm lead to poor clustering effect, the present invention combines the multi-layer perceptron with the sigmoid function to calculate the adaptive neighborhood radius and the minimum number of samples, and introduces the time dimension weight to calculate the neighborhood distance, so that the clustering results can more accurately reflect the similarities and differences of water quality parameters in time and space, providing a more reliable data basis for subsequent feature extraction and prediction.

[0078] (3) To address the problem that a single feature vector cannot fully express the temporal information of water quality parameters, the present invention designs a local feature extraction convolutional network to calculate the maximum and minimum values ​​within the coverage range of the convolution kernel and perform channel splicing, so that the final local feature sequence not only contains the change information of the local range, but also reflects the importance difference between different local ranges. It can better reflect the coupling relationship and temporal correlation between different water quality parameters, and improve the accuracy and reliability of subsequent prediction steps.

[0079] (4) In view of the problem that traditional methods are difficult to cope with the complex changes of water quality parameters at different time scales, the present invention combines the coupled feature vector with the local feature sequence, calculates the adaptive scale of the gated recurrent unit, uses gated recurrent units of different time steps to capture multi-scale features, and uses the attention mechanism to fuse these features. It can integrate the information advantages at different time scales and improve the adaptability and stability of the entire prediction system to the changes of complex water quality parameters. BRIEF DESCRIPTION OF THE DRAWINGS

[0080] Figure 1 A schematic diagram of a process flow of a complex water quality parameter prediction method based on deep learning provided by the present invention;

[0081] Figure 2 A schematic diagram of the algorithm flow of adaptive scale calculation of gated recurrent unit provided by the present invention;

[0082] Figure 3 A schematic diagram of the algorithm flow for multi-scale water quality parameter feature extraction provided by the present invention. DETAILED DESCRIPTION

[0083] The present invention is further described below in conjunction with the accompanying drawings, but the present invention is not limited in any way. Any changes or substitutions made based on the teachings of the present invention belong to the protection scope of the present invention.

[0084] Example 1: A method for predicting complex water quality parameters based on deep learning, such as Figure 1 As shown, the following steps are included:

[0085] S1: Collecting original water quality parameter data and preprocessing it to obtain preprocessed water quality parameter data;

[0086] S11: using a pH sensor, an ammonia nitrogen concentration sensor and a chemical oxygen demand sensor to collect data of three water quality parameters at intervals of 15 minutes; arranging the collected pH value, ammonia nitrogen concentration and chemical oxygen demand data in chronological order to construct original water quality parameter data; each data point in the original water quality parameter data contains the measurement values ​​of the above three water quality parameters at the same time point;

[0087] S12: For the original water quality parameter data, the linear interpolation method based on adjacent time points is used to fill the missing values, and then the 3σ principle is used to detect and eliminate outliers to obtain the water quality parameter data after preliminary preprocessing;

[0088] S13: The water quality parameter data after preliminary pretreatment is mapped to the interval [0,1] using a linear normalization formula to obtain the pretreated water quality parameter data; the pretreated water quality parameter data includes pH value time series data, ammonia nitrogen concentration time series data and chemical oxygen demand time series data.

[0089] S2: Improve the DBSCAN algorithm by calculating the adaptive neighborhood radius, the minimum number of samples and the neighborhood distance between each data point; use the improved DBSCAN algorithm to extract water quality parameter data point clusters from the preprocessed water quality parameter data;

[0090] S21: Calculate the adaptive neighborhood radius and the minimum number of samples based on the preprocessed water quality parameter data. The calculation method is:

[0091] ;

[0092] in, is the minimum number of samples, is the adaptive neighborhood radius, is the neighborhood radius matrix, is the sigmoid function, is a multi-layer perceptron, They are pH value time series data, ammonia nitrogen concentration time series data and chemical oxygen demand time series data. is the neighborhood radius bias vector;

[0093] S22: traverse and calculate the neighborhood distance between each data point in the pre-processed water quality parameter data, and the calculation method is:

[0094] ;

[0095] in, is the neighborhood distance between the i-th and j-th data points, i and j are the first data index and the second data index respectively, , is the pH value time series data of the ith data point, is the pH value time series data of the jth data point, is the time series data of ammonia nitrogen concentration at the ith data point, is the time series data of ammonia nitrogen concentration at the jth data point, is the time series data of chemical oxygen demand of the ith data point, is the time series data of chemical oxygen demand at the jth data point, is the time dimension weight, To take the absolute value, n is the total number of data points in the preprocessed water quality parameter data;

[0096] S23: Based on the traditional DBSCAN algorithm, the minimum number of samples, fixed neighborhood radius and neighborhood distance in the traditional DBSCAN algorithm are replaced by , and the improved DBSCAN algorithm is obtained; then the pre-processed water quality parameter data is input, and the water quality parameter data point cluster is calculated, and the calculation method is:

[0097] ;

[0098] in, is the kth water quality parameter data point cluster, It is the improved DBSCAN algorithm.

[0099] It should be further explained that step S21 uses a multi-layer perceptron to process pH time series data, ammonia nitrogen concentration time series data, and chemical oxygen demand time series data, which can perform nonlinear transformation on the input multi-dimensional time series data, learn the potential complex relationship between these water quality parameters, and then map the output to the interval through a function, multiply it by the neighborhood radius matrix and add the bias to obtain an adaptive neighborhood radius and minimum number of samples, allowing the neighborhood radius and minimum number of samples to be dynamically adjusted according to the actual situation of the water quality parameters instead of using fixed values. For example, for some complex water quality change patterns, larger values ​​may be output to ensure the accuracy and stability of clustering, while for relatively simple patterns, smaller values ​​will be output.

[0100] The traditional DBSCAN algorithm uses a fixed neighborhood radius and a minimum number of samples, which can easily lead to poor clustering effects. For example, for complex water quality change scenarios, using a smaller fixed neighborhood radius and a minimum number of samples can easily cause some data points that should belong to the same category to be mistakenly divided into different clusters, resulting in clustering results that are too fragmented and unable to reflect the intrinsic correlation between water quality parameters. Using a larger value can cause unrelated data points to be mistakenly clustered together, and the formed clusters contain too much noise or data points of different natures. On the other hand, distance calculations that do not consider the time dimension will ignore the temporal evolution of water quality parameters. For example, water quality parameters with similar change trends at different time stages cannot be clustered together, and the periodic or trend changes in water quality parameters over time cannot be captured, resulting in clustering results that cannot accurately reflect the actual characteristics and correlations of water quality parameters, thereby affecting the accuracy of subsequent feature extraction and prediction of water quality parameters.

[0101] For example, there is a time series data of a water quality parameter, including three parameters: pH value, ammonia nitrogen concentration, and chemical oxygen demand. The data is collected every hour, and a total of 10 time points are collected, as shown in the following table:

[0102] Water quality parameter time series data table

[0103]

[0104] The adaptive neighborhood radius and the minimum number of samples calculated by step S21 are 0.5 and 3 respectively, and the time dimension weight is 0.8. Taking the first data point as an example, the neighborhood distance between the first and second data points is:

[0105] ;

[0106] The distances between the first data point and other data points are calculated in sequence. It is found that the points whose distances are less than the adaptive neighborhood radius are the third and tenth data points. Together with the first data point itself, there are three points in total, which meets the minimum number of samples. Therefore, the first data point is the core point.

[0107] Take the first data point as the core point, and classify the third and tenth data points in its neighborhood into the same cluster; then repeat the core point determination process for the two newly added data points;

[0108] Taking the third data point as an example, we calculate its neighborhood distance with other data points and find that its distance with the first and tenth data points is smaller than the adaptive neighborhood radius, and its distance with the seventh data point is also smaller than the adaptive neighborhood radius, so the seventh data point is also added to the cluster;

[0109] After expanding all the data points in the cluster, a water quality parameter data point cluster is finally formed:

[0110] ;

[0111] S3: According to the pre-processed water quality parameter data and water quality parameter data point clusters, the core tensor, the local feature sequence of pH value, the local feature sequence of ammonia nitrogen concentration and the local feature sequence of chemical oxygen demand are extracted, and then the feature fusion vector is extracted. Finally, the coupling feature vector is extracted by combining the water quality parameter data point clusters;

[0112] S31: Extract the core tensor based on the preprocessed water quality parameter data and water quality parameter data point clusters. The calculation method is:

[0113] ;

[0114] ;

[0115] in, is the input layer feature, For splicing operation, is the long short-term memory network, is the core tensor, is a high-order singular value decomposition;

[0116] S32: Based on the pre-processed water quality parameter data, calculate the local characteristic sequence of pH value, the local characteristic sequence of ammonia nitrogen concentration and the local characteristic sequence of chemical oxygen demand, and express the characteristics in the form of characteristic sequence rather than characteristic vector; the calculation method is:

[0117] ;

[0118] ;

[0119] ;

[0120] in, They are the local characteristic sequence of pH value, the local characteristic sequence of ammonia nitrogen concentration and the local characteristic sequence of chemical oxygen demand. is the local feature weight matrix, Convolutional network for local feature extraction, is the local feature bias vector, is a time series converter;

[0121] Construct a local feature extraction convolutional network, the calculation method of the local feature extraction convolutional network is: adopt The convolution kernel performs a convolution operation to obtain a preliminary feature map. Then, in the preliminary feature map, for each convolution kernel coverage range, its maximum and minimum values ​​are calculated, and then the maximum and minimum values ​​are stored in the maximum matrix respectively. and the minimum matrix In the end, and Perform channel splicing as the calculation result of the local feature extraction convolutional network;

[0122] S33: Perform feature fusion on the local feature sequence of pH value, the local feature sequence of ammonia nitrogen concentration and the local feature sequence of chemical oxygen demand to obtain a feature fusion vector, which is calculated as follows:

[0123] ;

[0124] ;

[0125] ;

[0126] ;

[0127] in, is the local feature fusion vector, are the importance scores of the local characteristic sequence of pH value, the local characteristic sequence of ammonia nitrogen concentration and the local characteristic sequence of chemical oxygen demand, respectively. is the weighted feature fusion vector, is the feature fusion vector;

[0128] S34: Combine the feature fusion vector, core tensor and water quality parameter data point cluster to extract the coupling feature vector, which is calculated as follows:

[0129] ;

[0130] ;

[0131] in, is the preliminary coupling eigenvector, is the coupled eigenvector.

[0132] It should be further explained that, in step S32 of the present invention, feature extraction is performed through a local feature extraction convolution network, and for each convolution kernel coverage range, the maximum and minimum values ​​are calculated, stored in a matrix and channel splicing is performed, which helps to capture the extreme value information of ammonia nitrogen concentration in the local range, and reflects the range of change of ammonia nitrogen concentration in the local time window; by multiplying by the local feature weight matrix and adding the local feature bias vector, the importance difference of different local features is further emphasized, so that the final ammonia nitrogen concentration local feature sequence not only contains the change information of the local range, but also reflects the importance difference between different local ranges;

[0133] In addition, traditional methods usually only convert time series data into feature vectors, but for water quality parameter data, its change is a dynamic process, and a single vector is difficult to fully express its rich time information; the present invention extracts a more expressive local feature sequence, which contains information on different water quality parameters at different time scales and local ranges. Therefore, the final coupled feature vector can better reflect the coupling relationship and time correlation between different water quality parameters, and improve the accuracy and reliability of subsequent prediction steps.

[0134] S4: According to the coupling characteristic vector, the local characteristic sequence of pH value, the local characteristic sequence of ammonia nitrogen concentration and the local characteristic sequence of chemical oxygen demand, the adaptive scale and multi-scale water quality parameter characteristics of the gated cycle unit are calculated, and then the water quality parameters are predicted to obtain the predicted values ​​of the pH value time series data, the ammonia nitrogen concentration time series data and the chemical oxygen demand time series data at the next moment;

[0135] S41: Calculate the adaptive scale of the gated cycle unit according to the coupling characteristic vector, the local characteristic sequence of pH value, the local characteristic sequence of ammonia nitrogen concentration and the local characteristic sequence of chemical oxygen demand. The calculation method is:

[0136] ;

[0137] in, is the adaptive scale of the gated recurrent unit, is the adaptive scale weight matrix, is the adaptive scale bias vector;

[0138] S42: Construct a multi-scale gated cyclic unit to extract multi-scale features from the pre-processed water quality parameter data to obtain multi-scale water quality parameter features. The calculation method is:

[0139] ;

[0140] ;

[0141] ;

[0142] ;

[0143] in, They are the first scale water quality parameter characteristics, the second scale water quality parameter characteristics, and the third scale water quality parameter characteristics. are gated recurrent units with time steps of 5, 10, and h, respectively. is the multi-scale water quality parameter characteristic, is the attention mechanism;

[0144] S43: Combine the coupled eigenvectors with the multi-scale water quality parameter characteristics to predict water quality parameters. The calculation method is:

[0145] ;

[0146] in, They are respectively the predicted values ​​of pH value time series data, ammonia nitrogen concentration time series data and chemical oxygen demand time series data at the next moment.

[0147] It should be further explained that, in step S4, the present invention maps the coupling feature vector to a new feature space to mine its potential high-order feature information; then, the processed coupling feature vector and the processed local feature sequence are linearly combined through an adaptive scale weight matrix, and an adaptive scale bias vector is added to obtain a gated recurrent unit adaptive scale; this combination method enables the final adaptive scale to take into account both the coupling relationship between different water quality parameters and the time-dependent information in the local feature sequence, thereby achieving a comprehensive consideration of data features from different levels and angles; traditional methods usually use a fixed scale to process time series data, lacking adaptability to different data characteristics;

[0148] In addition, the present invention uses gated recurrent units with different time steps to process pH value time series data, ammonia nitrogen concentration time series data and chemical oxygen demand time series data, respectively capturing the features in the short-term, long-term and adaptive ranges; the short-term features and change patterns are suitable for reflecting the fluctuations of water quality parameters in a relatively short period of time; the features in a longer time range are more sensitive to changes with a certain periodicity or trend; and the adaptive scale can capture the time scale features that are adapted to the data characteristics; finally, the present invention fuses multi-scale features through an attention mechanism, integrating the information advantages at different time scales, and in the face of various complex changes in water quality parameters, whether it is sudden local changes or long-term trend changes, it can provide more accurate feature information, which helps to improve the performance and stability of the entire prediction system, so that it can better cope with water quality parameter prediction tasks under different environments and conditions.

[0149] S5: Add Gaussian noise to the pre-treated water quality parameter data, perform simulation calculations, and then calculate the confidence interval of the predicted value of pH value, the confidence interval of the predicted value of ammonia nitrogen concentration, and the confidence interval of the predicted value of chemical oxygen demand based on the simulation calculation results and the normal distribution assumption method;

[0150] S51: simulate the pre-processed water quality parameter data N times. In each simulation, Gaussian noise is added to the pre-processed water quality parameter data as input data. The calculation method is:

[0151] ;

[0152] in, is the input data after adding noise in the mth simulation, is the Gaussian noise matrix at the mth simulation, and N is the total number of simulations;

[0153] S52: for the input data after adding noise during N simulations, the calculation methods of S2 to S4 are used in sequence to calculate the predicted values ​​of the pH value time series data, the ammonia nitrogen concentration time series data and the chemical oxygen demand time series data at the next moment;

[0154] S53: for the predicted values ​​of the pH time series data, ammonia nitrogen concentration time series data and chemical oxygen demand time series data at the next moment obtained by each simulation calculation, the mean value method is used to calculate the mean and standard deviation of the pH value prediction value, the mean and standard deviation of the ammonia nitrogen concentration prediction value, and the mean and standard deviation of the chemical oxygen demand prediction value;

[0155] S54: Based on the normal distribution assumption, the confidence interval of the predicted pH value, the confidence interval of the predicted ammonia nitrogen concentration, and the confidence interval of the predicted chemical oxygen demand are calculated according to the mean and standard deviation of the predicted pH value, the mean and standard deviation of the predicted ammonia nitrogen concentration, and the mean and standard deviation of the predicted chemical oxygen demand.

[0156] Embodiment 2: The present invention also discloses a complex water quality parameter prediction system based on deep learning, comprising:

[0157] Water quality parameter data acquisition and preprocessing module: collects original water quality parameter data and performs preprocessing to obtain preprocessed water quality parameter data; the preprocessed water quality parameter data includes pH value time series data, ammonia nitrogen concentration time series data and chemical oxygen demand time series data;

[0158] Water quality parameter data point cluster extraction module: improve the DBSCAN algorithm by calculating the adaptive neighborhood radius, the minimum number of samples and the neighborhood distance between each data point; use the improved DBSCAN algorithm to extract water quality parameter data point clusters from the preprocessed water quality parameter data;

[0159] Coupling feature vector extraction module: extract the core tensor, local feature sequence of pH value, local feature sequence of ammonia nitrogen concentration and local feature sequence of chemical oxygen demand according to the pre-processed water quality parameter data and water quality parameter data point clusters, then extract the feature fusion vector, and finally combine the water quality parameter data point clusters to extract the coupling feature vector;

[0160] Water quality parameter prediction module: According to the coupling characteristic vector, the local characteristic sequence of pH value, the local characteristic sequence of ammonia nitrogen concentration and the local characteristic sequence of chemical oxygen demand, the adaptive scale and multi-scale water quality parameter characteristics of the gated cycle unit are calculated, and then the water quality parameters are predicted to obtain the predicted values ​​of the pH value time series data, the ammonia nitrogen concentration time series data and the chemical oxygen demand time series data at the next moment;

[0161] Water quality parameter prediction confidence assessment module: Gaussian noise is added to the preprocessed water quality parameter data, and simulation calculations are performed. Based on the simulation calculation results and the normal distribution assumption method, the confidence interval of the pH value prediction value, the confidence interval of the ammonia nitrogen concentration prediction value, and the confidence interval of the chemical oxygen demand prediction value are calculated.

[0162] It should be noted that the serial numbers of the above embodiments of the present invention are only for description and do not represent the advantages and disadvantages of the embodiments. And the terms "including", "comprising" or any other variants thereof in this article are intended to cover non-exclusive inclusion, so that a process, device, article or method including a series of elements includes not only those elements, but also other elements not explicitly listed, or also includes elements inherent to such process, device, article or method. In the absence of further restrictions, an element defined by the sentence "including a ..." does not exclude the presence of other identical elements in the process, device, article or method including the element.

[0163] Through the description of the above implementation methods, those skilled in the art can clearly understand that the above-mentioned embodiment methods can be implemented by means of software plus a necessary general hardware platform, and of course by hardware, but in many cases the former is a better implementation method. Based on such an understanding, the technical solution of the present invention is essentially or the part that contributes to the prior art can be embodied in the form of a software product, and the computer software product is stored in a storage medium (such as ROM / RAM, magnetic disk, optical disk) as described above, including a number of instructions for enabling a terminal device (which can be a mobile phone, a computer, a server, or a network device, etc.) to execute the methods described in multiple embodiments of the present invention.

[0164] The above are only preferred embodiments of the present invention, and are not intended to limit the patent scope of the present invention. Any equivalent structure or equivalent process transformation made using the contents of the present invention specification and drawings, or directly or indirectly applied in other related technical fields, are also included in the patent protection scope of the present invention.

Claims

1. A complex water quality parameter prediction method based on deep learning, characterized in that: The following steps are involved: S1: Collecting original water quality parameter data and preprocessing it to obtain preprocessed water quality parameter data; the preprocessed water quality parameter data includes pH value time series data, ammonia nitrogen concentration time series data and chemical oxygen demand time series data; S2: Improve the traditional DBSCAN algorithm by calculating the adaptive neighborhood radius, the minimum number of samples, and the neighborhood distance between each data point; For the pre-processed water quality parameter data, the improved DBSCAN algorithm is used to extract water quality parameter data point clusters, including: Firstly, based on the traditional DBSCAN algorithm, the adaptive neighborhood radius and the minimum number of samples are calculated by combining the multi-layer perceptron and the sigmoid function. Secondly, the time dimension weight is introduced to calculate the neighborhood distance between data points, and the traditional DBSCAN algorithm is improved to obtain the improved DBSCAN algorithm. Finally, according to the improved DBSCAN algorithm, the water quality parameter data point clusters are calculated. Specifically: S21: Calculate the adaptive neighborhood radius and the minimum number of samples based on the preprocessed water quality parameter data. The calculation method is: ; in, is the minimum number of samples, is the adaptive neighborhood radius, is the neighborhood radius matrix, is the sigmoid function, is a multi-layer perceptron, They are pH value time series data, ammonia nitrogen concentration time series data and chemical oxygen demand time series data. is the neighborhood radius bias vector; S22: traverse and calculate the neighborhood distance between each data point in the pre-processed water quality parameter data, and the calculation method is: ; in, is the neighborhood distance between the i-th and j-th data points, i and j are the first data index and the second data index respectively, , is the pH value time series data of the ith data point, is the pH value time series data of the jth data point, is the time series data of ammonia nitrogen concentration at the ith data point, is the time series data point of ammonia nitrogen concentration at the jth data point, is the time series data of chemical oxygen demand of the ith data point, is the time series data of chemical oxygen demand at the jth data point, is the time dimension weight, To take the absolute value, n is the total number of data points in the preprocessed water quality parameter data; S3: Extract the core tensor, the local feature sequence of pH value, the local feature sequence of ammonia nitrogen concentration and the local feature sequence of chemical oxygen demand according to the pre-processed water quality parameter data and the water quality parameter data point clusters; then extract the feature fusion vector; finally, combine the water quality parameter data point clusters to extract the coupling feature vector; S4: According to the coupling characteristic vector, the local characteristic sequence of pH value, the local characteristic sequence of ammonia nitrogen concentration and the local characteristic sequence of chemical oxygen demand, the adaptive scale and multi-scale water quality parameter characteristics of the gated cycle unit are calculated to predict the water quality parameters and obtain the predicted values ​​of the pH value time series data, the ammonia nitrogen concentration time series data and the chemical oxygen demand time series data at the next moment; S5: Add Gaussian noise to the pretreated water quality parameter data and perform simulation calculations. According to the simulation calculation results and based on the normal distribution assumption, calculate the confidence interval of the predicted pH value, the confidence interval of the predicted ammonia nitrogen concentration, and the confidence interval of the predicted chemical oxygen demand.

2. The complex water quality parameter prediction method based on deep learning according to claim 1, characterized in that: The S1 step comprises: S11: using a pH sensor, an ammonia nitrogen concentration sensor and a chemical oxygen demand sensor to collect data of three water quality parameters at intervals of 15 minutes; arranging the collected pH value, ammonia nitrogen concentration and chemical oxygen demand data in chronological order to construct original water quality parameter data; each data point in the original water quality parameter data contains the measurement values ​​of the above three water quality parameters at the same time point; S12: For the original water quality parameter data, the linear interpolation method based on adjacent time points is used to fill the missing values, and then the 3σ principle is used to detect and eliminate outliers to obtain the water quality parameter data after preliminary preprocessing; S13: The water quality parameter data after preliminary preprocessing is mapped to the interval [0,1] using a linear normalization formula to obtain the preprocessed water quality parameter data.

3. The complex water quality parameter prediction method based on deep learning according to claim 2 is characterized in that: The step S2 comprises: S23: According to the adaptive neighborhood radius, minimum sample number and domain distance obtained in steps S21 and S22, the traditional DBSCAN algorithm is improved to obtain an improved DBSCAN algorithm; the pre-processed water quality parameter data is input into the improved DBSCAN algorithm to calculate the water quality parameter data point clusters, and the calculation method is: ; in, is the kth water quality parameter data point cluster, It is the improved DBSCAN algorithm.

4. The complex water quality parameter prediction method based on deep learning according to claim 3 is characterized in that: The S3 step comprises: Construct a local feature extraction convolutional network using The convolution kernel performs a convolution operation to obtain a preliminary feature map. Then, in the preliminary feature map, for each convolution kernel coverage range, its maximum and minimum values ​​are calculated, and then the maximum and minimum values ​​are stored in the maximum value matrix and the minimum value matrix respectively. Finally, the maximum value matrix and the minimum value matrix are channel-joined as the calculation result of the local feature extraction convolution network.

5. The complex water quality parameter prediction method based on deep learning according to claim 4 is characterized in that: The S3 step comprises: S31: Extract the core tensor based on the preprocessed water quality parameter data and water quality parameter data point clusters. The calculation method is: ; ; in, is the input layer feature, For splicing operation, is the long short-term memory network, is the core tensor, is a high-order singular value decomposition; S32: Calculate the local characteristic sequence of pH value, the local characteristic sequence of ammonia nitrogen concentration and the local characteristic sequence of chemical oxygen demand according to the pre-treated water quality parameter data. The calculation method is: ; ; ; in, They are the local characteristic sequence of pH value, the local characteristic sequence of ammonia nitrogen concentration and the local characteristic sequence of chemical oxygen demand. is the local feature weight matrix, Convolutional network for local feature extraction, is the local feature bias vector, is a time series converter; S33: Perform feature fusion on the local feature sequence of pH value, the local feature sequence of ammonia nitrogen concentration and the local feature sequence of chemical oxygen demand to obtain a feature fusion vector, which is calculated as follows: ; ; ; ; in, is the local feature fusion vector, are the importance scores of the local characteristic sequence of pH value, the local characteristic sequence of ammonia nitrogen concentration and the local characteristic sequence of chemical oxygen demand, respectively. is the weighted feature fusion vector, is the feature fusion vector; S34: Combine the feature fusion vector, core tensor and water quality parameter data point cluster to extract the coupling feature vector, which is calculated as follows: ; ; in, is the preliminary coupling eigenvector, is the coupled eigenvector.

6. The complex water quality parameter prediction method based on deep learning according to claim 5 is characterized in that: The S4 step comprises: S41: Calculate the adaptive scale of the gated cycle unit according to the coupling characteristic vector, the local characteristic sequence of pH value, the local characteristic sequence of ammonia nitrogen concentration and the local characteristic sequence of chemical oxygen demand. The calculation method is: ; in, is the adaptive scale of the gated recurrent unit, is the adaptive scale weight matrix, is the adaptive scale bias vector; S42: Construct a multi-scale gated cyclic unit to extract multi-scale features from the pre-processed water quality parameter data to obtain multi-scale water quality parameter features. The calculation method is: ; ; ; ; in, They are the first scale water quality parameter characteristics, the second scale water quality parameter characteristics, and the third scale water quality parameter characteristics. are gated recurrent units with time steps of 5, 10, and h, respectively. is the multi-scale water quality parameter characteristic, is the attention mechanism; S43: Combine the coupled eigenvectors with the multi-scale water quality parameter characteristics to predict water quality parameters. The calculation method is: ; in, They are respectively the predicted values ​​of pH value time series data, ammonia nitrogen concentration time series data and chemical oxygen demand time series data at the next moment.

7. The complex water quality parameter prediction method based on deep learning according to claim 6 is characterized in that: The step S5 comprises: S51: simulate the pre-processed water quality parameter data N times. In each simulation, Gaussian noise is added to the pre-processed water quality parameter data as input data. The calculation method is: ; in, is the input data after adding noise in the mth simulation, is the Gaussian noise matrix at the mth simulation, and N is the total number of simulations; S52: for the input data after adding noise during N simulations, the calculation methods of S2 to S4 are used in sequence to calculate the predicted values ​​of the pH value time series data, the ammonia nitrogen concentration time series data and the chemical oxygen demand time series data at the next moment; S53: for the predicted values ​​of the pH time series data, ammonia nitrogen concentration time series data and chemical oxygen demand time series data at the next moment obtained by each simulation calculation, the mean value method is used to calculate the mean and standard deviation of the pH value prediction value, the mean and standard deviation of the ammonia nitrogen concentration prediction value, and the mean and standard deviation of the chemical oxygen demand prediction value; S54: Based on the normal distribution assumption, the confidence interval of the predicted pH value, the confidence interval of the predicted ammonia nitrogen concentration, and the confidence interval of the predicted chemical oxygen demand are calculated according to the mean and standard deviation of the predicted pH value, the mean and standard deviation of the predicted ammonia nitrogen concentration, and the mean and standard deviation of the predicted chemical oxygen demand.

8. A complex water quality parameter prediction system based on deep learning, characterized in that: include: Water quality parameter data collection and preprocessing module: collects original water quality parameter data and preprocesses it to obtain preprocessed water quality parameter data; The pre-treated water quality parameter data includes pH value time series data, ammonia nitrogen concentration time series data and chemical oxygen demand time series data; Water quality parameter data point cluster extraction module: Improve the DBSCAN algorithm by calculating the adaptive neighborhood radius, the minimum number of samples, and the neighborhood distance between each data point; For the pre-processed water quality parameter data, the improved DBSCAN algorithm is used to extract the water quality parameter data point clusters; Coupling feature vector extraction module: extract the core tensor, local feature sequence of pH value, local feature sequence of ammonia nitrogen concentration and local feature sequence of chemical oxygen demand according to the pre-processed water quality parameter data and water quality parameter data point clusters, then extract the feature fusion vector, and finally combine the water quality parameter data point clusters to extract the coupling feature vector; Water quality parameter prediction module: According to the coupling characteristic vector, the local characteristic sequence of pH value, the local characteristic sequence of ammonia nitrogen concentration and the local characteristic sequence of chemical oxygen demand, the adaptive scale and multi-scale water quality parameter characteristics of the gated cycle unit are calculated, and then the water quality parameters are predicted to obtain the predicted values ​​of the pH value time series data, the ammonia nitrogen concentration time series data and the chemical oxygen demand time series data at the next moment; Water quality parameter prediction confidence assessment module: Gaussian noise is added to the pre-processed water quality parameter data, and simulation calculations are performed. According to the simulation calculation results, the confidence interval of the pH value prediction value, the confidence interval of the ammonia nitrogen concentration prediction value, and the confidence interval of the chemical oxygen demand prediction value are calculated based on the normal distribution assumption method; To realize a complex water quality parameter prediction method based on deep learning as described in any one of claims 1-7.

Citation Information

Patent Citations

  • Effluent BOD prediction method based on interconnected modular neural network

    CN109978024A

  • Method for predicting water quality non-stationary time sequence based on improved TFT model

    CN116956120A