Generative adversarial network data enhancement-based water quality prediction method

The BiTimeGAN model generates water quality data and combines the GRU model to predict it, solves the problem of insufficient data in water quality prediction, improves the prediction accuracy, and effectively captures the characteristics of time series data.

CN119494031AInactive Publication Date: 2025-02-21GUANGDONG LABORATORY OF SOUTHERN OCEAN SCIENCE AND ENGINEERING (GUANGZHOU)

Patent Information

Application Number
CN202411530376.3
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2024-10-30
Publication Date
2025-02-21
Estimated Expiration
Not applicable · inactive patent

AI Technical Summary

Technical Problem

The prior art faces the problem of insufficient data in water quality prediction, resulting in low accuracy of prediction results of deep learning models.

Method used

Using a data augmentation method based on Generative Adversarial Network (GAN) is used to extend the original water quality data through the BiTimeGAN model, generate more training data, and combine it with the GRU model to predict water quality.

Benefits of technology

It improves the accuracy of water quality prediction, solves the problem of inaccurate prediction results caused by insufficient data volume, and the BiTimeGAN model can effectively capture the global and local characteristics of time series data.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN119494031A_ABST
    Figure CN119494031A_ABST
Patent Text Reader

Abstract

The invention discloses a water quality prediction method based on generative adversarial network data enhancement. The method comprises the steps of data acquisition and data processing, water quality data enhancement, generated data analysis and evaluation, water quality prediction, and result discussion and analysis. According to the method, the mixed deep learning model based on the Bi T imeGAN module and the GRU module is established, so that the water quality data volume is increased, and the prediction precision of the deep learning model is improved. The method has the advantages that the developed Bi T imeGAN model considers global and local features of time series data, the limitation that a traditional generative adversarial network and a time series generation model cannot capture global and local feature information of the time series data is solved, extraction and screening of the global and local time series features of the time series information are achieved, and the time series information extraction efficiency is improved. The generated data is close to real data in the aspect of static characteristics, and meanwhile, the dependency relationship of time sequence data in the aspect of time is reserved; the model established by the method has higher precision in the aspects of time sequence data generation and water quality prediction.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present invention relates to the field of artificial intelligence neural networks, and in particular to a water quality prediction method based on generative adversarial network data enhancement. Background Art

[0002] Water is a fundamental element for human survival, development, and prosperity, and the importance of water quality cannot be ignored. Water pollution incidents caused by lack of information management have led to ecosystem impacts. Establishing accurate water quality predictions is helpful for the effective planning and management of water resources, and safeguarding human health and environmental safety. Deep learning models are considered to be the most effective method for predicting water quality. However, the accuracy of water quality prediction not only depends on the model itself, but also requires sufficient historical data as a basis. In the process of collecting continuous time-series water quality online monitoring data, there are challenges such as high monitoring costs, equipment failures, and data transmission, which lead to the loss of water quality-related data, which is crucial for the training of deep learning models. The lack of original water quality data is a common problem in water quality prediction research, but its impact on prediction has not been fully appreciated. Therefore, it is necessary to conduct in-depth research on water quality prediction modeling strategies in the case of insufficient monitoring data to better cope with this challenge.

[0003] Machine learning models and deep learning models have strong nonlinear data fitting and parameter learning capabilities. They can learn the relationship between input and output by collecting a large amount of historical water quality data to train the model, and have been widely used in water quality prediction. Methods based on support vector regression (SVR) and extreme gradient boosting algorithm (XGBoost) are applicable to water quality prediction, but the machine learning model does not learn the features between time series data enough, resulting in low prediction accuracy. Deep learning models can capture the long-term time series features between water quality data, thereby improving the accuracy of water quality prediction. A long short-term memory network (LSTM) was proposed for water quality prediction. The model takes into account the long-term dependency of time series data and improves the accuracy of water quality prediction. The gated recurrent unit (GRU) is used for water quality prediction because its complex gated network mechanism can reduce the risk of data overfitting. Although the GRU neural network can adapt to nonlinear water quality data with large data volume, it ignores the scarcity of water quality environmental data, resulting in inaccurate water quality prediction.

[0004] Therefore, the present invention proposes a water quality prediction method based on generative adversarial network data enhancement. Summary of the invention

[0005] In order to overcome the shortcomings and deficiencies of the prior art, the present invention provides a water quality prediction method based on generative adversarial network data enhancement.

[0006] A water quality prediction method based on generative adversarial network data enhancement, the method comprising:

[0007] Step 1: Data collection and data processing: Data collection and preprocessing of hydrological and meteorological parameters and pollutant data; local missing data are filled by mean interpolation method, outliers are identified and eliminated by 3σ principle, and the input data set is normalized to the maximum and minimum to complete data standardization;

