Abnormal data detection method and device
The low-dimensional characteristics of the equipment operation data are extracted through the deep convolutional automatic encoder, and the decision threshold is determined in combination with reconstruction error, maximum mean error and nonlinear prediction error. The problem of insufficient labeled data or abnormal points in household scenarios such as gas water heaters is solved, effectively detecting and identifying abnormal data, and improving equipment security and user experience.
Patent Information
- Application Number
- CN202411861964.5
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2024-12-17
- Publication Date
- 2025-04-29
Smart Images

Figure CN119903414A_ABST
Abstract
Description
Technical Field
[0001] The present invention relates to the technical field of data processing, and in particular to an abnormal data detection method and device. Background Art
[0002] With the rapid development of industry, the Internet of Things, and technology, major companies have begun to use sensors and other equipment to monitor equipment and systems, which continuously generate massive amounts of data. Extracting key indicators from massive data for anomaly detection is an important means to prevent accidents and reduce economic losses. Anomaly detection is an important process for identifying unexpected items or events, and is an important task in the data mining process. Data mining can further improve equipment safety, ensure user experience, extend equipment life, and reduce maintenance costs.
[0003] The anomaly detection schemes in the related art are mainly aimed at technical fields such as industrial production equipment failures and financial analysis, and the anomaly detection schemes are mainly used to detect individual use cases, and the abnormal data is usually individual data. However, there are many abnormal data in the equipment operating data in household scenarios such as gas water heaters, and the data in this scenario are mostly unlabeled data or data with insufficient abnormal points to be labeled and trained for anomaly detection models, which is very different from the data in the technical fields applicable to anomaly detection in the related art. Therefore, the anomaly detection method of the related art is not suitable for anomaly detection of equipment operating data in household scenarios such as gas water heaters. Summary of the invention
[0004] In view of this, the present invention provides an abnormal data detection method and device to solve the problem that the abnormal detection method in the related art is not suitable for abnormal detection of equipment operating condition data in household scenarios such as gas water heaters.
[0005] In a first aspect, the present invention provides a method for detecting abnormal data, the method comprising:
[0006] Obtain device operation data, which includes labeled source domain data and unlabeled target domain data for anomaly detection;
[0007] A deep convolutional autoencoder is used to extract low-dimensional features of equipment operation data;
[0008] Reconstruct and map the low-dimensional features to the original input space of the equipment operation data to obtain the reconstructed features;
[0009] Determine the reconstruction error of the deep convolutional autoencoder based on the reconstruction features;
[0010] Determine the maximum mean error between source domain data and target domain data;
[0011] Determine nonlinear prediction errors of equipment operating data;
[0012] Determine the decision threshold for judging data abnormality based on the reconstruction error, maximum mean error and nonlinear prediction error;
[0013] Based on the decision threshold, detect abnormal data in the target domain data.
[0014] The abnormal data detection method of the embodiment of the present invention reconstructs the device operation data to obtain a reconstruction, determines the reconstruction error of the deep convolutional autoencoder used in the reconstruction process, determines the maximum mean error of the source domain data and the target domain data and the nonlinear prediction error of the device operation data, and then determines the decision threshold for judging data abnormality based on the reconstruction error, the maximum mean error and the nonlinear prediction error, and detects abnormal data in the target domain data based on the decision threshold. Therefore, for the data distribution abnormality problem in application scenarios such as gas water heaters, which are mostly unlabeled data or lack of abnormal points, the domain adaptive method is used to use the maximum mean error to pull the feature distribution between the source domain data and the target domain data, thereby effectively reducing the distribution difference problem between the data, effectively identifying and detecting abnormal data in application scenarios such as gas water heaters, improving the safety of equipment such as gas water heaters, and significantly improving the user experience.
[0015] In an optional embodiment, before using the deep convolutional autoencoder to extract low-dimensional features of the equipment operation data, the method further includes:
[0016] Preprocess the equipment operation data;
[0017] Data preprocessing includes at least one of the following: cleaning, noise removal and standardization.
[0018] The abnormal data detection method of the embodiment of the present invention effectively improves the validity of the original data by performing data preprocessing such as cleaning, noise removal and standardization on the equipment operation data, and avoids the influence of obvious redundant data on the data anomaly detection result.
[0019] In an optional implementation, a deep convolutional autoencoder including an encoder and a decoder is used, and the encoder extracts low-dimensional features of the equipment operation data using the following formula (1):
[0020] z e =e(x) (1)
[0021] Among them, z e Represents low-dimensional features;
[0022] x is the data time series representation of equipment operation data.
[0023] The abnormal data detection method of the embodiment of the present invention adopts a deep convolutional autoencoder to extract low-dimensional features of equipment operation data. The deep convolutional autoencoder extracts local features through multiple convolutional layers. Each pooling layer extracts the maximum value of each fragment of the feature map to generate a smaller feature map, retaining more important information, and providing effective input data for reconstructing the equipment operation data.
[0024] In an optional implementation, the low-dimensional features are reconstructed and mapped to the original input space of the equipment operation data to obtain the reconstructed features, including:
[0025] The following formula (2) is used to obtain the reconstructed features through the decoder:
[0026] x ′ =d(z e ) (2)
[0027] Among them, x ′ Represents reconstruction features;
[0028] z e Represents low-dimensional features.
[0029] In an optional implementation, determining a reconstruction error of a deep convolutional autoencoder according to the reconstruction feature includes:
[0030] The reconstruction error is determined using the following formula (3):
[0031]
[0032] Among them, L r represents the reconstruction error;
[0033] x is the data time series representation of the equipment operation data;
[0034] x ′ Represents reconstruction features;
[0035] is the square of the Frobenius norm.
[0036] In an optional implementation, determining the maximum mean error between the source domain data and the target domain data includes:
[0037] Project the data of the source domain and the target domain into the Hilbert space;
[0038] The maximum mean error is determined using the following formula (4):
[0039]
[0040] Among them, MMD defines a feature map That is, the X space is projected onto the reproducing kernel Hilbert space H;
[0041] Assume that in space X, Z is a low-dimensional feature The distribution of P in space z is the feature representation z (i) Gaussian distribution of the target H in the reproducing kernel Hilbert space; L MMD (Z,P z ) is the maximum mean error of the two distributions;
[0042] It is a low-dimensional feature representation;
[0043] Represents the low-dimensional feature z (i) Representation mapped to Hilbert space;
[0044] Given a latent representation Where d is a latent space, v is all the time steps of an iteration cycle, is a set of real numbers of dimension v×d.
[0045] The abnormal data detection method of the embodiment of the present invention adopts the domain adaptation maximum mean difference to further narrow the data feature distribution of the source domain data and the target domain data, thereby reducing the inter-class distance of the equipment operation data. At the same time, the data of the source domain and the target domain are projected into the Hilbert space, retaining more nonlinear information.
[0046] In an optional implementation, determining a nonlinear prediction error of equipment operation data includes:
[0047] Based on the bidirectional long short-term memory with attention mechanism, the nonlinear prediction error of equipment operation data is determined using the following formula (5):
[0048]
[0049] Where Ln represents the nonlinear prediction error;
[0050] z v is the given input of the bidirectional long short-term memory;
[0051] y v is the hidden state output of the bidirectional long short-term memory;
[0052] is the square of the Frobenius norm;
[0053] Y v =∑ v A v *y v ′, where A is the weight matrix.
[0054] The abnormal data detection method of the embodiment of the present invention utilizes the bidirectional long short-term memory with attention mechanism to learn the time-related overall and local context information in the time series of the device operation data, thereby solving the problem that the time series of the device operation data in household scenarios such as gas water heaters undergoes diversified changes over time. The nonlinear prediction error of the device operation data is determined on the basis of retaining the original information of the device operation data to the greatest extent. Therefore, the nonlinear prediction error is combined with other operations to more accurately determine the decision threshold for determining data abnormality.
[0055] In an optional implementation, determining a decision threshold for determining data abnormality based on the reconstruction error, the maximum mean error, and the nonlinear prediction error includes:
[0056] Construct the objective function based on the reconstruction error, the maximum mean error and the nonlinear prediction error;
[0057] The gradient descent method is used to train the model and iteratively update the parameters of the objective function until the objective function converges to obtain the decision threshold for determining data anomalies.
[0058] The abnormal data detection method of the embodiment of the present invention constructs an objective function based on reconstruction error, maximum mean error and nonlinear prediction error, and uses the gradient descent method to train the model, iteratively updates the parameters of the objective function until the objective function converges, and obtains a decision threshold for determining data abnormalities. In the process of determining the reconstruction error, a deep convolutional autoencoder is used to retain more important information to the maximum extent, and in the process of determining the maximum mean error, a domain-adaptive maximum mean difference is used to further narrow the data feature distribution of the source domain data and the target domain data, thereby reducing the inter-class distance between the normal data and the abnormal data of the equipment operation data. The nonlinear prediction error uses a bidirectional long short-term memory with an attention mechanism to accurately calculate the overall or local context information in the hidden state. As a result, the equipment operation data is detected from multiple angles to obtain a more accurate decision threshold for determining data abnormalities, thereby obtaining a more accurate abnormal data detection result.
[0059] In an optional implementation, the objective function is a function shown in the following formula (6):
[0060] f(σ)=L r +αL MMD +βLn (6)
[0061] Among them, f(σ) is the objective function;
[0062] L r represents the reconstruction error;
[0063] L MMDrepresents the maximum mean difference;
[0064] Ln represents the nonlinear prediction error;
[0065] α and β are the loss function parameters of the objective function.
[0066] In a second aspect, the present invention provides an abnormal data detection device, the device comprising:
[0067] An acquisition module is used to acquire device operation data, which includes source domain data with labels and target domain data without labels for anomaly detection.
[0068] A low-dimensional module, which is used to extract low-dimensional features of equipment operation data using a deep convolutional autoencoder;
[0069] A reconstruction module is used to reconstruct and map low-dimensional features to the original input space of equipment operation data to obtain reconstructed features;
[0070] A reconstruction error module, used to determine the reconstruction error of the deep convolutional autoencoder based on the reconstruction features;
[0071] A mean error module is used to determine the maximum mean error between source domain data and target domain data;
[0072] A prediction error module, used to determine the nonlinear prediction error of equipment operation data;
[0073] A decision module is used to determine a decision threshold for judging data abnormality based on the reconstruction error, the maximum mean error and the nonlinear prediction error;
[0074] The detection module is used to detect abnormal data in the target domain data based on the decision threshold. BRIEF DESCRIPTION OF THE DRAWINGS
[0075] In order to more clearly illustrate the specific implementation methods of the present invention or the technical solutions in the prior art, the drawings required for use in the specific implementation methods or the description of the prior art will be briefly introduced below. Obviously, the drawings described below are some implementation methods of the present invention. For ordinary technicians in this field, other drawings can be obtained based on these drawings without paying creative work.
[0076] Figure 1 is a flow chart of an abnormal data detection method according to an embodiment of the present invention;
[0077] Figure 2 is a flow chart of another abnormal data detection method according to an embodiment of the present invention;
[0078] Figure 3A schematic diagram of a model framework of an abnormal data detection model in an abnormal data detection method according to an embodiment of the present invention is shown;
[0079] Figure 4 is a structural block diagram of an abnormal data detection device according to an embodiment of the present invention;
[0080] Figure 5 It is a schematic diagram of the hardware structure of a computer device according to an embodiment of the present invention. DETAILED DESCRIPTION
[0081] In order to make the purpose, technical solution and advantages of the embodiments of the present invention clearer, the technical solution in the embodiments of the present invention will be clearly and completely described below in conjunction with the drawings in the embodiments of the present invention. Obviously, the described embodiments are part of the embodiments of the present invention, not all of the embodiments. Based on the embodiments of the present invention, all other embodiments obtained by those skilled in the art without creative work are within the scope of protection of the present invention.
[0082] During the operation of gas water heaters, a large amount of abnormal data is generated due to equipment sensor failure, burner problems, improper water flow regulation, pipe blockage, pump failure, incomplete combustion, and loss of data transmission process. In order to improve equipment safety, ensure user experience, extend equipment life, and reduce maintenance costs, it is necessary to detect abnormal data from massive data. In this regard, relevant scholars have conducted research in multiple application fields. However, traditional machine learning methods mainly include support vector machines, linear model-based methods, density-based methods, and distance-based methods. However, these usually require a large amount of labeled data, but in practical applications, labeled data is difficult to obtain. However, most of the existing gas water heater equipment data is unlabeled data or the abnormal points are not enough to label the training data. If labeling is required, it will take a lot of manpower and time. And even if the labeled data is obtained, the data itself usually has a lot of noise, and problems such as inter-class imbalance between normal data and abnormal data will also lead to data distribution migration problems, hindering model training. In addition, the equipment operation data of gas water heaters and other equipment is multivariate time series data. Due to seasonality, concept drift and change points, the data is non-stationary data, and the data pattern and data distribution differences will change in a diversified way over time. The above factors have a great impact on the abnormal data detection of gas water heaters and other data. Therefore, the data of abnormal data detection of gas water heaters and other data is quite different from the abnormal data detection in related technologies. The abnormal data detection method in related technologies is not suitable for abnormal data detection of equipment operating conditions in household scenarios such as gas water heaters.
[0083] In contrast, an embodiment of the present invention provides an abnormal data detection method and device to solve the problem that the abnormal detection method of the related art is not suitable for abnormal detection of equipment operating condition data in household scenarios such as gas water heaters.
[0084] According to an embodiment of the present invention, an embodiment of an abnormal data detection method is provided. It should be noted that the steps shown in the flowchart of the accompanying drawings can be executed in a computer system such as a set of computer executable instructions, and although a logical order is shown in the flowchart, in some cases, the steps shown or described can be executed in an order different from that shown here.
[0085] In this embodiment, a method for detecting abnormal data is provided, which can be used for devices such as gas water heaters or cloud servers. Figure 1 is a flow chart of an abnormal data detection method according to an embodiment of the present invention. Figure 1 As shown, the process includes the following steps:
[0086] Step S101, obtaining device operation data, where the device operation data includes source domain data with labels and target domain data without labels for which anomaly detection is required.
[0087] In some optional embodiments of the present invention, the device is a gas water heater, and the historical operation data of the gas water heater can be collected. For example: data such as the device on / off status, inlet and outlet water temperature, water flow, system mode, water temperature setting, flame status, water flow status, fan status, power level, wind speed, water pump operation status, and proportional valve current. Here, the data is divided into source domain data and target domain data. Source domain data refers to labeled data, and target domain data refers to unlabeled data that requires anomaly detection. Furthermore, the source domain data can be understood as the device operation data that has completed abnormal state marking, and the target domain data is the device operation data that requires anomaly detection.
[0088] Furthermore, the abnormal data detection model can be trained according to the source domain data using steps S101 to S107, and a decision threshold for determining data anomalies can be obtained. The abnormal data detection model can be used to detect anomalies in the target domain data. During the training of the abnormal data detection model, part of the historical operation data of the gas water heater can be used as the source domain data, and the other part of the data can be used as the target domain data. The specific division method can be divided according to actual needs, and the present invention does not specifically limit this.
[0089] Furthermore, after the training of the abnormal data detection model is completed, adaptive learning and model parameter updates can be continuously performed during the process of using the abnormal data detection model for abnormal data detection.
[0090] In the process of detecting abnormal data for the device operation data to be detected, it is no longer necessary to divide the device operation data into source domain data and target domain data. The historical operation data of the device with abnormal status marked is used as the source domain data, and the device operation data to be detected is used as the target domain data.
[0091] Among them, both the source domain data and the target domain data can be data sets, which can be represented in the form of data time series.
[0092] Step S102: Use a deep convolutional autoencoder to extract low-dimensional features of the equipment operation data.
[0093] In some optional embodiments of the present invention, in order to better learn and extract feature information of data, the abnormal data detection method of the present invention uses a deep convolutional autoencoder to extract low-dimensional features of equipment operation data. Specifically, the data time series collected by the multi-sensor of the gas water heater acquired in real time can be input into the deep convolutional autoencoder for feature extraction to obtain low-dimensional features of the equipment operation data.
[0094] Step S103, reconstructing and mapping the low-dimensional features to the original input space of the equipment operation data to obtain reconstructed features.
[0095] In some optional embodiments of the present invention, the deep convolutional autoencoder can extract local features through multiple convolutional layers, each pooling layer extracts the maximum value of each fragment of the feature map, generates a smaller feature map, retains more important information, and uses a decoder to reconstruct the low-dimensional features and map them to the original input space of the device operation data to obtain reconstructed features. Here, the purpose of reconstructing and mapping the low-dimensional features to the original input space of the device operation data is to determine the reconstruction error of the deep convolutional autoencoder based on the reconstructed features.
[0096] Step S104: determining a reconstruction error of the deep convolutional autoencoder according to the reconstruction features.
[0097] In some optional embodiments of the present invention, the square of the Frobenius norm can be taken as the reconstruction error based on the difference between the data time series of the device operation data and the reconstructed feature. In practical applications, other applicable methods can also be used to determine the reconstruction error of the deep convolutional autoencoder.
[0098] Step S105: determine the maximum mean error between the source domain data and the target domain data.
[0099] In some optional embodiments of the present invention, in order to reduce the feature distribution range of the source domain data and the target domain data, the present invention uses domain adaptation MMD (Maximum Mean Discrepancy) to measure the difference between samples. By determining the maximum mean error of the source domain data and the target domain data, the feature distribution of the source domain data and the target domain data is further shortened, thereby reducing the inter-class distance between normal data and abnormal data. Furthermore, in order to retain more nonlinear information of the equipment operation data, the data of the source domain and the target domain are projected in the Hilbert space.
[0100] Step S106, determining the nonlinear prediction error of the equipment operation data.
[0101] In some optional embodiments of the present invention, in order to learn the time-related and nonlinear information in the time series, the present invention uses nonlinear prediction to detect anomalies. In order to calculate the overall or local context information in the hidden state, the present invention adopts BiLSTM (Bi-directional Long Short-Term Memory, bidirectional long short-term memory with attention mechanism) as a nonlinear prediction method to determine the nonlinear prediction error of the equipment operation data. BiLSTM has two input modes for equipment operation data, one is the input of historical operation data, and the other is the input of future operation data. In this way, historical and future information can be saved, and the BiLSTM network is used to learn the time-related overall and local context information in the time series of equipment operation data, thereby solving the problem of diversified changes in time series data over time in equipment scenarios such as gas water heaters.
[0102] Step S107, determining a decision threshold for determining data abnormality according to the reconstruction error, the maximum mean error and the nonlinear prediction error.
[0103] In some optional implementations of the present invention, an objective function may be set based on the reconstruction error, the maximum mean error, and the nonlinear prediction error. Specifically, a weighting coefficient may be set for each of the reconstruction error, the maximum mean error, and the nonlinear prediction error, and the weighted sum is used as the objective function. Based on the equipment operation data, the weighting coefficients of the reconstruction error, the maximum mean error, and the nonlinear prediction error are obtained through training.
[0104] Furthermore, each parameter of the objective function can be initialized, and the model of the abnormal data detection model can be trained using the gradient descent method, and each parameter can be iteratively updated until the objective function converges. Finally, the decision threshold is obtained.
[0105] Step S108: detecting abnormal data in the target domain data based on the decision threshold.
[0106] In some optional embodiments of the present invention, after obtaining the abnormal data detection model and the decision threshold based on the above steps S101 to S107, it is only necessary to input the device operation data that actually needs to be detected for abnormal data into the abnormal data detection model to obtain the value of the objective function of the above step S107. If the calculation result of the objective function of the above step S107 is greater than the decision threshold, the device operation data that actually needs to be detected for abnormal data is determined to be abnormal data. If the calculation result of the objective function of the above step S107 is greater than the decision threshold, the device operation data that actually needs to be detected for abnormal data is determined to be normal data.
[0107] The abnormal data detection method of the embodiment of the present invention reconstructs the device operation data to obtain a reconstruction, determines the reconstruction error of the deep convolutional autoencoder used in the reconstruction process, determines the maximum mean error of the source domain data and the target domain data and the nonlinear prediction error of the device operation data, and then determines the decision threshold for judging data abnormality based on the reconstruction error, the maximum mean error and the nonlinear prediction error, and detects abnormal data in the target domain data based on the decision threshold. Therefore, for the data distribution abnormality problem in application scenarios such as gas water heaters, which are mostly unlabeled data or lack of abnormal points, the domain adaptive method is used to use the maximum mean error to pull the feature distribution between the source domain data and the target domain data, thereby effectively reducing the distribution difference problem between the data, effectively identifying and detecting abnormal data in application scenarios such as gas water heaters, improving the safety of equipment such as gas water heaters, and significantly improving the user experience.
[0108] In this embodiment, a method for detecting abnormal data is provided, which can be used for devices such as gas water heaters or cloud servers. Figure 2 is a flow chart of an abnormal data detection method according to an embodiment of the present invention. Figure 2 As shown, the process includes the following steps:
[0109] Step S201, obtaining device operation data, where the device operation data includes source domain data with labels and target domain data without labels for which anomaly detection is required.
[0110] For more details, see Figure 1 Step S101 of the illustrated embodiment will not be described in detail here.
[0111] Step S202: pre-process the equipment operation data.
[0112] In an optional embodiment, data preprocessing includes performing at least one of operations such as cleaning, noise removal, and standardization on the equipment operation data.
[0113] The abnormal data detection method of the embodiment of the present invention effectively improves the validity of the original data by performing data preprocessing such as cleaning, noise removal and standardization on the equipment operation data, and avoids the influence of obvious redundant data on the data anomaly detection result.
[0114] Step S203: Use a deep convolutional autoencoder to extract low-dimensional features of the equipment operation data.
[0115] In an optional implementation, a deep convolutional autoencoder including an encoder and a decoder is used. The encoder can use the following formula (1) to implement the above step S203 to extract low-dimensional features of the equipment operation data:
[0116] z e =e(x) (1)
[0117] Among them, z e Represents low-dimensional features;
[0118] x is the data time series representation of equipment operation data.
[0119] The abnormal data detection method of the embodiment of the present invention adopts a deep convolutional autoencoder to extract low-dimensional features of equipment operation data. The deep convolutional autoencoder extracts local features through multiple convolutional layers. Each pooling layer extracts the maximum value of each fragment of the feature map to generate a smaller feature map, retaining more important information, and providing effective input data for reconstructing the equipment operation data.
[0120] and Figure 1 Similar to the embodiment shown, here, the abnormal data detection model can also be trained according to the source domain data using steps S201 to S208 to obtain a decision threshold for determining data abnormalities. The abnormal data detection model can be used to perform abnormality detection on the target domain data.
[0121] Figure 3 FIG. 1 is a schematic diagram showing a model framework of an abnormal data detection model in an abnormal data detection method according to an embodiment of the present invention. Figure 3 As shown in FIG. 1 , the equipment operation data can be the multi-sensor time series data x of the gas water heater, which is also the data time series representation of the above equipment operation data. A deep convolutional autoencoder is used to extract the low-dimensional features z of the equipment operation data. e .
[0122] For other details, see Figure 1 Step S102 of the illustrated embodiment will not be described in detail here.
[0123] Step S204: reconstruct and map the low-dimensional features to the original input space of the equipment operation data to obtain reconstructed features.
[0124] In an optional implementation, a decoder may be used to reconstruct and map the low-dimensional features to the original input space of the device operation data. Specifically, the following formula (2) is used to implement the above step S204, and the reconstructed features are obtained through the decoder:
[0125] x ′ =d(z e ) (2)
[0126] Among them, x ′ Represents reconstruction features;
[0127] z e Represents low-dimensional features.
[0128] For more details, see Figure 1 Step S103 of the illustrated embodiment will not be described in detail here.
[0129] Step S205: determining a reconstruction error of the deep convolutional autoencoder according to the reconstruction features.
[0130] In an optional implementation, determining a reconstruction error of a deep convolutional autoencoder according to the reconstruction feature includes:
[0131] The reconstruction error is determined using the following formula (3):
[0132]
[0133] Among them, L r represents the reconstruction error;
[0134] x is the data time series representation of the equipment operation data;
[0135] x ′ Represents reconstruction features;
[0136] is the square of the Frobenius norm.
[0137] Reference again Figure 3 , the low-dimensional feature z e Reconstruct the original input space mapped to the equipment operation data to obtain the reconstructed feature x ′ , and further determine the reconstruction error L of the deep convolutional autoencoder based on the reconstruction features r .
[0138] For more details, see Figure 1 Step S104 of the illustrated embodiment will not be described in detail here.
[0139] Step S206, determining the maximum mean error between the source domain data and the target domain data.
[0140] In an optional implementation, determining the maximum mean error between the source domain data and the target domain data includes:
[0141] Project the source domain data features and target domain data features of the latent space X into the Hilbert space H;
[0142] The maximum mean error is determined using the following formula (4):
[0143]
[0144] Among them, MMD defines a feature map That is, the X space is projected onto the reproducing kernel Hilbert space H;
[0145] Assume that in the latent space X, Z is a low-dimensional feature The distribution of P in space z is the feature representation z (i) Gaussian distribution of the target H in the reproducing kernel Hilbert space; L MMD (Z,P z ) is the maximum mean error of the two distributions;
[0146] It is a low-dimensional feature representation;
[0147] Represents the low-dimensional feature z (i) Representation mapped to Hilbert space;
[0148] Given the latent space X, the representation z of the source domain data features and the target domain data features e .
[0149]
[0150] Where d is a latent space, v is all the time steps of an iteration cycle, is a set of real numbers of dimension v×d.
[0151] The abnormal data detection method of the embodiment of the present invention adopts the domain adaptation maximum mean difference to further narrow the data feature distribution of the source domain data and the target domain data, thereby reducing the inter-class distance of the equipment operation data. At the same time, the data of the source domain and the target domain are projected into the Hilbert space, retaining more nonlinear information.
[0152] For other details, see Figure 1 Step S105 of the illustrated embodiment will not be described in detail here.
[0153] Step S207, determining the nonlinear prediction error of the equipment operation data.
[0154] In an optional implementation, determining a nonlinear prediction error of equipment operation data includes:
[0155] Based on the bidirectional long short-term memory with attention mechanism, the nonlinear prediction error of equipment operation data is determined using the following formula (5):
[0156]
[0157] Where Ln represents the nonlinear prediction error;
[0158] z v is the given input of the bidirectional long short-term memory;
[0159] y v is the hidden state output of the bidirectional long short-term memory;
[0160] is the square of the Frobenius norm;
[0161] Y v =∑ v A v *y v ′, where A is the weight matrix.
[0162] Specifically, the BiLSTM unit can be composed of an input gate i v 、Forget gate v , output gate o v and the unit activation vector a v It consists of four parts. Given input z v , hidden state output y v It can be determined by the following formulas (5-1), (5-2), (5-3), (5-4), (5-5) and (5-6), y v ′ can be determined using the following formula (5-7):
[0163] i v =η(K zi z v +K yi y v-1 +K ai a v-1 +s i ) (5-1)
[0164] f v =η(K zf z v +K yf y v-1 +K af a v-1 +s f ) (5-2)
[0165] o v =η(K zo z v +K yo y v-1 +K ao a v-1 +s o ) (5-3)
[0166] a v ′=tanh(K za z v +K ya y v-1 +K aa a v-1 +s a ) (5-4)
[0167]
[0168] Among them, i v ,f v ,o v ,a v represents the value of i,f,o,a at time v, η(·) and tanh(·) are activation functions, K is the weight matrix and s is the skew.
[0169] The abnormal data detection method of the embodiment of the present invention utilizes the bidirectional long short-term memory with attention mechanism to learn the time-related overall and local context information in the time series of the device operation data, thereby solving the problem that the time series of the device operation data in household scenarios such as gas water heaters undergoes diversified changes over time. The nonlinear prediction error of the device operation data is determined on the basis of retaining the original information of the device operation data to the greatest extent. Therefore, the nonlinear prediction error is combined with other operations to more accurately determine the decision threshold for determining data abnormality.
[0170] For other details, see Figure 1 Step S106 of the illustrated embodiment will not be described in detail here.
[0171] Step S208, determining a decision threshold for determining data abnormality based on the reconstruction error, the maximum mean error and the nonlinear prediction error.
[0172] Specifically, the above step S208 may include:
[0173] Step S2081, constructing an objective function based on the reconstruction error, the maximum mean error and the nonlinear prediction error.
[0174] In an optional implementation, the objective function is a function shown in the following formula (6):
[0175] f(σ)=Lr +αL MMD +βLn (6)
[0176] Among them, f(σ) is the objective function;
[0177] L r represents the reconstruction error;
[0178] L MMD represents the maximum mean difference;
[0179] Ln represents the nonlinear prediction error;
[0180] α and β are the loss function parameters of the objective function.
[0181] Step S2082, using the gradient descent method to perform model training, iteratively update the parameters of the objective function until the objective function converges, and obtain a decision threshold for determining data anomalies.
[0182] Specifically, each parameter of the objective function f(σ) can be initialized, and the abnormal data detection model can be trained using the gradient descent method, that is, each parameter of the objective function is iteratively updated until the objective function converges to obtain the final decision threshold t. The trained model parameters, thresholds, hyperparameters, etc. are input into the abnormal data detection model to perform abnormal data detection on the equipment operation data to be detected.
[0183] For other details, see Figure 1 Step S107 of the illustrated embodiment will not be described in detail here.
[0184] The abnormal data detection method of the embodiment of the present invention constructs an objective function based on reconstruction error, maximum mean error and nonlinear prediction error, and uses the gradient descent method to train the model, iteratively updates the parameters of the objective function until the objective function converges, and obtains a decision threshold for determining data abnormalities. In the process of determining the reconstruction error, a deep convolutional autoencoder is used to retain more important information to the maximum extent, and in the process of determining the maximum mean error, a domain-adaptive maximum mean difference is used to further narrow the data feature distribution of the source domain data and the target domain data, thereby reducing the inter-class distance between the normal data and the abnormal data of the equipment operation data. The nonlinear prediction error uses a bidirectional long short-term memory with an attention mechanism to accurately calculate the overall or local context information in the hidden state. As a result, the equipment operation data is detected from multiple angles to obtain a more accurate decision threshold for determining data abnormalities, thereby obtaining a more accurate abnormal data detection result.
[0185] For other details, see Figure 1 Step S108 of the illustrated embodiment will not be described in detail here.
[0186] Step S209: detecting abnormal data in the target domain data based on the decision threshold.
[0187] For details, please see Figure 1 Step S108 of the illustrated embodiment will not be described in detail here.
[0188] In this embodiment, an abnormal data detection device is also provided, which is used to implement the above-mentioned embodiments and preferred embodiments, and the descriptions that have been made will not be repeated. As used below, the term "module" can implement a combination of software and / or hardware of a predetermined function. Although the devices described in the following embodiments are preferably implemented in software, the implementation of hardware, or a combination of software and hardware, is also possible and conceivable.
[0189] This embodiment provides an abnormal data detection device, such as Figure 4 As shown, including:
[0190] The acquisition module 401 is used to acquire device operation data, where the device operation data includes source domain data with labels and target domain data without labels for which anomaly detection is required;
[0191] A low-dimensional module 402, for extracting low-dimensional features of equipment operation data using a deep convolutional autoencoder;
[0192] A reconstruction module 403 is used to reconstruct and map the low-dimensional features to the original input space of the equipment operation data to obtain reconstructed features;
[0193] A reconstruction error module 404, configured to determine a reconstruction error of the deep convolutional autoencoder based on the reconstruction features;
[0194] A mean error module 405 is used to determine the maximum mean error between the source domain data and the target domain data;
[0195] A prediction error module 406, for determining a nonlinear prediction error of the equipment operation data;
[0196] A decision module 407, used to determine a decision threshold for determining data abnormality according to the reconstruction error, the maximum mean error and the nonlinear prediction error;
[0197] The detection module 408 is used to detect abnormal data in the target domain data based on the decision threshold.
[0198] In some optional embodiments, the device further comprises:
[0199] A preprocessing module, used for performing data preprocessing on the equipment operation data before extracting low-dimensional features of the equipment operation data using a deep convolutional autoencoder;
[0200] Data preprocessing includes at least one of the following: cleaning, noise removal and standardization.
[0201] In some optional implementations, the low-dimensional module uses the following formula (1) to obtain low-dimensional features:
[0202] z e =e(x) (1)
[0203] Among them, z e Represents low-dimensional features;
[0204] x is the data time series representation of equipment operation data.
[0205] In some optional implementations, the reconstruction module uses the following formula (2) to obtain the reconstructed features through the decoder:
[0206] x ′ =d(z e ) (2)
[0207] Among them, x ′ Represents reconstruction features;
[0208] z e Represents low-dimensional features.
[0209] In some optional implementations, the reconstruction error is determined by using the following formula (3) according to the reconstruction error module:
[0210]
[0211] Among them, L r represents the reconstruction error;
[0212] x is the data time series representation of the equipment operation data;
[0213] x ′ Represents reconstruction features;
[0214] is the square of the Frobenius norm.
[0215] In some optional implementations, the mean error module includes:
[0216] A Hilbert projection unit, used to project the data of the source domain and the target domain into the Hilbert space;
[0217] The mean error unit is used to determine the maximum mean error using the following formula (4):
[0218]
[0219] Among them, MMD defines a feature map That is, the X space is projected onto the reproducing kernel Hilbert space H;
[0220] Assume that in space X, Z is a low-dimensional feature The distribution of P in space z is the feature representation z (i) Gaussian distribution of the target H in the reproducing kernel Hilbert space; L MMD (Z,P z ) is the maximum mean error of the two distributions;
[0221] It is a low-dimensional feature representation;
[0222] Represents the low-dimensional feature z (i) Representation mapped to Hilbert space;
[0223] Given a latent representation Where d is a latent space, v is all the time steps of an iteration cycle, is a set of real numbers of dimension v×d.
[0224] In some optional implementations, the prediction error module is based on a bidirectional long short-term memory with an attention mechanism and uses the following formula (5) to determine the nonlinear prediction error of the equipment operation data:
[0225]
[0226] Where Ln represents the nonlinear prediction error;
[0227] z v is the given input of the bidirectional long short-term memory;
[0228] y v is the hidden state output of the bidirectional long short-term memory;
[0229] is the square of the Frobenius norm;
[0230] Y v =∑ v A v *y v ′, where A is the weight matrix.
[0231] In some optional implementations, the decision module includes:
[0232] A function construction unit, used for constructing an objective function based on a reconstruction error, a maximum mean error and a nonlinear prediction error;
[0233] The decision threshold unit is used to train the model using the gradient descent method, iteratively update the parameters of the objective function until the objective function converges, and obtain the decision threshold for determining data anomalies.
[0234] In some optional implementations, the objective function is a function shown in the following formula (6):
[0235] f(σ)=L r +αL MMD +βLn (6)
[0236] Among them, f(σ) is the objective function;
[0237] L r represents the reconstruction error;
[0238] L MMD represents the maximum mean difference;
[0239] Ln represents the nonlinear prediction error;
[0240] α and β are the loss function parameters of the objective function.
[0241] The further functional description of each of the above modules and units is the same as that of the above corresponding embodiments and will not be repeated here.
[0242] The abnormal data detection device in this embodiment is presented in the form of a functional unit, where the unit refers to an ASIC (Application Specific Integrated Circuit) circuit, a processor and memory that executes one or more software or fixed programs, and / or other devices that can provide the above functions.
[0243] The embodiment of the present invention also provides a computer device having the above Figure 4 The abnormal data detection device shown.
[0244] See also Figure 5 , Figure 5 is a schematic diagram of the structure of a computer device provided by an optional embodiment of the present invention, such as Figure 5As shown, the computer device includes: one or more processors 10, a memory 20, and interfaces for connecting various components, including high-speed interfaces and low-speed interfaces. Various components are connected to each other using different buses for communication, and can be installed on a common mainboard or installed in other ways as needed. The processor can process the instructions executed in the computer device, including instructions stored in or on the memory to display the graphical information of the GUI on an external input / output device (such as, a display device coupled to the interface). In some optional embodiments, if necessary, multiple processors and / or multiple buses can be used together with multiple memories and multiple memories. Similarly, multiple computer devices can be connected, and each device provides some necessary operations (for example, as a server array, a group of blade servers, or a multi-processor system). Figure 5 A processor 10 is taken as an example.
[0245] The processor 10 may be a central processing unit, a network processor or a combination thereof. The processor 10 may further include a hardware chip. The hardware chip may be a dedicated integrated circuit, a programmable logic device or a combination thereof. The programmable logic device may be a complex programmable logic device, a field programmable gate array, a general purpose array logic or any combination thereof.
[0246] The memory 20 stores instructions executable by at least one processor 10, so that at least one processor 10 executes the method shown in the above embodiment.
[0247] The memory 20 may include a program storage area and a data storage area, wherein the program storage area may store an operating system, an application required for at least one function; the data storage area may store data created according to the use of the computer device, etc. In addition, the memory 20 may include a high-speed random access memory, and may also include a non-transient memory, such as at least one disk storage device, a flash memory device, or other non-transient solid-state storage device. In some optional embodiments, the memory 20 may optionally include a memory remotely arranged relative to the processor 10, and these remote memories may be connected to the computer device via a network. Examples of the above-mentioned network include, but are not limited to, the Internet, an intranet, a local area network, a mobile communication network, and combinations thereof.
[0248] The memory 20 may include a volatile memory, such as a random access memory; the memory may also include a non-volatile memory, such as a flash memory, a hard disk or a solid state drive; the memory 20 may also include a combination of the above types of memory.
[0249] The computer device further comprises a communication interface 30 for the computer device to communicate with other devices or a communication network.
[0250] The embodiment of the present invention also provides a computer-readable storage medium. The method according to the embodiment of the present invention can be implemented in hardware, firmware, or can be implemented as a computer code that can be recorded in a storage medium, or can be implemented as a computer code that is originally stored in a remote storage medium or a non-temporary machine-readable storage medium and will be stored in a local storage medium through a network download, so that the method described herein can be stored in such software processing on a storage medium using a general-purpose computer, a dedicated processor, or programmable or dedicated hardware. Among them, the storage medium can be a magnetic disk, an optical disk, a read-only storage memory, a random access memory, a flash memory, a hard disk or a solid-state hard disk, etc.; further, the storage medium can also include a combination of the above types of memories. It can be understood that a computer, a processor, a microprocessor controller, or programmable hardware includes a storage component that can store or receive software or computer code. When the software or computer code is accessed and executed by a computer, a processor, or hardware, the method shown in the above embodiment is implemented.
[0251] A part of the present invention may be applied as a computer program product, such as a computer program instruction, which, when executed by a computer, can call or provide the method and / or technical solution according to the present invention through the operation of the computer. Those skilled in the art should understand that the existence of the computer program instruction in a computer-readable medium includes, but is not limited to, a source file, an executable file, an installation package file, etc., and accordingly, the way in which the computer program instruction is executed by the computer includes, but is not limited to: the computer directly executes the instruction, or the computer compiles the instruction and then executes the corresponding compiled program, or the computer reads and executes the instruction, or the computer reads and installs the instruction and then executes the corresponding installed program. Here, the computer-readable medium may be any available computer-readable storage medium or communication medium accessible to the computer.
[0252] Although the embodiments of the present invention have been described in conjunction with the accompanying drawings, those skilled in the art may make various modifications and variations without departing from the spirit and scope of the present invention, and such modifications and variations are all within the scope defined by the appended claims.
Claims
1. A method for detecting abnormal data, characterized in that: The method comprises: Acquire device operation data, where the device operation data includes labeled source domain data and unlabeled target domain data for which anomaly detection is required; A deep convolutional autoencoder is used to extract low-dimensional features of the equipment operation data; Reconstructing and mapping the low-dimensional features to the original input space of the device operation data to obtain reconstructed features; Determining a reconstruction error of the deep convolutional autoencoder according to the reconstruction feature; Determining a maximum mean error between the source domain data and the target domain data; determining a nonlinear prediction error of the equipment operation data; Determining a decision threshold for determining data abnormality according to the reconstruction error, the maximum mean error, and the nonlinear prediction error; Based on the decision threshold, abnormal data in the target domain data is detected.
2. The method according to claim 1, characterized in that: Before extracting the low-dimensional features of the equipment operation data using a deep convolutional autoencoder, the method further includes: Performing data preprocessing on the equipment operation data; The data preprocessing includes at least one of the following: cleaning, noise removal and standardization.
3. The method according to claim 1, characterized in that The deep convolutional autoencoder includes an encoder and a decoder. The encoder extracts the low-dimensional features of the device operation data using the following formula (1): z e =e(x) (1); Among them, z e Representing the low-dimensional features; x is a data time series representation of the equipment operation data.
4. The method according to claim 3, characterized in that The reconstructing and mapping the low-dimensional features to the original input space of the device operation data to obtain the reconstructed features includes: The following formula (2) is used to obtain the reconstructed features through the decoder: x ′ =d(z e ) (2); Among them, x ′ representing the reconstructed features; z e Represents the low-dimensional features.
5. The method according to claim 1, characterized in that Determining the reconstruction error of the deep convolutional autoencoder according to the reconstruction feature includes: The reconstruction error is determined using the following formula (3): Among them, L r represents the reconstruction error; x is a data time series representation of the equipment operation data; x ′ representing the reconstructed features; is the square of the Frobenius norm.
6. The method according to claim 1, characterized in that The determining the maximum mean error between the source domain data and the target domain data includes: Project the data of the source domain and the target domain into the Hilbert space; The maximum mean error is determined by using the following formula (4): Among them, MMD defines a feature map That is, the X space is projected onto the reproducing kernel Hilbert space H; Assume that in space X, Z is a low-dimensional feature The distribution of P in space z is the feature representation z (i) Gaussian distribution of the target H in the reproducing kernel Hilbert space; L MMD (Z,P z ) is the maximum mean error of the two distributions; It is a low-dimensional feature representation; Represents the low-dimensional feature z (i) Representation mapped to Hilbert space; Given a latent representation Where d is a latent space, v is all the time steps of an iteration cycle, is a set of real numbers of dimension v×d.
7. The method according to claim 1, characterized in that Determining the nonlinear prediction error of the equipment operation data includes: Based on the bidirectional long short-term memory with attention mechanism, the nonlinear prediction error of the equipment operation data is determined by the following formula (5): Wherein, Ln represents the nonlinear prediction error; z v is a given input of the bidirectional long short-term memory; y v is the hidden state output of the bidirectional long short-term memory; is the square of the Frobenius norm; Y v =∑ v A v *y v ′, where A is the weight matrix.
8. The method according to claim 1, characterized in that The step of determining a decision threshold for determining data abnormality according to the reconstruction error, the maximum mean error, and the nonlinear prediction error includes: constructing an objective function based on the reconstruction error, the maximum mean error and the nonlinear prediction error; The model is trained using the gradient descent method, and the parameters of the objective function are iteratively updated until the objective function converges to obtain a decision threshold for determining data anomalies.
9. The method according to claim 8, characterized in that The objective function is the function shown in the following formula (6): f(σ)=L r +αL MMD +βLn (6) Wherein, f(σ) is the objective function; L r represents the reconstruction error; L MMD represents the maximum mean difference; Ln represents the nonlinear prediction error; α and β are the loss function parameters of the objective function.
10. An abnormal data detection device, characterized in that: The device comprises: An acquisition module is used to acquire device operation data, wherein the device operation data includes source domain data with labels and target domain data without labels for which anomaly detection is required; A low-dimensional module, used for extracting low-dimensional features of the device operation data using a deep convolutional autoencoder; A reconstruction module, used to reconstruct and map the low-dimensional features to the original input space of the device operation data to obtain reconstructed features; A reconstruction error module, used to determine a reconstruction error of the deep convolutional autoencoder according to the reconstruction feature; A mean error module, used to determine the maximum mean error between the source domain data and the target domain data; A prediction error module, used to determine a nonlinear prediction error of the equipment operation data; A decision module, used to determine a decision threshold for determining data abnormality according to the reconstruction error, the maximum mean error and the nonlinear prediction error; A detection module is used to detect abnormal data in the target domain data based on the decision threshold.