Water taking and using abnormal data checking method based on deep learning neural network

By using the combination of unsupervised GAN and LSTM-RNN in the water resource monitoring system, the problems of accuracy and efficiency in traditional water resource verification methods are solved, and efficient anomaly detection of complex multivariate time series is achieved.

CN119202829APending Publication Date: 2024-12-27GANSU WANWEI INFORMATION TECH CO LTD
View PDF 0 Cites 2 Cited by

Patent Information

Application Number
CN202411247811.1
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2024-09-06
Publication Date
2024-12-27

AI Technical Summary

Technical Problem

Traditional water resource verification methods have problems such as low accuracy, long verification time period, untimely data and low accuracy. They cannot effectively identify nonlinear intrinsic correlations and indirect attacks in complex multivariate time series, resulting in the inability to effectively detect the amount of water consumption. exception data.

Method used

Using anomaly detection method based on unsupervised GAN, by training GAN models of multiple time series, combining LSTM-RNN to capture time correlation, the generator and discriminator adaptively generate high-dimensional regular sequences in the image generation domain, and compute with the discriminator. The identification loss and the residual loss of the reconstruction sequence are identified to identify outliers in the high-dimensional time series.

Benefits of technology

It improves the accuracy and efficiency of abnormal data verification in the water access monitoring system, and can more effectively identify abnormal points in complex data, which is better than existing methods.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure BDA0005031353590000033
    Figure BDA0005031353590000033
  • Figure BDA0005031353590000041
    Figure BDA0005031353590000041
  • Figure BDA0005031353590000043
    Figure BDA0005031353590000043
Patent Text Reader

Abstract

The invention relates to the technical field of data processing, in particular to a water taking and using abnormal data checking method based on a deep learning neural network. The invention provides a GAN-based unsupervised anomaly detection method, which is used for detecting abnormal data of a complex multi-process network physical system with a network sensor and an actuator, uses a plurality of time sequences to train a GAN model, uses an LSTM-RNN to capture time correlation, and uses the LSTM-RNN to detect the abnormal data of the complex multi-process network physical system. The method comprises the following steps: adaptively generating a GAN from an image generation domain to perform time sequence generation, uniformly training a GAN model by using a high-dimensional regular sequence to distinguish authenticity, and reconstructing a test sequence from a specific potential space; identification loss calculated by a trained discriminator and residual loss between a reconstruction sequence and a real test sequence are combined to detect abnormal points in a high-dimensional time sequence, and in a water taking and using monitoring system with complex data, the method is superior to an existing method in the aspect of checking abnormal data.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present invention relates to the field of data processing technology, and in particular to a method for verifying abnormal water withdrawal data based on a deep learning neural network. Background Art

[0002] Water resources are important resources necessary for human survival and development, and are also a key link in maintaining ecological balance. In the context of the current rapid growth of the global economy and population, the protection and management of water resources are increasingly valued by governments and society. The monitoring and control of water resources is the core content of water resource management, and is also an important means to improve the efficiency of water resource utilization and protect water resources. By verifying the short-term water withdrawal and use, water supply scheduling can be assisted to maximize the benefits of water supply. Therefore, the verification of abnormal water withdrawal and use data is of great value to the intelligentization of water resources supply and the improvement of the economic benefits of water resources supply.

[0003] However, traditional water resource verification methods have many problems, such as low accuracy, long verification time cycle, untimely verification data, low data accuracy, etc., and cannot meet practical applications. With the emergence of the Internet of Things, these traditional verification techniques have been unable to cope with the increasingly dynamic and complex characteristics of traditional information systems. Therefore, researchers have gone beyond normative or feature-based techniques and started to use supervised and unsupervised machine learning techniques to develop more intelligent and adaptive methods to identify anomalies or intrusions from big data.

[0004] However, even with the use of machine learning techniques, detecting anomalies in time series remains challenging. First, most supervised techniques require sufficient reliable normal data and labeled anomaly categories to learn, which is difficult to do in practice because anomalies are usually rare. Second, most existing unsupervised methods are built through linear projections and transformations, but the hidden intrinsic correlations of complex multivariate time series often have nonlinearities. Most current technologies simply compare the current state with the predicted normal range, but they cannot perform anomaly detection because the control boundaries are not flexible enough and indirect attacks cannot be effectively identified.