[0008] Step 2, water quality data enhancement: The BiTimeGAN model is used to expand the original water quality data to enhance the training data set with insufficient data volume; the BiTimeGAN model includes an autoencoder component and an adversarial component, the autoencoder is used to establish a reversible mapping between high-dimensional features and low-dimensional feature spaces, and provides a latent space for the adversarial component to learn the potential time series features of the data in the low-dimensional representation, and the adversarial component is used to generate samples similar to the original water quality data through an adversarial process in the latent space;

[0009] Step 3: Data analysis and evaluation: The generated water quality data and the original water quality data are analyzed and evaluated to ensure the validity of the generated data. Five evaluation indicators, namely principal component analysis, t-distributed random neighborhood embedding, cumulative spectral density, maximum mean variance, and Euclidean distance, are used to measure the distribution similarity between the generated water quality data and the real data.

[0010] Step 4: Water quality prediction: Based on the GRU model, the historical hydrological and meteorological time series data are combined with the generated data to build a deep learning model to predict the changes of target pollutants;

[0011] Step 5. Discussion and analysis of results: MAE, RMSE and NSE are used as evaluation parameters to evaluate the prediction performance of the model, parameters are optimized through experiments, and its performance is verified by comparing it with the benchmark model.

[0012] Furthermore, the autoencoder component includes an encoder and a decoder. The encoder is used for feature learning to convert the water quality time series data into a latent space, reduce the dimension of the data and extract its time features. The decoder is used to restore the data from the latent space back to the original feature space. The expressions of the encoder and the decoder are:

[0013] H t =enc(H t-1 ,X t )

[0014]

[0015] Among them, X t is the original water quality time series data, H t and H t-1 is the potential feature sequence of encoder dimensionality reduction at time t and t-1, is the time series sequence reconstructed by the decoder. In the autoencoder component, the decoder should reconstruct the water quality time series data and the loss function expression according to the potential sequence output by the encoder:

[0016]

[0017] Where E represents the expected value, P is the original water quality data distribution, ∥·∥2 represents the L2 norm, and X t represents real time series data, represents the reconstructed time series data, and T is the total length of the time series.

[0018] Furthermore, the adversarial component includes a generator network and a discriminator network. In the latent space, the sequence discriminator is used to distinguish the original latent sequence from the synthetic sequence generated by the sequence generator. The sequence generator is used to try to generate a time series latent vector that is as real as possible to deceive the sequence discriminator. In the generator, the Gaussian noise Z t Sampling from a distribution, based on previously generated temporal features Generator generation In the discriminator, the discriminator accepts the latent code and returns it to the classifier, and the output classifier determines the label of the sequence, expressed as:

[0019]

[0020] y′ t =D(U t )

[0021] U t =C(H t ,U t-1 )

[0022] in, is to generate potential sequences; is the potential sequence generated at the previous moment; Z t is Gaussian noise; y′ t is the output probability of the discriminator for the current time step data; U t is the hidden state of the current time step; C is the update function of the RNN unit; U t-1 is the hidden state of the previous time step; H t is the original latent sequence; G and D are the generator and discriminator, respectively, which are any multi-layer perceptrons.

[0023] In order to generate synthetic data that is close to the target distribution under time series data, the unsupervised loss function for the adversarial training loss function of the G and D networks is defined as follows:

[0024]

[0025] In the formula, y t Represents the output probability of the real data; y t ′ represents the output probability of generating data; X 1:T is the real time series data, T is the Tth moment; P is the original data distribution; is the generated data distribution.

[0026] Unsupervised loss alone cannot accurately capture the dynamic changing characteristics of sequence data in the time dimension. In order to enhance the ability to capture conditional distribution in real data, supervised loss is introduced to capture the differences between distributions:

[0027]

[0028] Among them, ∥·∥2 represents the L2 norm, H t represents the original latent sequence, represents the generated latent sequence.

[0029] Furthermore, the PCA is a linear transformation method used to project high-dimensional raw data into a new low-dimensional space coordinate system. This new coordinate system consists of the directions with the largest variance in the data (i.e., principal components). The principal components are linear combinations of the original features that can retain the change information of the data to the greatest extent. During the transformation process, PCA attempts to retain the global structure of the data, but may lose some local structure. By identifying the most important directions (principal components) in the data, PCA projects the data onto these directions, thereby achieving dimensionality reduction and feature extraction of the data. When applying PCA, the raw data needs to be standardized to eliminate the impact of different scales on the analysis results. First, calculate the covariance matrix C of the data set X:

[0030]

[0031] Among them, C is the covariance matrix, n is the number of samples, X′ is the centralized data, X′=X-μ, X is the original data matrix, μ is the mean of each column, and T is the transpose of the matrix. Then, the covariance matrix C is decomposed by eigenvalue, and the eigenvectors with the largest eigenvalues ​​are selected as the basis of the new coordinate system to form the principal component space of the data. Finally, the original data X is projected onto the selected principal component to obtain the reduced-dimensional data.