[0005] Therefore, to address these challenges, we propose a novel unsupervised GAN-based anomaly detection (GAN-AD) method that models the nonlinear associations between multiple time series and verifies anomalies based on a trained GAN model. Summary of the invention

[0006] In view of the defects of the prior art, the present invention proposes an unsupervised anomaly detection method based on GAN, which is used to detect abnormal data of complex multi-process network physical systems with network sensors and actuators, uses multiple time series to train the GAN model, adopts LSTM-RNN (Long-Short-Term-Recurrent Neural Networks, LSTM-RNN) to capture time correlation, and adaptively generates GAN from the image generation domain to generate time series. The GAN model is trained using high-dimensional regular sequences to distinguish between true and false, and the test sequence is reconstructed from a specific latent space. The discrimination loss calculated by the trained discriminator is combined with the residual loss between the reconstructed sequence and the real test sequence (the trained discriminator and the generator are used simultaneously) to detect abnormal points in the high-dimensional time series. In a water intake monitoring system with complex data, this method is superior to existing methods in verifying abnormal data. The method comprises the following steps:

[0007] Step 1: Obtain the original time series data of water consumption monitoring data: obtain the historical water consumption monitoring data within a certain period of time in the water supply area of ​​the water resource area to be verified;

[0008] Step 2: define, classify and pre-process the abnormal data of the historical water consumption data according to the time scale and the fluctuation range of the data;

[0009] Step 3: Define the Generative Adversarial Network (GAN) and use normal data to train the model.

[0010] Step 4: train the GAN with LSTM-RNN, and use the LSTM-RNN method to establish the water withdrawal and water consumption abnormal data verification model;

[0011] Step 5: Score the data for anomalies based on the model;

[0012] Step 6: Establish an abnormal data verification framework.

[0013] Beneficial Effects

[0014] A new type of unsupervised abnormal time series data verification method based on GAN. This technology uses GAN training data. The more data used for training, the closer the samples generated by the generator are to the real data, and the more accurate the verification results are. LSTM technology is used, which can learn the long-term dependency of data. Why introduce LSTM? Because GAN learns on orderly data, sometimes it will send memory to previous data like a human, but sometimes it will forget the memory. The use of LSTM-RNN fusion GAN can effectively solve this problem. DETAILED DESCRIPTION

[0015] An embodiment of the present invention is a method for verifying abnormal water withdrawal and usage data based on GAN-LSTM-RNN. Abnormal data detection of water withdrawal monitoring data is performed by combining a generative adversarial network (GAN) and a long short-term memory recurrent neural network (LSTM-RNN). First, data is prepared and GAN and LSTM-RNN models are trained. Then, GAN is used to generate sample data, and LSTM-RNN is used for prediction. Finally, abnormal data is marked by a threshold detector, and model performance is evaluated. Finally, the model is deployed in an actual monitoring system.

[0016] The specific steps of the present invention are as follows:

[0017] Step 1: Obtaining raw data

[0018] Obtain the original time series data of water consumption: Obtain the historical data from the database, including hourly water consumption (m 3 / h), daily water intake (m 3 / d);

[0019] Step 2: Preprocessing of water consumption monitoring data

[0020] The acquired historical water volume data is preprocessed according to the time scale and the fluctuation range of the data, including missing value processing, data normalization, etc., to ensure the continuity and consistency of the data; for better prediction, discontinuous and missing data should be interpolated. This embodiment adopts the K nearest neighbor interpolation method to interpolate the missing data. The K nearest neighbor interpolation method, its algorithm is to calculate the distances of the k samples closest to the complete variable of the missing sample, and finally use these k distances to weight the missing items of the missing samples corresponding to these k samples, so as to obtain an estimated value. The distance function is set by using auxiliary variables. There are many types of distance functions that define k nearest neighbor interpolation. If there is only one auxiliary variable X1, the distance function constructed is: D 1 =|x li -x lj |, the distance function constructed using multiple auxiliary variables is: D 2 =Subk ik |x ki -x kj |, where ik is the Mahalanobis distance. It indicates the importance of the kth variable. D 2 It is a distance function constructed for multiple auxiliary variables. It represents the distance between samples and is used to evaluate their similarity in multidimensional space. (x ki -x kj ) These are the differences between the two samples on the kth auxiliary variable. They indicate the degree of difference on the kth variable. S xxThis is an estimate of the covariance matrix of xi. The covariance matrix measures the linear dependence between samples and the degree of variation of the variables. It provides information about the shape and direction of the data distribution. This is S xx The inverse matrix is ​​used to solve linear equations and can be used to transform and analyze data. (x ki -x kj ) T Represents a vector (x ki -x kj ), where x ki and x kj is the value of the two samples on the kth auxiliary variable. This transposition operation is to meet the requirements of matrix multiplication in linear algebra.

[0021] This embodiment adopts the second method to interpolate missing values. The estimated value of the missing value after interpolation using k nearest neighbors is:

[0022]

[0023] In the formula, n represents the number of samples, a i represents the weight, y i is complete data, is the estimated value c for the missing data i Represents the number of closest interpolation, that is, the number of times the sample is used to estimate the missing value.

[0024] Step 3: Define Generative Adversarial Network (GAN)

[0025] First, define the architecture of GAN, including the generator and the discriminator. Use normal data to train the GAN model. The task of the generator is to generate samples similar to normal data, while the discriminator distinguishes the generated samples from the real normal data. Secondly, adjust the hyperparameters of GAN, such as learning rate, loss function, etc., to obtain better performance. Finally, verify the performance of GAN to ensure that the generator can generate samples similar to normal data. The results are shown in Table 1:

[0026]

[0027] Table 1 Part of the data preprocessing results

[0028] As can be seen from Table 1, after data preprocessing, the breakpoints in the data waveform disappear, while the overall characteristics of the data are fully preserved, laying the foundation for subsequent data analysis. It should be noted that the supplemented data points themselves are already outliers that can be intuitively identified. Therefore, in further analysis, even if there are repaired data in the outliers, they should not be included in the statistics to avoid repeated statistics and thus reduce the false detection rate.

[0029] 1. Define the architecture of GAN

[0030] GAN consists of a generator and a discriminator, where the generator is responsible for generating samples similar to real data, while the discriminator is responsible for distinguishing the generated samples from real data. The training process of GAN is a game process, where the generator and the discriminator compete with each other, and eventually the samples generated by the generator are closer and closer to the real data.

[0031] 2. Define the loss function

[0032] 2.1 The loss functions of the generator and discriminator are:

[0033] Generator loss function J G :The goal of the generator is to generate sufficiently realistic samples so that the discriminator cannot distinguish between the generated samples and the real data. Therefore, the loss function of the generator can be defined as the negative log-likelihood of the probability that the samples generated by the generator are discriminated as real data:

[0034]

[0035] Among them, z is the input noise of the generator, G(z) is the sample generated by the generator, and D is the discriminator

[0036] 2.2 Discriminator loss function J D : The goal of the discriminator is to distinguish between generated samples and real data, so the loss function of the discriminator can be defined as the sum of the probabilities of discriminating real data as real data and discriminating generated samples as generated data:

[0037]

[0038] Among them, p data (x) is the distribution of real data.

[0039] Step 4: Train GAN with LSTM-RNN

[0040] Long Short-Term Recurrent Neural Networks (LSTM-RNNs) have been shown to be able to learn complex time series by memorizing cells backward (or even forward) time steps. This method uses LSTM-RNN to replace the generator (G) and discriminator (D) of GAN to process CPS time series data. Following the architecture of the conventional GAN ​​framework, the GAN model is trained as a two-player minimax game.

[0041]

[0042] This represents a minimization operation on the generator G, i.e. the generator tries to minimize the entire loss function

[0043] This represents a maximization operation on the discriminator D, i.e. the discriminator tries to maximize the overall loss function

[0044] V(D, G): This is the objective function of the Generative Adversarial Network, which is the competition between the generator and the discriminator. The goal is to maximize the correct classification of real samples by D and maximize the correct classification of generated samples by 1-D. Therefore, this function measures the difference between the samples generated by the generator and the real samples.

[0045] This term represents the expected value of the real data x, where log D(x) is the distribution of the real data. The discriminator tries to maximize the discriminant result D(x) of the real data, that is, the probability of correctly classifying the real data into the real category.

[0046] This term represents the expected value of the sample G(z) generated by the generator, where z is a random vector sampled from the latent space distribution G(z). The discriminator tries to maximize the discriminant result D(G(z)) of the generated data, that is, the probability of correctly classifying the generated data into the generated category.

[0047] Among them, the generator G is an LSTM-RNN model, which implicitly defines the probability distribution of generated samples and can be recorded as G rnn (z), where z is a distribution from the hidden layer. The discriminator, which is another LSTM-RNN model, is then trained to minimize the average negative cross entropy between its predictions and the sequence labels (e.g., train D to recognize as many real training samples as possible and as many fake generated samples as possible). Therefore, the loss of the discriminator is:

[0048]

[0049] where x i is the training sample and should be identified as a true sample. rnn (zi ) are generated samples and should be identified as fake samples.

[0050] At the same time, the generator is trained to confuse the discriminator so that it can recognize as many real generated samples as possible. In other words, the loss of the generator is

[0051]

[0052] The generator loss and the discriminator loss are jointly processed by the optimizer to update G rnn and D rnn Parameters.

[0053] Step 5: GAN-based anomaly scoring

[0054] As an emerging unsupervised learning method, both the discriminator and generator of GAN are jointly trained to represent normal anatomical variations, which helps to identify abnormalities. In order to fully utilize the GAN model, it is necessary to drive the trained generator and discriminator to contribute to anomaly detection. Anomaly detection of CPSs time series data consists of the following two parts.

[0055] a. Anomaly detection with discrimination

[0056] Intuitively, the discriminator D after enough adversarial training iterations is a direct tool for anomaly detection because it can distinguish true from false with high sensitivity.

[0057] b. Residual Abnormality Detection

[0058] As mentioned earlier, the trained generator G is able to generate real samples, which is actually a mapping from latent variables to real data space: G(Z z~k ), can be seen as an ambiguous system model that reflects the normal data distribution. Due to the smooth transition of the latent space, if the inputs in the latent space are close, the samples output by the generator are similar. Therefore, if the corresponding Z can be found k The latent space X of the test data tes ,X tes and G(Z k ) can be explained by the degree of similarity between X tes follows the distribution reflected in G. That is, the residuals X tes and G(Z k ) can be used to identify abnormal test data.

[0059] In order to find the optimal Z corresponding to the test sample k , we first sample a random set Z from the latent space 1 , and input it into the generator to obtain the reconstructed original sample G(Z 1). Then, using tes The samples from the latent space are updated using the gradient of the error function defined by G(Z).

[0060]

[0061] This means that Z k The minimization operation is to find the optimal potential representation Z k To minimize the entire loss function. Er(X tes , G rnn (Z k )): This is the error function, which is used to measure the test sample X tes With the generator G rnn The generated sample G rnn (Z k ). Er is the error measurement function.

[0062] Simi(X tes , G rnn (Z k )): This is a similarity measure used to measure the test sample X tes Generate samples G with rnn (Z k ). Simi is a metric function used to measure the similarity between two samples.

[0063] For simplicity, the similarity between sequences can be defined as covariance.

[0064] If the error is small enough after enough iterations, the recorded sample Z k As the corresponding mapping of the test sample in the latent space. Therefore, the residual of the test sample at time t is calculated as:

[0065]

[0066] This is a test sample The residual at time step t. It represents the measured value And generate samples The sum of the differences between .

[0067] is the measured value of the i-th variable of the test sample at time step t. Usually, is an n-dimensional vector representing the measured values ​​of n variables at time step t.

[0068] This is the generator G rnn Based on potential samples The predicted value of the i-th variable for the generated sample. It is a test sample The corresponding mapping in the latent space is the optimal latent representation found.

[0069] n: This is the number of variables in the test sample, i.e. the dimension of the features.

[0070] in is the measured value of n variables at time step t. In summary, the anomaly score for anomaly detection is:

[0071]

[0072] This is a test sample Anomaly score. It is an indicator used in anomaly detection strategies to determine whether a sample is abnormal.

[0073] λ: This is a weight parameter used to balance the residual and the discriminator error The importance between the two terms. It usually takes a value between 0 and 1 and controls the relative contribution of the two terms.

[0074] This is a test sample The residual represents the difference between the measured value of the test sample and the sample generated by the generator.

[0075] This is the discriminator D rnn For test samples It represents the discriminator's estimation of whether the test sample is a real sample.

[0076] Our GAN-based unsupervised anomaly detection strategy is summarized as above. In the formula, The residual error of the test sample and the discriminant error of the discriminator are comprehensively considered to evaluate the abnormality of the sample. The larger it is, the more likely the sample is anomalous.

[0077] Step 6: Abnormal Verification Framework

[0078] We formulate the anomaly detection problem for multivariate time series as follows. First, consider an m-dimensional time series X = {X (t) , t=1,...,T}, with a length of T, where is an m-dimensional vector of the readings of m variables at time t. Typically, sensor measurements are large time series with length The length may be very large Therefore, multiple predefined time series can be obtained by taking a window of length T on the original data stream, that is: X = X (1) , ..., X (L) .