[0032] Furthermore, the t-SNE is a nonlinear dimensionality reduction and data visualization technique that is specifically used to map high-dimensional data to low-dimensional space. Its goal is to preserve the local structure of the data points while allowing data points that are close in the high-dimensional space to maintain a relative neighbor relationship in the low-dimensional space. Compared with traditional linear dimensionality reduction methods such as PCA, t-SNE is more suitable for discovering nonlinear structures in data and can preserve all information in the data as much as possible. First, define a data point x in the high-dimensional space i and x j The similarity P between ij , use t distribution to measure the similarity in low-dimensional space, use KL divergence to measure the difference between two probability distributions, and the optimization goal is to minimize all data points x i The sum of the KL divergences of . The formula is as follows:

[0033]

[0034] Among them, x i 、x j and x k is a data point in high-dimensional space, σ i is the local standard deviation of point i. j|i is the conditional probability of data point j given data point i, and exp(·) is the natural exponential function. Calculate the global similarity:

[0035]

[0036] Where N is the total number of data points, P ij is the global similarity between point i and point j. By combining the two conditional probabilities, we ensure that the similarity is symmetric. We use t distribution to measure the similarity in low-dimensional space:

[0037]

[0038] Among them, y i and j is a data point in the low-dimensional space. ij is the conditional probability of a data point in low-dimensional space. The t distribution is used to measure the similarity between low-dimensional points, so that low-dimensional embedding can better show the local structure of the data. Finally, the KL divergence is used to measure the difference between the two probability distributions. The optimization goal is to minimize the probability of all data points x i The sum of the KL divergences of .

[0039]

[0040] Among them, C represents the Kullback-Leibler (KL) divergence, which measures the difference between two probability distributions P and Q. P is the probability distribution of high-dimensional space data; Q is the probability distribution of low-dimensional space data. ij is the probability of point i and point j in high-dimensional space. ij is the probability of point i and point j in low-dimensional space. t-SNE uses gradient descent method to minimize this loss function.

[0041] Furthermore, the MMD measures the distance between real data and generated data in the Reproducing Kernel Hilbert Space (RKHS), which is widely used to measure the similarity between two distributions, where smaller MMD values ​​indicate closer distributions and higher quality generated data. It is used to measure the pattern diversity of the dataset generated in this study and is defined as follows:

[0042]

[0043] Where K(·) is the mapping function that maps samples to the feature space H, and n and h are the sample counts of x and y, respectively. ||·|| H represents the computation of the norm in the Reproducing Kernel Hilbert Space (RKHS). i Sample points sampled from real data, y i are the sample points from which the generated data is sampled.

[0044] Furthermore, the EDD measures the real data X in the Euclidean distance space. real And generate data X generate The smaller the EDD, the smaller the distribution difference between the generated data and the real data, and the better the data quality. The formula can be written as follows:

[0045]

[0046] Among them, EDD represents the Euclidean distance between the real data and the generated data, which measures their similarity. real (i) represents the true data value at the i-th time step, X generate (i) represents the generated data value at the i-th time step, and t represents the total number of samples.

[0047] The closer the CDF curve of the generated data is to the CDF curve of the real data, the more similar the distribution of the generated data is to the distribution of the real data. The formula can be expressed as:

[0048]

[0049] Where CDF(X) represents the cumulative distribution function value of the random variable X, that is, the probability of being less than or equal to X. X represents a specific value of the random variable. q(t) represents the probability density function, which describes the probability density of the random variable at point t.

[0050] Furthermore, the root mean square error (RMSE), mean absolute error (MAE), and Nash-Sutcliffe efficiency coefficient (NSE) are used as evaluation indicators of model prediction accuracy. NSE judges the performance of the model by comparing the deviation between the predicted value and the true value. RMSE reflects the degree of error between the actual value and the predicted value by calculating the square root of the difference between the predicted value and the actual value. MAE calculates the absolute difference between the actual value and the observed value. The calculation formula is as follows:

[0051]

[0052] Where n is the total number of samples, y i is the time series of monitoring, y′ i is the predicted time series, Represents the average of the measured values. The smaller the RMSE and MAE values ​​are, the better the model prediction performance is. The higher the NSE value is, the better the performance is. NSE = 1 indicates a perfect modeling result.

[0053] Beneficial effects:

[0054] The present invention proposes a water quality prediction method based on generative adversarial network data enhancement. The method uses the BiTimeGAN neural network to learn the distribution law of the original water quality data and the time correlation between its features, thereby increasing the amount of feature data and solving the problem of low accuracy of prediction results of deep learning models in areas with insufficient data. The GRU method is used to capture the temporal characteristics of the extended data set for water quality prediction. The present invention establishes a hybrid deep learning model based on the BiTimeGAN module and the GRU module to increase the amount of water quality data and improve the prediction accuracy of the deep learning model. The superiority of the proposed method is reflected in the developed BiTimeGAN model, which takes into account the global and local characteristics of time series data, solves the limitation of traditional generative adversarial networks (GAN) and time series generation models (TimeGAN) that cannot capture the global and local feature information of time series data, and realizes the extraction and screening of global and local time series features of time series information, so that the generated data is close to the real data in static characteristics, while retaining the temporal dependency of time series data; compared with the results generated by other models, the established BiTimeGAN-GRU model has higher accuracy in time series data generation and water quality prediction. BRIEF DESCRIPTION OF THE DRAWINGS