[0079] The GAN model is based on a normal time series dataset X real To train and generate "fake" samples X that "look like real" gs Next, test the time series dataset X tes (or X att ), this dataset is the real-time monitoring data of the IoT perception system, which can be analyzed through the training model to detect anomalies.

[0080] Then, considering that using the LSTM-RNN model with high-dimensional input will incur higher computational costs, we use principal component analysis (PCA) to project the high-dimensional data into the principal component (PC) projection space, thereby transforming the data into The projection process can be expressed as:

[0081] P = PCA(X real ) (7a)

[0082]

[0083] P: This is the projection matrix obtained during the PCA process, which contains the original data X real Transformation information projected into the principal component space.

[0084] X real : This is the training dataset, i.e. the normal time series dataset, which is usually used to train the GAN model. It is an m×T matrix, where m is the number of variables and T is the number of time steps.

[0085] This is the test dataset, which is the real-time time series dataset to be analyzed.

[0086] in m is the original dimension (i.e., the number of system variables) and n is the number of principal components retained. The projected variables are then input into the GAN-AD model, and the anomaly score is output according to Formula 6. Next, the following label assignment function can be used to identify the test time series data X with a step size of t tes Is the i-th variable under attack?

[0087]

[0088] Where t = 1, ..., T, i = 1, ..., n. If the cross entropy error H(...) outlier value is greater than a certain value τ, it is considered an outlier.

[0089] The overall model structure consists of two parts: training and testing. The connection between these two parts is the latent variable. The data features are stored in the latent variables, which will come in handy during testing.

[0090] The training part is a typical GAN ​​model. The game between the discriminator and the generator improves the ability to identify abnormal data. The generator is used to generate realistic sample data, and the discriminator is used to distinguish between real data and generated data. The generator tries every means to deceive the discriminator and continuously improves its own generation ability. The GAN model is trained using multiple time series. Through the adversarial training method, the generator and the discriminator are alternately trained until the generator can generate sufficiently realistic sample data.

[0091] Adding and building an LSTM-RNN model based on GAN can capture long-term dependencies and nonlinear associations in time series data. Input layer design: Determine the structure of the input layer, including the number of input time steps and the number of features. For example, for a time series input window size of 30 days and the number of features per day is N, the size of the input layer is (30, N).

[0092] LSTM layer design: Add one or more LSTM layers, each containing a certain number of LSTM units. The LSTM layer can capture long-term dependencies in time series data.

[0093] Dense layer design: A fully connected layer (Dense layer) is added after the LSTM layer to generate the final prediction results.

[0094] Activation function and loss function: Select appropriate activation function (such as ReLU, tanh) and loss function (such as mean square error MSE), and compile the model.

[0095] The detection part starts with data preparation, establishing a mapping relationship between the sample data and the latent variable space, and then giving the mapping result as input to the GAN generator. The generator is then trained to obtain outliers, and the latent variable input is reconstructed using the generator. The residual loss is then calculated with the input data to obtain the residual loss. The input data is also given to the discriminator to calculate the discrimination loss. Finally, the two losses are combined to obtain the final anomaly score.

[0096] The specific implementation steps of the exception verification framework are as follows:

[0097] 1. Data preparation

[0098] Data collection: Collect water use data, including water usage, time, etc.

[0099] Data cleaning: Process missing values, duplicate values, and noise in the data to ensure data quality and consistency.

[0100] Data annotation: Use historical data to annotate known anomalies and normal data for use in model training and evaluation.

[0101] 2. Feature Engineering

[0102] Feature extraction: Extract meaningful features, time series features, and water consumption trends from raw data.

[0103] Feature selection: Select key features based on relevance and importance to reduce dimensionality and improve model efficiency and performance.

[0104] 3. Model selection and construction

[0105] Select the model architecture: According to the data characteristics and business needs, we choose to define the generative adversarial network (GAN) and add the recurrent neural network (RNN) and long short-term memory network (LSTM) on this basis.

[0106] Model design: Design the model structure including the number of network layers, number of neurons in each layer, activation function, loss function, etc.

[0107] Model compilation: Select the optimizer (such as Adam, SGD, etc.) and evaluation metric (anomaly score), and compile the model.

[0108] 4. Model Training

[0109] Data partitioning: Divide the dataset into training set, validation set, and test set to ensure that there is sufficient data support for model training and evaluation.

[0110] Model training: The training data is input into the model for training, and the model parameters are adjusted through the back propagation algorithm so that the model can accurately identify abnormal data.

[0111] Hyperparameter tuning: Adjust hyperparameters such as learning rate and batch size to optimize model performance.

[0112] 5. Model evaluation and validation

[0113] Model evaluation: Use the validation set to evaluate the model, calculate the model's accuracy, recall, F1 value and other indicators, and judge the model performance.

[0114] Cross-validation: Use the cross-validation method to verify the stability and generalization ability of the model to ensure that the model performs consistently on different data sets.

[0115] 6. Construction of abnormal verification framework

[0116] Real-time data input: Real-time water withdrawal and usage data is input into the model for anomaly detection.

[0117] Anomaly identification and alarm: When the model detects abnormal data, it immediately issues an alarm signal and records relevant information about the abnormal data.

[0118] Abnormal data verification: Further check the detected abnormal data and confirm whether it is indeed abnormal in combination with other information (such as historical data, on-site inspections, etc.).

[0119] 7. Model deployment and maintenance

[0120] Model deployment: Deploy the trained model to the actual business system to achieve real-time water use anomaly detection.

[0121] Model update: Regularly retrain and optimize the model with new data to ensure the detection accuracy and adaptability of the model.

[0122] System maintenance: Regularly maintain the system to ensure system stability and reliability.

[0123] 8. Result analysis and feedback

[0124] Result Analysis: Perform statistical analysis on detected anomalies to identify the root causes of potential problems.

[0125] Feedback mechanism: Establish a feedback mechanism to feed back abnormal detection results to relevant departments for rectification and optimization.

[0126] The anomaly detection results are shown in Table 2 below.

[0127]

[0128] Table 2 Monitoring results of abnormal values ​​of some data

[0129] The criteria for defining abnormal types are controllable. The criteria used in this case are as follows: abnormal data that deviates from the normal data range by more than 15% is considered a large abnormality, and less than 15% is considered a small abnormality.

[0130] Glossary

[0131] GAN (Generative Adversarial Network): is a data model technology trained through a generator and a discriminator.

[0132] LSTM-RNN (Long-Short-Term-Recurrent Neural Networks): a time-recurrent neural network.

Claims

1. A method for checking abnormal water use data based on deep learning neural network, characterized in that The steps include: Step 1: Obtain the original time series data of water consumption monitoring data, and obtain the historical water consumption monitoring data within a certain period of time in the water supply area of ​​the water resource area to be verified; Step 2: define, classify and pre-process the abnormal data of the historical water consumption data according to the time scale and the fluctuation range of the data; Step 3: Define the Generative Adversarial Network (GAN) and use normal data to train the model. Step 4: train the GAN with LSTM-RNN, and use the LSTM-RNN method to establish the water withdrawal and water consumption abnormal data verification model; Step 5: Score the data for anomalies based on the model; Step 6: Establish an abnormal data verification framework.

2. According to claim 1, a method for checking abnormal water intake data based on deep learning neural network is characterized in that The original data acquisition in step 1 is to obtain the original time series data of water consumption: obtain the data of a historical period from the database, including the hourly water consumption (m 3 / h), daily water intake (m 3 / d).

3. According to claim 1, a method for checking abnormal water intake data based on deep learning neural network is characterized in that Preprocessing of water consumption monitoring data in step 2 The historical water volume data obtained are preprocessed according to the time scale and the fluctuation range of the data, including missing value processing, data normalization, etc., and the discontinuous missing data are interpolated. The missing data are interpolated using the K nearest neighbor interpolation method, and the distances of the k samples closest to the complete variable of the missing sample are calculated respectively. Finally, these k distances are used to weight the missing items of the missing samples corresponding to these k samples to obtain the estimated value; the distance function is set by using auxiliary variables. There are many types of distance functions that define k nearest neighbor interpolation. If there is only one auxiliary variable X1, the constructed distance function is: D1=|x li -x lj |, the distance function constructed using multiple auxiliary variables is: D2 = Subk ik |x ki -x kj |, where ik is the Mahalanobis distance, indicating the importance of the kth variable D2 is a distance function constructed for multiple auxiliary variables; it represents the distance between samples and is used to evaluate their similarity in multidimensional space; (x ki —x kj ) These are the differences between the two samples on the kth auxiliary variable; they indicate the degree of difference on the kth variable; S xx This is an estimate of the covariance matrix of xi. The covariance matrix measures the linear correlation between samples and the degree of variation of the variables. It provides information about the shape and direction of the data distribution. This is S xx The inverse matrix is ​​used to solve linear equations and to transform and analyze data; (x ki -x kj ) T Represents a vector (x ki —x kj ), where x ki and x kj are the values ​​of the two samples on the kth auxiliary variable.