[0055] Figure 1 is a general step flow chart of the present invention;

[0056] Figure 2 It is a detailed process flow chart of the steps of the present invention;

[0057] Figure 3 It is a structural diagram of the autoencoder of the present invention;

[0058] Figure 4 It is a structural diagram of the countermeasure component of the present invention;

[0059] Figure 5 A data feature distribution evaluation diagram of an embodiment of the present invention;

[0060] Figure 6 A CDF curve data generation result evaluation diagram for an embodiment of the present invention;

[0061] Figure 7 It is a comparison chart of the prediction result and the monitoring value of the embodiment of the present invention. DETAILED DESCRIPTION

[0062] It should be noted that, in the absence of conflict, the embodiments and features in the embodiments of the present application may be combined with each other. The present application is further described in detail below in conjunction with the accompanying drawings and specific embodiments.

[0063] like Figure 1 and Figure 2 As shown, a water quality prediction method based on generative adversarial network data enhancement includes: data acquisition and data processing part, water quality data enhancement part, generated data analysis and evaluation part, water quality prediction part and result discussion and analysis part.

[0064] Step 1: Data collection and data processing: Data collection and preprocessing of hydrological and meteorological parameters and pollutant data; local missing data are filled by mean interpolation method, outliers are identified and eliminated by 3σ principle, and the input data set is normalized to the maximum and minimum to complete data standardization;

[0065] Step 2, water quality data enhancement: The original water quality data is expanded using the BiTimeGAN (Bidirectional Time GenerativeAdversarial Network) model to enhance the training data set with insufficient data volume; the BiTimeGAN model includes an autoencoder component and an adversarial component, the autoencoder is used to establish a reversible mapping between high-dimensional features and low-dimensional feature spaces, and provides a latent space for the adversarial component to learn the potential time series features of the data in the low-dimensional representation, and the adversarial component is used to generate samples similar to the original water quality data through an adversarial process in the latent space;

[0066] Step 3: Data analysis and evaluation: The generated water quality data and the original water quality data are analyzed and evaluated to ensure the validity of the generated data. Five evaluation indicators, namely principal component analysis, t-distributed random neighborhood embedding, cumulative spectral density, maximum mean variance, and Euclidean distance, are used to measure the distribution similarity between the generated water quality data and the real data.

[0067] Step 4: Water quality prediction: Based on the Gated Recurrent Unit (GRU) model, the hydrological and meteorological historical time series data is combined with the generated data to build a deep learning model to predict the changes of target pollutants.

[0068] Step 5. Discussion and analysis of results: MAE (Mean Absolute Error), RMSE (Root Mean Square Error) and NSE (Nash-Sutcliffe Efficiency Coefficient) are used as evaluation parameters to evaluate the model prediction performance, the parameters are optimized through experiments, and its performance is verified by comparing it with the benchmark model.

[0069] Preferably, the autoencoder component includes an encoder and a decoder. The encoder is used for feature learning to convert the water quality time series data into a latent space, reduce the dimension of the data and extract its time features. The decoder is used to restore the data from the latent space back to the original feature space. The expressions of the encoder and the decoder are:

[0070] H t =enc(H t-1 ,X t )

[0071]

[0072] Among them, X t is the original water quality time series data, H t and H t-1 is the potential feature sequence of encoder dimensionality reduction at time t and t-1, is the time series sequence reconstructed by the decoder. In the autoencoder component, the decoder reconstructs the water quality time series data and the loss function expression according to the potential sequence output by the encoder:

[0073]

[0074] Where E represents the expected value, P is the original water quality data distribution, ∥·∥2 represents the L2 norm, and X t represents real time series data, represents the reconstructed time series data, and T is the total length of the time series.

[0075] Preferably, the adversarial component includes a generator network and a discriminator network. In the latent space, the sequence discriminator is used to distinguish the original latent sequence from the synthetic sequence generated by the sequence generator. The sequence generator is used to try to generate a real time series latent vector to deceive the sequence discriminator. In the generator network, the Gaussian noise Z t Sampling from a distribution, based on previously generated temporal features Generator generation In the discriminator network, the discriminator accepts the latent code and returns it to the classifier, which outputs the classifier to determine the label of the sequence, expressed as:

[0076]

[0077] y′ t =D(U t )

[0078] U t =C(H t ,U t-1 )

[0079] in, is to generate potential sequences; is the potential sequence generated at the previous moment; Z t is Gaussian noise; y′ t is the output probability of the discriminator for the current time step data; U t is the hidden state of the current time step; C is the update function of the RNN (Recurrent Neural Network) unit; U t-1 is the hidden state of the previous time step; H t is the original potential sequence; G and D are the generator and discriminator respectively, which are any multi-layer perceptrons;