4. According to claim 2, a method for checking abnormal water intake data based on deep learning neural network is characterized in that The estimated value of the missing value after k-nearest neighbor interpolation in step 2 is: In the formula, n represents the number of samples, a i represents the weight, y i is complete data, is the estimated value c for the missing data i Represents the number of closest interpolation, that is, the number of times the sample is used to estimate the missing value.

5. According to claim 1, a method for checking abnormal water use data based on deep learning neural network is characterized in that In step 3, the generative adversarial network GAN is defined First, define the architecture of GAN, including the generator and the discriminator. Use normal data to train the GAN model. The task of the generator is to generate samples similar to normal data, while the discriminator is to distinguish the generated samples from the real normal data. Secondly, adjust the hyperparameters of GAN, such as learning rate and loss function, to obtain better performance. Finally, verify the performance of GAN to ensure that the generator can generate samples similar to normal data. The loss functions of the generator and discriminator are: Generator loss function J G :The goal of the generator is to generate sufficiently realistic samples so that the discriminator cannot distinguish between the generated samples and the real data. Therefore, the loss function of the generator is defined as the negative log-likelihood of the probability that the samples generated by the generator are discriminated as real data: Among them, z is the input noise of the generator, G(z) is the sample generated by the generator, and D is the discriminator; Discriminator loss function J D : The goal of the discriminator is to distinguish between generated samples and real data, so the loss function of the discriminator is defined as the sum of the probabilities of discriminating real data as real data and discriminating generated samples as generated data: Among them, p data (x) is the distribution of real data.

6. According to claim 1, a method for checking abnormal water use data based on deep learning neural network is characterized in that In step 4, train the GAN with LSTM-RNN LSTM-RNN is used to replace the generator G and discriminator D of GAN to process the time series data of CPS; following the architecture of the conventional GAN ​​framework, the GAN model is trained as a two-player minimax game; This represents a minimization operation on the generator G, i.e. the generator tries to minimize the entire loss function; This represents a maximization operation on the discriminator D, i.e. the discriminator tries to maximize the entire loss function; V(D, G): This is the objective function of the generative adversarial network, that is, the competition between the generator and the discriminator; the goal is to maximize the correct classification of D for real samples and maximize the correct classification of 1-D for generated samples. This function measures the difference between the samples generated by the generator and the real samples; This term represents the expected value of the real data x, where logD(x) is the distribution of the real data; the discriminator tries to maximize the discriminant result D(x) of the real data, that is, the probability of correctly classifying the real data into the real category; This term represents the expected value of the sample G(z) generated by the generator, where z is a random vector sampled from the latent space distribution G(z); the discriminator tries to maximize the discriminant result D(G(z)) of the generated data, that is, the probability of correctly classifying the generated data into the generated category; Among them, the generator G is an LSTM-RNN model, which implicitly defines the probability distribution of the generated samples, denoted by G rnn (z), where z is a distribution from the hidden layer; the discriminator, which is another LSTM-RNN model, is then trained to minimize the average negative cross entropy between its predictions and the sequence labels; the loss of the discriminator is thus: where x i is the training sample and should be identified as a true sample. rnn (z i ) is a generated sample and should be identified as a fake sample; At the same time, the generator is trained to confuse the discriminator so that it can recognize as many real generated samples as possible. The loss of the generator is The generator loss and the discriminator loss are jointly processed by the optimizer to update G rnn and D rnn Parameters.

7. According to claim 1, a method for checking abnormal water use data based on deep learning neural network is characterized in that The GAN-based anomaly scoring in step 5 Anomaly detection in CPSs time series data consists of the following two parts: a. anomaly detection with discrimination and b. residual anomaly detection; a. Anomaly detection with discrimination The discriminator D after enough adversarial training iterations is a direct tool for anomaly detection; b. Residual Abnormality Detection As mentioned earlier, the trained generator G can generate real samples and is a mapping from latent variables to real data space: G(Z z~k ), is considered as an ambiguous system model reflecting the normal data distribution; due to the smooth transition of the latent space, if the input of the latent space is close, the samples output by the generator are similar; if the corresponding Z is found k The latent space X of the test data tes ,X tes and G(Z k ) is explained by the similarity between tes follows the distribution reflected in G; that is, the residuals X tes and G(Z k ) can be used to identify abnormal test data; Find the optimal Z corresponding to the test sample k , we first sample a random set Z from the latent space 1 , and input it into the generator to obtain the reconstructed original sample G(Z 1 ); Then, using X tes Update the samples from the latent space using the gradient obtained from the error function defined by G(Z); This means that Z k The minimization operation is to find the optimal potential representation Z k To minimize the entire loss function; Er(X tes , G run (Z k )): This is the error function, which is used to measure the test sample X tes With the generator G rnn The generated sample G run (Z k ) is the difference or similarity between them; Er is the error measurement function; Simi(X tes , G rnn (Z k )): This is a similarity measure used to measure the test sample X tes Generate samples G with rnn (Z k ) is the similarity between two samples; Simi is a metric function used to measure the similarity between two samples; The similarity between sequences is defined as covariance, then the sample Z of the record k As the corresponding mapping of the test sample in the latent space; therefore, the residual of the test sample at time t is calculated as: This is a test sample The residual at time step t, which represents the measured value And generate samples The sum of the differences between is the measured value of the i-th variable of the test sample at time step t. Usually, is an n-dimensional vector representing the measured values ​​of n variables at time step t; This is the generator G rnn Based on potential samples The predicted value of the i-th variable of the generated sample; It is a test sample The corresponding mapping in the latent space, i.e. the optimal latent representation found; n: This is the number of variables in the test sample, i.e. the dimension of the feature; in are the measured values ​​of n variables at time step t; the anomaly score used for anomaly detection is: This is a test sample The anomaly score is an indicator used in anomaly detection strategies to determine whether a sample is abnormal. λ: This is a weight parameter used to balance the residual and the discriminator error The importance between the two terms; it usually takes values ​​between 0 and 1 and controls the relative contribution of the two terms; This is a test sample The residual of , which represents the difference between the measured value of the test sample and the sample generated by the generator; This is the discriminator D rnn For test samples The discrimination error of ; it represents the discriminator's estimate of whether the test sample is a real sample; In the formula, The residual error of the test sample and the discrimination error of the discriminator are comprehensively considered to evaluate the abnormality of the sample.

8. According to claim 1, a method for checking abnormal water use data based on deep learning neural network is characterized in that The abnormality verification framework in step 6 The anomaly detection problem of multivariate time series is formulated as follows. First, consider an m-dimensional time series X = {X (t) , t=1,...,T}, with a length of T, where is an m-dimensional vector of the readings of m variables at time t; typically, sensor measurements are large time series with length The length may be very large Therefore, multiple predefined time series are obtained by taking a window of length T on the original data stream, that is: X = X (1) , ..., X (L) ; The GAN model is based on a normal time series dataset X real For training, and generate samples X gs Next, test the time series dataset X tes (or X att ), this data set is the real-time monitoring data of the IoT perception system, which is analyzed through the training model to detect abnormal points; Then, considering that using the LSTM-RNN model with high-dimensional input will incur higher computational costs, we use principal component analysis (PCA) to project the high-dimensional data into the principal component (PC) projection space, thereby transforming the data into The projection process can be expressed as: P=PCA(X real ) (7a) P: This is the projection matrix obtained during the PCA process, which contains the original data X real Transformation information projected into principal component space; X real : This is the training dataset, i.e. the normal time series dataset, which is usually used to train the GAN model; It is an m×T matrix, where m is the number of variables and T is the number of time steps; This is the test dataset, i.e. the real-time time series dataset to be analyzed; in m is the original dimension, that is, the number of system variables, and n is the number of principal components retained; then the projected variables are input into the GAN-AD model, and according to the output anomaly score, the following label assignment function is used to identify the test time series data X with a step size of t tes Is the i-th variable under attack? Where t = 1, ..., T, i = 1, ..., n; if the cross entropy error H(...) outlier value is greater than a certain value τ, it is considered an outlier.

Citation Information

Cited By

  • Supervised time sequence water level data generation method and system and storage medium

    CN119623531A

  • Plant-based fermentation material production information tracing method and system

    CN120031580A