[0080] Generate synthetic data that is close to the target distribution under time series data. For the G and D network adversarial training loss function, it is defined as an unsupervised loss function, expressed as:

[0081]

[0082] Among them, y t Represents the output probability of the real data; y′ t represents the output probability of generating data; X 1:T is the real time series data, T is the Tth moment; P is the original data distribution; is the generated data distribution;

[0083] The difference between the distributions is captured by the supervised loss:

[0084]

[0085] Among them, ‖·‖2 represents the L2 norm, H t represents the original latent sequence, represents the generated latent sequence.

[0086] Preferably, five evaluation indicators, including principal component analysis (PCA), t-distributed stochastic neighbor embedding (t-SNE), cumulative spectral density (CDF), maximum mean variance (MMD), and Euclidean distance (EDD), are used to measure the similarity of distribution between generated data and real data to verify the effectiveness of BiTimeGAN generated data.

[0087] Through the PCA (Principal Component Analysis) linear transformation method, the high-dimensional original data is projected into a new low-dimensional space coordinate system. This new coordinate system is composed of the directions with the largest variance in the data, namely the principal components; the principal components are linear combinations of the original features, which are used to retain the change information of the data to the greatest extent. During the transformation process, by identifying the most important directions in the data, PCA projects the data into these directions to complete the data dimensionality reduction and feature extraction. When applying PCA, the original data is standardized to eliminate the influence of different scales on the analysis results, and the covariance matrix C of the data set X is calculated:

[0088]

[0089] Where C is the covariance matrix, n is the number of samples, X′ is the centralized data, X′=X-μ, X is the original data matrix, μ is the mean of each column, and T is the transpose of the matrix; perform eigenvalue decomposition on the covariance matrix C, and select the eigenvectors with the largest eigenvalues ​​as the basis of the new coordinate system to form the principal component space of the data; project the original data X onto the selected principal component to obtain the reduced-dimensional data.

[0090] Preferably, t-SNE (t-Distributed Stochastic Neighbor Embedding) is used to discover the nonlinear structure in the data and retain all the information in the data. First, the data point x in the high-dimensional space is defined i and x j The similarity P between ij , use t distribution to measure the similarity in low-dimensional space, use KL divergence (Kullback-Leibler Divergence) to measure the difference between two probability distributions, and the optimization goal is to minimize all data points x i The sum of the KL divergences is expressed as:

[0091]

[0092] Among them, x i 、x j and x k is a data point in high-dimensional space, σ i is the local standard deviation of point i. j|i is the conditional probability of data point j given data point i, exp(·) is the natural exponential function; calculate the global similarity:

[0093]

[0094] Where N is the total number of data points, P ijis the global similarity between point i and point j. By combining the two conditional probabilities, we ensure that the similarity is symmetric and use t distribution to measure the similarity in low-dimensional space:

[0095]

[0096] Among them, y i and j is a data point in low-dimensional space, q ij is the conditional probability of a data point in low-dimensional space. The t distribution is used to measure the similarity between low-dimensional points, so that low-dimensional embedding can better show the local structure of the data. The KL divergence is used to measure the difference between two probability distributions. The optimization goal is to minimize the probability of all data points x i The sum of the KL divergences is expressed as:

[0097]

[0098] Where C represents the Kullback-Leibler (KL) divergence, which measures the difference between two probability distributions P and Q; P is the probability distribution of high-dimensional space data; Q is the probability distribution of low-dimensional space data; p ij is the probability of point i and point j in high-dimensional space; q ij is the probability of point i and point j in low-dimensional space; t-SNE uses the gradient descent method to minimize this loss function.

[0099] Preferably, MMD (Max Mean Discrepancy) measures the distance between the real data and the generated data in the reproducing kernel Hilbert space, where the smaller the MMD value, the closer the distribution and the higher the quality of the generated data. It is used to measure the pattern diversity of the data set generated in this study, and the expression is:

[0100]

[0101] Where K(·) is the mapping function that maps samples to the feature space H, n and h are the sample counts of x and y respectively; ||·|| H represents the calculation of the norm in the reproducing kernel Hilbert space; x i Represents the sample points sampled in the real data, y i Represents the sample points sampled from the generated data.

[0102] Preferably, EDD (Euclidean Distance) measures the real data X in the Euclidean distance space real And generate data X generate The smaller the EDD, the smaller the distribution difference between the generated data and the real data, and the better the data quality. The expression is:

[0103]

[0104] Among them, EDD represents the Euclidean distance between the real data and the generated data, which measures their similarity, and X real (i) represents the true data value at the i-th time step, X generate (i) represents the generated data value at the i-th time step, and t represents the total number of samples;

[0105] The probability function integral is used to describe the probability that the value of the time series q(t) is less than or equal to x. The probability distribution of the original data and the generated data are calculated respectively. The closer the CDF (Cumulative Distribution Function) curve of the generated data is to the CDF curve of the real data, the more similar the distribution of the generated data is to the distribution of the real data. The formula can be expressed as:

[0106]

[0107] Where CDF(X) represents the cumulative distribution function value of the random variable X, that is, the probability of being less than or equal to X, X represents the specific value of the random variable, and q(t) represents the probability density function, which describes the probability density of the random variable at point t.

[0108] Preferably, the root mean square error (RMSE), mean absolute error (MAE), and Nash-Sutcliffe efficiency coefficient (NSE) are used as evaluation indicators of model prediction accuracy. NSE judges the performance of the model by comparing the deviation between the predicted value and the true value. RMSE reflects the degree of error between the actual value and the predicted value by calculating the square root of the difference between the predicted value and the actual value. MAE calculates the absolute difference between the actual value and the observed value. The calculation formula is as follows:

[0109]

[0110]

[0111] Where n is the total number of samples, y i is the time series of monitoring, y′ i is the predicted time series, Represents the average of the measured values. The smaller the RMSE and MAE values ​​are, the better the model prediction performance is. The higher the NSE value is, the better the performance is. NSE = 1 indicates a perfect modeling result.

[0112] The water quality data enhancement part consists of an autoencoder component and an adversarial component. The autoencoder includes an encoder and a decoder. The structure is as follows Figure 3As shown in the figure. The goal of the encoder is to perform feature learning and convert the hydrological and water quality time series data into a latent space H, thereby reducing the dimension of the data and extracting its time features. The decoder is responsible for restoring the data from the latent space back to the original feature space. This process ensures that the latent sequence data in the latent space retains the key features and regular information of the original data, and the generated time series data can truly reflect the structure of the original data and the relationship between the features.

[0113] The adversarial component consists of two parts: the generator network and the discriminator network. Figure 4 As shown in Figure 2, the generator first outputs a Gaussian noise sequence into the latent space. The discriminator is used to distinguish the original hydrological and water quality latent sequences from the synthetic latent sequences generated by the generator, while the generator tries to generate a time series latent vector that is as real as possible to deceive the discriminator.

[0114] In order to verify the effectiveness of BiTimeGAN in data generation, t-SNE (t-distributed stochastic neighbor embedding) and PCA dimensionality reduction methods were used to evaluate the similarity between the generated data and the monitored data distribution of the dissolved oxygen (DO) at the Qiaotou Station in Guilin. The evaluation results are shown in Figure 2. Figure 5 As shown in the figure. From the PCA and t-SNE dimensionality reduction results, it can be seen that the distribution characteristics of the data generated by BiTimeGAN are basically consistent with the distribution characteristics of the original data. BiTimeGAN can effectively capture the distribution characteristics of the original data so that the generated data can still reflect the characteristics of the original data after dimensionality reduction. The data coverage rate is as high as 93.6%, indicating that the model can effectively learn the distribution characteristics of time series data.

[0115] MMD, EDD and CDF curve analysis methods were further used to evaluate the distribution difference between the generated data and the original data. The MMD and EDD results between the original data and the generated data are shown in Table 1. By comparing with the three benchmark models of GAN (Generative Adversarial Networks), WGAN (Wasserstein Generative Adversarial Networks) and TimeGAN (Time-series Generative Adversarial Networks), BiTimeGAN has the smallest MDD and EDD values, and the generated water quality sequence data has an MMD of 0.0008 and an EDD of 82.76. The results show that the water quality sequence data generated by BiTimeGAN has the highest similarity with the original data.

[0116] Table 1. Evaluation of MMD and EDD data generation results

[0117]

[0118] Figure 6 The CDF curves of the original DO monitoring data of Qiaotou Station and the data generated by different generative adversarial networks are shown. It can be seen that the DO time series data generated by other benchmark models have roughly the same trend as the original data, but the data generated by BiTimeGAN is almost completely consistent with the original data in terms of trend, indicating that the time series data generated by BiTimeGAN has better statistical similarity with the original data.

[0119] The constructed BiTimeGAN-GRU (Bidirectional Time Generative AdversarialNetwork-Gated Recurrent Unit) model was used to predict the concentration change of DO at Qiaotou Station. The prediction results are as follows: Figure 7 The prediction results show that the average error between the predicted value and the monitored value of DO is 0.48%, and the maximum relative error is 15.43%. The BiTimeGAN-GRU model shows good prediction performance in the entire prediction range.

[0120] Benchmark models such as MLP (Multi-Layer Perceptron), SVR (Support Vector Regression), RNN (Recurrent Neural Network), LSTM (Long Short-Term Memory), and GRU are used to verify the superiority of the proposed model. Table 2 shows the RMSE, MAE, and NSE results of different models such as MLP, SVR, RNN, LSTM, GRU, and BiTimeGAN-GRU for predicting DO at Qiaotou Station. The RMSE, MAE, and NSE obtained by the BiTimeGAN-GRU model for predicting DO are 0.325, 0.237, and 0.953, respectively, indicating the good performance of the constructed model.

[0121] Table 2. Prediction model evaluation

[0122]

[0123] Although embodiments of the present invention have been shown and described, it will be understood by those skilled in the art that various equivalent changes, modifications, substitutions and variations may be made to the embodiments without departing from the principles and spirit of the present invention, and that the scope of the present invention is defined by the appended claims and their equivalents.

Claims

1. A water quality prediction method based on generative adversarial network data enhancement, characterized in that , the method comprises: Step 1: Data collection and data processing: Data collection and preprocessing of hydrological and meteorological parameters and pollutant data; local missing data are filled by mean interpolation method, outliers are identified and eliminated by 3σ principle, and the input data set is normalized to the maximum and minimum to complete data standardization; Step 2, water quality data enhancement: The BiTimeGAN model is used to expand the original water quality data to enhance the training data set with insufficient data volume; the BiTimeGAN model includes an autoencoder component and an adversarial component, the autoencoder is used to establish a reversible mapping between high-dimensional features and low-dimensional feature spaces, and provides a latent space for the adversarial component to learn the potential time series features of the data in the low-dimensional representation, and the adversarial component is used to generate samples similar to the original water quality data through an adversarial process in the latent space; Step 3: Data analysis and evaluation: The generated water quality data and the original water quality data are analyzed and evaluated to ensure the validity of the generated data. Five evaluation indicators, namely principal component analysis, t-distributed random neighborhood embedding, cumulative spectral density, maximum mean variance, and Euclidean distance, are used to measure the distribution similarity between the generated water quality data and the real data. Step 4: Water quality prediction: Based on the GRU model, the historical hydrological and meteorological time series data are combined with the generated data to build a deep learning model to predict the changes of target pollutants; Step 5. Discussion and analysis of results: MAE, RMSE and NSE are used as evaluation parameters to evaluate the prediction performance of the model, parameters are optimized through experiments, and its performance is verified by comparing it with the benchmark model.

2. A water quality prediction method based on generative adversarial network data enhancement as claimed in claim 1, characterized in that: The autoencoder component includes an encoder and a decoder. The encoder is used for feature learning to convert water quality time series data into a latent space, reduce the dimension of the data and extract its time features. The decoder is used to restore the data from the latent space back to the original feature space. The expressions of the encoder and decoder are: H t =enc(H t-1 ,X t ) Among them, X t is the original water quality time series data, H t and H t-1 is the potential feature sequence of encoder dimensionality reduction at time t and t-1, is the time series sequence reconstructed by the decoder. In the autoencoder component, the decoder reconstructs the water quality time series data and the loss function expression according to the potential sequence output by the encoder: Where E represents the expected value, P is the original water quality data distribution, ∥·∥2 represents the L2 norm, and X t represents real time series data, represents the reconstructed time series data, and T is the total length of the time series.

3. The water quality prediction method based on generative adversarial network data enhancement according to claim 1, characterized in that: The adversarial component includes a generator network and a discriminator network. In the latent space, the sequence discriminator is used to distinguish the original latent sequence from the synthetic sequence generated by the sequence generator. The sequence generator is used to try to generate a real time series latent vector to deceive the sequence discriminator. In the generator network, the Gaussian noise Z t Sampling from a distribution, based on previously generated temporal features Generator generation In the discriminator network, the discriminator accepts the latent code and returns it to the classifier, which outputs the classifier to determine the label of the sequence, expressed as: y′ t =D(U t ) IN t =C(Ht,U t-1 ) in, is to generate potential sequences; is the potential sequence generated at the previous moment; Z t is Gaussian noise; y′ t is the output probability of the discriminator for the current time step data; U t is the hidden state of the current time step; C is the update function of the RNN unit; U t-1 is the hidden state of the previous time step; H t is the original potential sequence; G and D are the generator and discriminator respectively, which are any multi-layer perceptrons; Generate synthetic data that is close to the target distribution under time series data. For the G and D network adversarial training loss function, it is defined as an unsupervised loss function, expressed as: Among them, y t Represents the output probability of the real data; y′ t represents the output probability of generating data; X 1:T is the real time series data, T is the Tth moment; P is the original data distribution; is the generated data distribution; The difference between the distributions is captured by the supervised loss: Among them, ‖·‖2 represents the L2 norm, H t represents the original latent sequence, represents the generated latent sequence.

4. The water quality prediction method based on generative adversarial network data enhancement according to claim 1, characterized in that: Through the principal component analysis linear transformation method, the high-dimensional original data is projected into a new low-dimensional space coordinate system. This new coordinate system is composed of the directions with the largest variance in the data, namely the principal components. The principal components are linear combinations of the original features, which are used to retain the change information of the data to the greatest extent. During the transformation process, by identifying the most important directions in the data, the principal component analysis projects the data into these directions to complete the dimensionality reduction and feature extraction of the data. When applying the principal component analysis, the original data is standardized to eliminate the influence of different scales on the analysis results, and the covariance matrix C of the data set X is calculated: Where C is the covariance matrix, n is the number of samples, and X ′ is the centralized data, X ′ =X-μ, X is the original data matrix, μ is the mean of each column, and T is the transpose of the matrix; perform eigenvalue decomposition on the covariance matrix C, select the eigenvectors with the largest eigenvalues ​​as the basis of the new coordinate system to form the principal component space of the data; project the original data X onto the selected principal component to obtain the reduced-dimensional data.

5. The water quality prediction method based on generative adversarial network data enhancement according to claim 1, characterized in that: Through t-distributed random neighborhood embedding, nonlinear structures in data are discovered and all information in the data can be retained. First, the data point x in high-dimensional space is defined. i and x j The similarity P between ij , use t distribution to measure the similarity in low-dimensional space, use KL divergence to measure the difference between two probability distributions, and the optimization goal is to minimize all data points x i The sum of the KL divergences is expressed as: Among them, x i 、x j and x k is a data point in high-dimensional space, σ i is the local standard deviation of point i; p j|i is the conditional probability of data point j given data point i, exp(·) is the natural exponential function; calculate the global similarity: Where N is the total number of data points, P ij is the global similarity between point i and point j. By combining the two conditional probabilities, we ensure that the similarity is symmetric and use t distribution to measure the similarity in low-dimensional space: Among them, y i and j is a data point in low-dimensional space, q ij is the conditional probability of a data point in low-dimensional space. The t distribution is used to measure the similarity between low-dimensional points, so that low-dimensional embedding can better show the local structure of the data. The KL divergence is used to measure the difference between two probability distributions. The optimization goal is to minimize the probability of all data points x i The sum of the KL divergences is expressed as: Where C represents the Kullback-Leibler (KL) divergence, which measures the difference between two probability distributions P and Q; P is the probability distribution of high-dimensional space data; Q is the probability distribution of low-dimensional space data; p ij is the probability of point i and point j in high-dimensional space; q ij is the probability of point i and point j in low-dimensional space; t-SNE uses the gradient descent method to minimize this loss function.

6. The water quality prediction method based on generative adversarial network data enhancement according to claim 1, characterized in that: The maximum mean variance measures the distance between the real data and the generated data in the reproducing kernel Hilbert space, where the smaller the maximum mean variance value, the closer the distribution is and the higher the quality of the generated data. It is used to measure the pattern diversity of the data set generated in this study, and the expression is: Where K(·) is the mapping function that maps samples to the feature space H, n and h are the sample counts of x and y respectively; ||·|| H represents the calculation of the norm in the reproducing kernel Hilbert space; x i Represents the sample points sampled in the real data, y i Represents the sample points sampled from the generated data.

7. The water quality prediction method based on generative adversarial network data enhancement according to claim 1, characterized in that: Euclidean distance measures the real data X in Euclidean distance space. real And generate data X generate The smaller the EDD, the smaller the distribution difference between the generated data and the real data, and the better the data quality. The expression is: Among them, the Euclidean distance represents the Euclidean distance between the real data and the generated data, measuring their similarity, X real (i) represents the true data value at the i-th time step, X generate (i) represents the generated data value at the i-th time step, and t represents the total number of samples; The probability function integral is used to describe the probability that the value of the time series q(t) is less than or equal to x. The probability distribution of the original data and the generated data are calculated respectively. The closer the cumulative spectral density curve of the generated data is to the cumulative spectral density curve of the real data, the more similar the distribution of the generated data is to the distribution of the real data. The expression is: Where CDF(X) represents the cumulative distribution function value of the random variable X, that is, the probability of being less than or equal to X, X represents the specific value of the random variable, and q(t) represents the probability density function, which describes the probability density of the random variable at point t.

8. The water quality prediction method based on generative adversarial network data enhancement according to claim 1, characterized in that: The root mean square error, mean absolute error and Nash-Sutcliffe efficiency coefficient are used as evaluation indicators of model prediction accuracy. NSE judges the performance of the model by comparing the deviation between the predicted value and the true value. RMSE reflects the degree of error between the actual value and the predicted value by calculating the square root of the difference between the predicted value and the actual value. MAE calculates the absolute difference between the actual value and the observed value. The expression is: Where n is the total number of samples, y i is the time series of monitoring, y′ i is the predicted time series, Represents the average of the measured values. The smaller the RMSE and MAE values ​​are, the better the model prediction performance is. The higher the NSE value is, the better the performance is. NSE=1 indicates a perfect modeling result.

Citation Information

Patent Citations

  • Hydrological sequence enhancement and prediction method

    CN116502775A

  • A system for prediction modelling for synthetic time series meta data fusion

    IN202211018390A

  • Method for forecasting temperature in underground utility tunnel based on CA-TimeGAN and residual CNN-LSTM

    KR102617312B1

Cited By

  • Calcium formate production process safety monitoring method and system

    CN120704275A