A data anomaly detection method and related device

By preprocessing the original data and extracting the representation vector, combined with the cluster analysis of the density DBSCAN algorithm, the accuracy problem of data anomaly detection in unlabeled data scenarios is solved, and efficient outlier identification in complex scenarios is achieved.

CN114077872BActive Publication Date: 2024-09-27SERVYOU SOFTWARE GRP
View PDF 0 Cites 0 Cited by

Patent Information

Application Number
CN202111435970.0
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2021-11-29
Publication Date
2024-09-27
Estimated Expiration
2041-11-29

AI Technical Summary

Technical Problem

The existing technology is difficult to accurately detect data anomalies in unlabeled data scenarios, and fails to fully consider the diversity and complexity of abnormal transaction sequences, resulting in reduced data detection accuracy.

Method used

By preprocessing the original data, extracting representation vectors and performing multi-input fusion, combined with the density DBSCAN algorithm to perform cluster analysis, identify abnormal points, and achieve unsupervised data anomaly detection.

Benefits of technology

In the absence of label data, the accuracy of data detection is improved, abnormal points in the data can be effectively identified, and the accuracy of data inspection is improved.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN114077872B
    Figure CN114077872B
Patent Text Reader

Abstract

The present application discloses a method for data anomaly detection, including: preprocessing the original data based on the data format to obtain multiple data matrices; extracting representation vectors from the multiple data matrices using a convolutional denoising autoencoder model to obtain a representation vector corresponding to each data matrix; performing multi-input fusion on all the representation vectors to obtain a target representation vector; clustering the target representation vector based on the density DBSCAN algorithm to obtain anomalies; marking the data of the anomaly points as abnormal data. In the absence of labeled data, abnormal data can be detected with the help of an unsupervised clustering algorithm to improve the accuracy of data detection. The present application also discloses a data anomaly detection device, a server, and a computer-readable storage medium, which have the above beneficial effects and are not described in detail here.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present application relates to the field of data processing technology, and in particular to a data anomaly detection method, a data anomaly detection device, a server, and a computer-readable storage medium. Background Art

[0002] With the continuous development of information technology, data processing methods are used to process data from all walks of life in order to improve the efficiency of data processing and discover problems in the data in advance.

[0003] In the related art, abnormal transaction detection is performed based on data mining. First, the Bayesian belief network algorithm is used to determine the posterior probability that the current transaction is an abnormal transaction. In addition, a certain number of historical transactions before the current transaction are combined into a transaction sequence, and the sequence is compared with the known abnormal transaction sequence to obtain the similarity. Finally, the two indicators of posterior probability and similarity are combined to determine whether the transaction is abnormal. However, in real taxpayer transaction scenarios, sufficient labeled data is very ideal. Using a Bayesian belief network classifier to classify transactions is difficult to implement under the premise of unlabeled data; secondly, when comparing historical transaction sequences with abnormal transaction sequences, the diversity and complexity of abnormal transaction sequences are not taken into account. In other words, it is impossible to accurately detect data, which reduces the accuracy of data inspection.

[0004] Therefore, how to improve the accuracy of data detection is a key issue that technical personnel in this field are concerned about. Summary of the invention

[0005] The purpose of this application is to provide a data anomaly detection method, a data anomaly detection device, a server and a computer-readable storage medium to improve the accuracy of data detection and timely discover abnormal data in the data.

[0006] In order to solve the above technical problems, the present application provides a data anomaly detection method, comprising:

[0007] Preprocess the original data based on the data format to obtain multiple data matrices;

[0008] Using a convolutional denoising autoencoder model to extract representation vectors from the multiple data matrices to obtain a representation vector corresponding to each data matrix;

[0009] Perform multi-input fusion on all the representation vectors to obtain a target representation vector;

[0010] Performing cluster analysis on the target representation vector based on the density DBSCAN algorithm to obtain outliers;

[0011] The data of the abnormal point is marked as abnormal data.

[0012] Optionally, the raw data is preprocessed based on the data format to obtain multiple data matrices, including:

[0013] Cleaning the original data to obtain data to be sorted;

[0014] The data to be sorted is sorted into data matrices based on the data format and data attributes to obtain the multiple data matrices.

[0015] Optionally, a convolutional denoising autoencoder model is used to extract representation vectors from the multiple data matrices to obtain a representation vector corresponding to each data matrix, including:

[0016] Constructing based on a preset model structure to obtain the convolutional denoising autoencoder model;

[0017] Using the convolutional denoising autoencoder model to perform model training on the multiple data matrices;

[0018] When the model training is completed, the result of the model training is used as the representation vector corresponding to each data matrix.

[0019] Optionally, all the representation vectors are multi-input fused to obtain a target representation vector, including:

[0020] All the representation vectors are multi-input fused based on a preset ratio to obtain the target representation vector.

[0021] Optionally, cluster analysis is performed on the target representation vector based on a density DBSCAN algorithm to obtain abnormal points, including:

[0022] Setting parameters for the density DBSCAN algorithm;

[0023] The target representation vector is clustered and analyzed based on the density DBSCAN algorithm to obtain the outlier point.

[0024] Optionally, also include:

[0025] Prompt information is sent based on the abnormal data.

[0026] The present application also provides a data anomaly detection device, comprising:

[0027] A data preprocessing module is used to preprocess the original data based on the data format to obtain multiple data matrices;

[0028] A representation vector extraction module, used to extract representation vectors from the multiple data matrices using a convolutional denoising autoencoder model to obtain a representation vector corresponding to each data matrix;

[0029] A multi-input fusion module, used for performing multi-input fusion on all the representation vectors to obtain a target representation vector;

[0030] A cluster analysis module, used to perform cluster analysis on the target representation vector based on a density DBSCAN algorithm to obtain abnormal points;

[0031] The abnormal data marking module is used to mark the data of the abnormal point as abnormal data.

[0032] Optionally, the data preprocessing module is specifically used to clean the original data to obtain the data to be sorted; and to sort the data to be sorted into data matrices based on the data format and data attributes to obtain the multiple data matrices.

[0033] The present application also provides a server, comprising:

[0034] Memory for storing computer programs;

[0035] A processor is used to implement the steps of the data anomaly detection method as described above when executing the computer program.

[0036] The present application also provides a computer-readable storage medium, on which a computer program is stored. When the computer program is executed by a processor, the steps of the data anomaly detection method described above are implemented.

[0037] A data anomaly detection method provided by the present application includes: preprocessing the original data based on the data format to obtain multiple data matrices; using a convolutional denoising autoencoder model to extract representation vectors from the multiple data matrices to obtain a representation vector corresponding to each data matrix; multi-input fusion of all the representation vectors to obtain a target representation vector; clustering analysis of the target representation vector based on a density DBSCAN algorithm to obtain anomalies; and marking the data of the anomaly points as abnormal data.

[0038] By first preprocessing the original data to obtain multiple data matrices, and then extracting the representation vector, the representation vector corresponding to each data matrix is ​​obtained, and then multi-input fusion is performed to obtain the target representation vector of multiple representation vector fusions, and finally cluster analysis is performed to obtain abnormal points. In the context of lack of labeled data, abnormal data can be detected with the help of unsupervised clustering algorithms to improve the accuracy of data detection.

[0039] The present application also provides a data anomaly detection device, a server, and a computer-readable storage medium, which have the above beneficial effects and are not elaborated here. BRIEF DESCRIPTION OF THE DRAWINGS

[0040] In order to more clearly illustrate the embodiments of the present application or the technical solutions in the prior art, the drawings required for use in the embodiments or the description of the prior art will be briefly introduced below. Obviously, the drawings described below are only embodiments of the present application. For ordinary technicians in this field, other drawings can be obtained based on the provided drawings without paying any creative work.

[0041] Figure 1 A flowchart of a data anomaly detection method provided in an embodiment of the present application;

[0042] Figure 2 A schematic diagram of the structure of a data anomaly detection device provided in an embodiment of the present application. DETAILED DESCRIPTION

[0043] The core of this application is to provide a data anomaly detection method, a data anomaly detection device, a server and a computer-readable storage medium to improve the accuracy of data detection and timely discover abnormal data in the data.

[0044] In order to make the purpose, technical solution and advantages of the embodiments of the present application clearer, the technical solution in the embodiments of the present application will be clearly and completely described below in conjunction with the drawings in the embodiments of the present application. Obviously, the described embodiments are part of the embodiments of the present application, not all of the embodiments. Based on the embodiments in the present application, all other embodiments obtained by ordinary technicians in this field without creative work are within the scope of protection of this application.

[0045] In the related art, abnormal transaction detection is performed based on data mining. First, the Bayesian belief network algorithm is used to determine the posterior probability that the current transaction is an abnormal transaction. In addition, a certain number of historical transactions before the current transaction are combined into a transaction sequence, and the sequence is compared with the known abnormal transaction sequence to obtain the similarity. Finally, the two indicators of posterior probability and similarity are combined to determine whether the transaction is abnormal. However, in real taxpayer transaction scenarios, sufficient labeled data is very ideal. Using a Bayesian belief network classifier to classify transactions is difficult to implement under the premise of unlabeled data; secondly, when comparing historical transaction sequences with abnormal transaction sequences, the diversity and complexity of abnormal transaction sequences are not taken into account. In other words, it is impossible to accurately detect data, which reduces the accuracy of data inspection.

[0046] Therefore, the present application provides a data anomaly detection method, which preprocesses the original data to obtain multiple data matrices, then extracts the representation vector to obtain the representation vector corresponding to each data matrix, and then performs multi-input fusion to obtain the target representation vector of the fusion of multiple representation vectors, and finally performs cluster analysis to obtain abnormal points. In the context of lack of labeled data, abnormal data can be detected with the help of unsupervised clustering algorithms, thereby improving the accuracy of data detection.

[0047] The following is an example of an example in which a method for detecting anomalies in data provided by the present application is described.

[0048] Please refer to Figure 1 , Figure 1 A flowchart of a data anomaly detection method provided in an embodiment of the present application.

[0049] In this embodiment, the method may include:

[0050] S101, preprocessing the original data based on the data format to obtain multiple data matrices;

[0051] It can be seen that this step is intended to pre-process the original data based on the data format to obtain multiple data matrices. The data format can be a format that displays the data in a matrix form according to categories.

[0052] The original data may be tax invoice data obtained from the business operation process of the enterprise.

[0053] Furthermore, this step may include:

[0054] Step 1, clean the original data to obtain the data to be sorted;

[0055] Step 2: Organize the data to be organized into data matrices based on the data format and data attributes to obtain multiple data matrices.

[0056] It can be seen that in this optional solution, it is mainly to explain how to perform pre-processing. In this optional solution, the original data is first cleaned to obtain data to be sorted, and then the data to be sorted is sorted into a data matrix based on data format and data attributes to obtain multiple data matrices. It can be seen that in this optional solution, the original data is cleaned to obtain data to be sorted, that is, to remove unused data in the original data, so as to reduce the amount of data, improve the content of effective data, and then the data is sorted according to data format and data attributes to obtain multiple data matrices. That is, the data of the same data attributes are sorted to obtain corresponding data matrices.

[0057] S102, extracting representation vectors from multiple data matrices using a convolutional denoising autoencoder model to obtain a representation vector corresponding to each data matrix;

[0058] Based on S101, this step aims to use a convolutional denoising autoencoder model to extract representation vectors for multiple data matrices to obtain a representation vector corresponding to each data matrix.

[0059] Among them, the convolutional denoising autoencoder model combines convolutional neural networks with denoising autoencoders. Convolutional neural networks are a mature technology that can be used to build association maps between data. The denoising autoencoder can be regarded as an artificial neural network for unsupervised learning. Noise reduction is to remove the disturbance of outliers in the data to the training and improve the robustness of the model. The model structure has two stages: encoding stage and decoding stage.

[0060] Furthermore, this step may include:

[0061] Step 1, constructing based on the preset model structure to obtain a convolutional denoising autoencoder model;

[0062] Step 2, using a convolutional denoising autoencoder model to perform model training on multiple data matrices;

[0063] Step 3: When the model training is completed, the result of the model training is used as the representation vector corresponding to each data matrix.

[0064] It can be seen that this optional solution mainly explains how to obtain the representation vector of each data matrix. In this optional solution, a convolutional denoising autoencoder model is constructed based on a preset model structure, and a convolutional denoising autoencoder model is used to perform model training on multiple data matrices. When the model training is completed, the result of the model training is used as the representation vector corresponding to each data matrix. That is, first construct the convolutional denoising autoencoder model to be used, and then perform cyclic training, and use the result of the training process as the representation vector corresponding to the data matrix. It is achieved that the noise of the data is eliminated during the feature extraction process in order to improve the purity of the data, maintain the validity of the data, and eliminate excess redundant data.

[0065] S103, multi-input fusion of all representation vectors to obtain a target representation vector;

[0066] Based on S102, this step aims to perform multi-input fusion on all representation vectors to obtain a target representation vector.

[0067] Furthermore, this step may include:

[0068] All representation vectors are multi-input fused based on a preset ratio to obtain the target representation vector.

[0069] It can be seen that this optional solution mainly explains how to perform multi-input fusion. In this optional solution, firstly, corresponding data ratios are set for different data matrices, and then all representation vectors are multi-input fused based on the preset ratios to obtain the target representation vector.

[0070] S104, performing cluster analysis on the target representation vector based on the density DBSCAN algorithm to obtain abnormal points;

[0071] Based on S103, this step aims to perform cluster analysis on the target representation vector based on the density DBSCAN algorithm to obtain outliers.

[0072] Among them, the density DBSCAN (Density-Based Spatial Clustering of Applications with Noise) algorithm is a density-based clustering algorithm. This type of density clustering algorithm generally assumes that the category can be determined by the density of sample distribution. Samples of the same category are closely connected, that is, there must be samples of the same category not far away from any sample of the category.

[0073] Furthermore, this step may include:

[0074] Step 1, setting parameters for the density DBSCAN algorithm;

[0075] Step 2: Perform cluster analysis on the target representation vector based on the density DBSCAN algorithm to obtain outliers.

[0076] It can be seen that this optional solution mainly explains how to perform cluster analysis. In this optional solution, firstly, the parameters of the density DBSCAN algorithm are set, and then cluster analysis is performed on the target representation vector based on the density DBSCAN algorithm to obtain abnormal points.

[0077] S105, marking the data of the abnormal point as abnormal data.

[0078] Based on S104, this step aims to mark the data of the abnormal point as abnormal data.

[0079] In addition, this embodiment may also include:

[0080] Send alerts based on abnormal data.

[0081] It can be seen that based on this optional solution, corresponding prompt information can also be sent based on the abnormal data when the embodiment is executed, so as to prompt the relevant attribute information of the abnormal data.

[0082] In summary, this embodiment preprocesses the original data to obtain multiple data matrices, then extracts the representation vector to obtain the representation vector corresponding to each data matrix, performs multi-input fusion to obtain the target representation vector of the fusion of multiple representation vectors, and finally performs cluster analysis to obtain abnormal points. In the context of lack of labeled data, abnormal data can be detected with the help of an unsupervised clustering algorithm, thereby improving the accuracy of data detection.

[0083] The following is a specific example to further illustrate a method for detecting anomalies in data provided by the present application.

[0084] In this embodiment, the method may include:

[0085] Step 1: sort and clean all kinds of information of each enterprise obtained from the tax invoice, and present the amount of enterprise input and output, the time difference of production, and the category of goods in the form of a matrix. At the same time, normalize the data and map the data to [0, 1];

[0086] Step 2: Build a convolutional denoising autoencoder model, train the model with the preprocessed data, and extract the enterprise representation vector;

[0087] Step 3: The enterprise's production amount representation vector, production time difference representation vector, and commodity category vector are fused through multi-input fusion to obtain the final enterprise representation vector as the input for the next step;

[0088] Step 4: Take the representation vector of each enterprise as input, use the density-based DBSCAN algorithm, set appropriate parameters, perform cluster analysis on the enterprise representation vector, and find outliers;

[0089] Step 5: The enterprises represented by the abnormal points are those with abnormal production, which may have engaged in tax evasion and tax avoidance activities such as false invoices, and may be handed over to tax auditors for further review.

[0090] Among them, the invoices generated during the transaction process are the only data source for studying transaction and tax information, and the invoice information is usually organized in a database. This data contains all the relevant attributes of a taxpayer for a transaction, including important information such as the taxpayer numbers of both parties to the transaction, the transaction commodity numbers, the transaction amount, and the invoice time. However, there is also a lot of redundant information, which is of little help in identifying abnormal companies. In addition, the data format of the invoice is mainly convenient for humans to read, write and understand, and is not suitable for computer processing, so the invoice data needs to be preprocessed. The enterprise transaction information matrix obtained after processing includes three categories: "Enterprise Production Matrix A", "Enterprise Production Time Difference Matrix T", and "Commodity Category Matrix C".

[0091] The following are three methods for processing transaction matrices:

[0092] Among them, the processing of the enterprise production matrix A. First, through the SQL (Structured Query Language) statement operation in the database, the "input" table and the "output" table of each enterprise are obtained, which paves the way for the establishment of the enterprise "input" matrix and "output" matrix. The row indexes of the "input" matrix and the "output" matrix are the enterprise numbers, and the column indexes represent the codes of various commodities. The values ​​in the "input" matrix represent the total amount of money spent by a certain enterprise to purchase a certain commodity, and the values ​​in the "output" matrix represent the total amount of money earned by a certain enterprise from selling a certain commodity.

[0093] Due to the different scales of enterprises and the differences in the costs of commodities, the amount values ​​are scattered at different levels, so the matrix must be normalized. Here, the total number of enterprises is recorded as M, the total number of commodities is recorded as N, the "input" matrix is ​​represented by G, and the "output" matrix is ​​represented by X. In this embodiment, the data is normalized along the enterprise axis, and the proportion of the amount of each commodity in the enterprise transaction is calculated. The processed value range is in [0, 1].

[0094] For the “input” matrix, the vector normalization result of the i-th row enterprise is:

[0095]

[0096] Among them, G ij is the amount spent by the enterprise in the i-th row of the “input” matrix on the purchase of the j-th commodity. Similarly, the normalized result of the “output” matrix is:

[0097]

[0098] Finally, the "input" matrix G and the "output" matrix X are concatenated to obtain the enterprise production matrix A. The purchase information and sales information of each enterprise are respectively synthesized into a complete vector, which represents the transaction behavior of the enterprise throughout the year in terms of the amount. In a geometric sense, in an n-dimensional space, each enterprise vector is represented by a unique point in the space.

[0099] Processing of the enterprise's production time difference matrix T.

[0100] The enterprise production time difference matrix information is extracted from the existing invoice data. According to the invoice date, the existing invoices are divided into enterprise purchase invoices and enterprise sales invoices. The enterprise production matrix is ​​constructed with the number of enterprises as the number of rows and the commodity categories as the number of columns. Different elements in a row represent the purchase and sale time difference of different commodities of an enterprise. It is stipulated that for the same commodity, the invoice time difference within one month is used as the input. The specific calculation formula is as follows:

[0101] Tij =A Time(js) -A Time(jp) .

[0102] Among them, T ij is the time difference between the purchase and sale of the jth commodity of the i-th enterprise, A Time(js) and A Time(jp) They represent the sales time and purchase time of the jth product of enterprise i in the invoice matrix A. ij The maximum is 30 and the minimum is -30. For the above formula, there are several situations that need to be discussed:

[0103] 1. If the commodity is purchased and sold once in a single month, the above calculation shall apply;

[0104] 2. In a single month, if the sales of such goods come first and the purchases come later, the above calculation shall still apply;

[0105] 3. If there is no purchase or sale record of the commodity in a single month, the result shall be recorded as 0;

[0106] 4. In a single month, there are multiple purchase and sales records of this commodity. When the weighted calculation is performed according to the following formula:

[0107] Difference:

[0108]

[0109] Among them, S ij S represents the total sales amount of the jth product by the i-th enterprise in that month. ijn represents the amount of the nth sale; P ij P represents the total purchase amount of the i-th enterprise for the j-th commodity in that month. ijm Indicates the amount of the mth purchase.

[0110] The obtained enterprise production time difference matrix T is normalized according to the following formula:

[0111]

[0112] Among them, T ij It is the time difference for the enterprise in the i-th row in the production time difference matrix to start production of the j-th commodity.

[0113] Processing of commodity category matrix C

[0114] C ij =sgn(A ij ), where the sgn function is defined as follows:

[0115]

[0116] Explanation of matrix C: If the enterprise has purchased or sold a certain commodity, then there will be a positive value in the corresponding position of its production matrix A. After the sgn function, it will be converted to 1 at the corresponding position of C, which means that the enterprise has a purchase and sale record of this type of commodity. 0 means that the enterprise has no purchase and sale record of this type of commodity.

[0117] Representation learning with convolutional denoising autoencoders.

[0118] Convolutional denoising autoencoder model is constructed to process the three enterprise transaction matrices mentioned above and learn the data representation of enterprise transaction vectors. This model combines convolutional neural network with denoising autoencoder. Convolutional neural network is a mature technology that can be used to build association mapping between data. Denoising autoencoder can be regarded as an artificial neural network for unsupervised learning. Denoising is to remove the disturbance of outliers in the data to the training and improve the robustness of the model. The model structure has two stages: encoding stage and decoding stage.

[0119] First, it destroys the input data. The noise reduction autoencoder algorithm is used to randomly set the input data to zero using a Gaussian distribution, causing the data to lose some features. This not only removes some noise and reduces disturbances during the random zeroing process, but also allows the model to fill in the destroyed features as much as possible in subsequent training and improve learning ability.

[0120] Secondly, the corrupted data is used as the input of the encoding stage. The encoding stage has a data input layer, a convolution layer, a pooling layer, a fully connected layer, and an encoding output layer. After the encoding stage, the input data is compressed into a feature vector. Then the feature vector is restored after the decoding stage. The decoding stage has an encoding input layer, a fully connected layer, an upsampling layer, a deconvolution layer, and an output layer.

[0121] The following are the important steps to use autoencoders to obtain representation learning of corporate transaction data:

[0122] Step 1: Set the objective function.

[0123] In the encoding stage, the objective function of the convolutional layer is defined as f θ (x) is used to represent the processed output. Here x represents the input enterprise transaction data. The output feature vector of the convolutional layer is denoted as h, which represents the characteristics of the enterprise transaction, and is:

[0124] h=f θ (x) = s(Wx + b).

[0125] Among them, W represents the weight of the convolutional layer in the encoding stage, and b represents the bias vector of the convolutional layer.

[0126] For the corrupted enterprise transaction data vector x (t)∈{x (1) ,...,x (N)}, each vector has a corresponding output:

[0127] h (t) =f θ (x (t) ).

[0128] The convolution layer is followed by the pooling layer. The present invention uses the maximum pooling layer, which is mainly used for data downsampling to avoid overfitting. The maximum pooling retains the maximum value of a sliding window.

[0129] In the decoding stage, the objective function of the convolutional layer is defined as g β (h), where h is the enterprise transaction feature vector in the encoding stage. The decoding stage mainly "restores" the enterprise transaction feature vector obtained by encoding. The vector after model restoration is denoted as r. There are:

[0130] r = g β (h) = s(W′h+b′)

[0131] Among them, W' represents the weight matrix of the convolutional layer in the decoding stage, and b' represents the bias vector.

[0132] For each encoding vector h (t) ∈{h (1) ,...,h (N)}, both have:

[0133] r (t) =g β (h (t) ).

[0134] The parameters θ and β are mentioned in the encoding and decoding stages above. Both stages will continuously modify θ and β through training. θ is the encoding stage parameter, θ={W,b}, β is the decoding stage parameter, and β={W′,b'}. And s(·) represents the activation function in both the decoding and encoding stages.

[0135] Step 2: Model training and optimization.

[0136] During the training process, it is necessary to ensure that the error Loss is getting smaller and smaller. The error Loss is obtained by comparing the input enterprise transaction data x with the final decoded result r. It should be noted that the dimensions of x and r should be the same. The error Loss will continue to decrease with the iteration of the model. The smaller it is, the better the model training is, and the higher the quality of the representation vector h will be. The error function is defined as:

[0137]

[0138] Among them, considering that the numerical dimension of enterprise transaction characteristics is large, the mean square error loss function can be used, where g β (f θ (x (t) )) represents the output result of the decoding stage.

[0139] The back propagation algorithm is used to adjust the parameters. The adjustment formula is as follows:

[0140]

[0141] First, the decoding phase parameter θ is updated using the back propagation algorithm. The update process is as follows:

[0142]

[0143] Among them, α is the preset learning rate.

[0144] Step 3: Obtain the enterprise transaction data after dimensionality reduction processing.

[0145] By continuously adjusting and setting appropriate hyperparameters during training, the loss function is kept below the set threshold. After the model training is completed, the result of the encoding phase is extracted as the representation vector of the input data, which is used as the input for the subsequent multi-input fusion.

[0146] Multiple input fusion.

[0147] The above inputs after dimensionality reduction processing by the autoencoder are fused in a certain proportion to obtain the sample vector for clustering. The result X ij Calculate using the following formula:

[0148]

[0149] in are the results of the enterprise production matrix, enterprise production time difference matrix and commodity category matrix after the autoencoder dimensionality reduction processing. α and β are the time difference input weight and commodity category weight respectively. α and β can be adjusted dynamically and must meet the following requirements:

[0150] α+β<0.3,

[0151] α>>β.

[0152] The DBSCAN clustering algorithm clusters enterprise feature vectors.

[0153] The DBSCAN algorithm is a density-based clustering algorithm that is mainly used to find high-density areas separated by low-density areas. The relevant terms of the DBSCAN algorithm are explained as follows.

[0154] Core points: Core points are inside density-based clusters. The neighborhood of a point is determined by the distance function and the user-specified distance parameter e. And the number of points in a given neighborhood of a point exceeds the user-specified minimum number of domains P min . Then this point can be called a core point.

[0155] Boundary point: If a point is not a core point, but falls within the neighborhood of a core point, then the point is called a boundary point.

[0156] Noise point: If a point is neither a core point nor a boundary point, then the point is called a noise point.

[0157] The task of the present invention is to find these noise points, which actually mean potential abnormal enterprises in production, also known as abnormal points, and their tax behavior needs to be further examined.

[0158] The main steps of the DBSCAN algorithm may include:

[0159] Step 1: Algorithm initialization.

[0160] First, the input of the algorithm is the enterprise transaction data set D = {x (1) ,...,x (M) The input here is the enterprise representation vector obtained by the autoencoder in the previous step. Then the algorithm is initialized to initialize the core point set. Initialize the number of clusters k = 0, initialize the set of unvisited points Ψ = D, and set the distance measurement method. The distance measurement method usually uses the Euclidean distance, which is expressed as:

[0161]

[0162] Among them, x and y are two enterprise representation vectors, and N is the dimension of the vector.

[0163] Step 2: loop through each data.

[0164] Loop through each enterprise data point in the data set, calculate through the distance measurement method, and find the neighborhood point set N of each enterprise x If the number of samples in the neighborhood set of the data point is |N x |≥P min , then add the data point to the core point set:

[0165] Ω=Ω∪{x}.

[0166] Step 3: Select core points to generate clusters.

[0167] In the core enterprise point set Ω, randomly select a core enterprise point d and establish a cluster C with enterprise d as the core. d, include all neighboring points of enterprise d into the cluster. And update the unvisited point set Ψ=Ψ-{d}, marking the point as visited.

[0168] Step 4: Determine the samples in the neighborhood of the core point.

[0169] Next, for the neighborhood N of enterprise d d All points in the d , if q exists in the set of unvisited points Ψ, check whether the neighborhood of q satisfies |N q |≥P min , if satisfied, then N q Points in the set that do not belong to any cluster are assigned to C d Then return to step 3 to continue selecting the next core point until This means that all points have been visited.

[0170] In order to evaluate clusters, the silhouette coefficient is introduced. The range of the silhouette coefficient is [-1, 1]. The closer the value is to 1, the better the clustering performance is, the higher the cohesion within the cluster and the higher the separation between clusters. On the contrary, the closer the value is to -1, the worse the clustering performance is. The average distance between a data point and the data points in its cluster is denoted as a, and the average distance between a data point and other cluster samples is denoted as b. For this data point, the silhouette coefficient s is:

[0171]

[0172] s is the silhouette coefficient of a single data point. The average of the silhouette coefficients of all points gives the performance of the overall clustering. The final silhouette coefficient of the overall clustering is denoted by S:

[0173]

[0174] Determine the clustering effect based on the silhouette coefficient and adjust the parameters e and P min , until the clustering effect is good and the algorithm ends. Finally, the number of clusters k and the outliers that are not in any cluster are obtained.

[0175] Finally, the model is used to identify whether there are any anomalies in the production process of the enterprise from the invoice data. The production amount of the enterprise is preprocessed and input into the multi-input fusion model based on convolutional denoising auto-encoding to obtain data representation. The obtained data representation is then used as the input of the DBSCAN algorithm to find abnormal enterprises with obvious deviations in production based on unsupervised clustering.

[0176] This embodiment is used to solve the problem that it is difficult to identify whether an enterprise has put into production abnormally due to the lack of data labels. By combining the convolutional network with the autoencoder, the representation vector of the enterprise's production is extracted to improve the efficiency of training and detection. The noise reduction autoencoder algorithm is used to eliminate the influence of noise during training, and the model is more robust. It belongs to unsupervised learning, and it can identify whether an enterprise has abnormalities even without labeled data. This embodiment uses multi-input fusion methods to take into account the time difference between the purchase and sale of the enterprise and the category of goods as auxiliary factors, making full use of the existing invoice data.

[0177] Furthermore, in actual application, 590 commercial enterprises can be selected to obtain the transaction information of such enterprises for one year. The information can be used to detect the abnormality of the production of enterprises through algorithms. The abnormality detection method can include:

[0178] Step 1: Data preprocessing.

[0179] First, we obtain the invoice data of 590 commercial enterprises after the whole year's transactions. Each invoice has the following information: FPDM, FPHM, QDBZ, HWMC, SPBM, KPSJ, JE, SE, GFNSRDZDAH, XFNSRDZDAH, DZDZFPZT_ID, ID. The meaning of this information is invoice code, invoice number, list mark, name of goods, commodity code, invoice time, amount, tax amount, electronic file number of the purchaser's taxpayer, electronic file number of the seller's taxpayer, electronic account invoice status, and the goods ID in the same invoice. Since there are omissions and errors in commodity codes in real scenarios, the machine learning method is used to supplement and correct the commodity codes according to other information, so as to obtain XXHSPBM, that is, the commodity code after learning.

[0180] In this embodiment, the information required is the electronic file number of the purchaser's taxpayer (GFNSRDZDAH), the electronic file number of the seller's taxpayer (XFNSRDZDAH), the learned product code (XXHSPBM), the amount (JE), the product name (SPMC), and the invoicing time (KPSJ). Among them, the electronic file number of the purchaser's taxpayer and the electronic file number of the seller's taxpayer are both unique identification numbers for the enterprise, representing a unique enterprise. The product code is represented by a 19-digit digital string, representing a unique product. The product name represents the Chinese name of the product and other expressions. The amount represents the amount of the invoice in the transaction. A positive value indicates a normal transaction, and a negative value indicates a return.

[0181] Through database operation, we get the "input" table and "output" table of each enterprise. The structure of the "input" table is (purchaser taxpayer electronic file number, commodity code after learning, amount, commodity name), which indicates the amount record of the enterprise's input commodities; the structure of the "output" table is (seller taxpayer electronic file number, commodity code after learning, amount, commodity name), which indicates the amount record of the enterprise's output commodities. There are 3345 different commodities in the records. Therefore, the "input" matrix and "output" matrix obtained by further preprocessing are both 590*3345 dimensional matrices, which indicate the amount of money spent (earned) by 590 enterprises in 3345 commodities. If there is no record, it is recorded as 0.

[0182] In this embodiment, the data of the "input" matrix and the "output" matrix are normalized along the enterprise axis of the matrix to calculate the proportion of the amount of a certain commodity purchased (sold) by the enterprise to all commodities purchased (sold) by the enterprise. Taking the i-th enterprise of the "input" matrix G as an example, normalization is performed:

[0183]

[0184] Among them, G ij is the amount spent by the enterprise in the i-th row of the “input” matrix on the purchase of the j-th commodity, and N=3345 is the dimension of the enterprise vector. Similarly, the “output” matrix is ​​normalized:

[0185]

[0186] In this embodiment, after normalization, the "input" matrix and the "output" matrix are spliced ​​into a 590*6690 dimensional matrix, and the enterprise's "input" information and "output" information are combined into a vector, which represents the comprehensive reflection of the enterprise's transaction information throughout the year.

[0187] For the purchase and sale time difference matrix T, each row represents the purchase and sale time difference of all commodities of an enterprise. It is stipulated that for the same commodity, the invoicing time difference within one month is used as input. The specific calculation formula is as follows:

[0188]

[0189] The purchase and sale time difference of the goods not involved is recorded as 0, and finally a 590*3345 matrix is ​​generated. The obtained enterprise production time difference matrix T is normalized according to the following formula:

[0190]

[0191] For the commodity category matrix C, each row represents the purchase and sale of all commodities of a company. The specific calculation is as follows:

[0192] C ij=sgn(A ij )

[0193] Finally, a 590*6690 matrix C is generated.

[0194] Step 2: Representation learning based on convolutional denoising autoencoder.

[0195] The annual "input" and "output" amount information of 590 enterprises is used as the input of the convolutional denoising autoencoder model to extract the transaction features of the enterprises. The model randomly sets the input data to zero using a Gaussian distribution to destroy it, and uses the destroyed data as new input for training.

[0196] The detailed construction steps of the convolutional denoising autoencoder model are as follows:

[0197] Step 2.1, structural design.

[0198] The model is divided into two stages, the encoding stage and the decoding stage. In the encoding stage, the transaction features of 590 commercial enterprises are extracted. According to the commodity dimension in the matrix obtained in step 1, the number of input neurons M of the convolution layer in the encoding stage is determined. In this embodiment, M is 6690. The encoding stage has a data input layer, a convolution layer, a pooling layer, a fully connected layer, and an encoding output layer. The decoding stage has an encoding input layer, a fully connected layer, an upsampling layer, a deconvolution layer, and an output layer. It can be seen here that the purpose of the decoding stage is to restore the compressed original data and then compare the restored result with the original data.

[0199] Step 2.2, determine the network parameters of the model.

[0200] After the network structure is determined, specific parameters need to be determined. In this embodiment, except for the activation function output at the end of the decoding stage, which is the Sigmoid function, the activation functions used in the remaining layers are all linear rectification functions, namely, ReLU functions.

[0201] The formal representation of the Sigmoid function is:

[0202]

[0203] The formal representation of the ReLU function is:

[0204] f(x)=max(0,x).

[0205] The objective functions of the convolutional layer in the encoding stage and the convolutional layer in the decoding stage are f θ (x) and g β (h), x is the input data, h is the feature vector output in the encoding stage, and the loss function of the model is:

[0206]

[0207] Among them, g β (f θ (x (t) )) represents the output of the decoding stage, θ is the encoding stage parameter, and β is the decoding stage parameter. M is the number of enterprises, which is 590 in this embodiment. The network is forward propagated during the training process, and the back propagation algorithm is used when adjusting the network parameters. During back propagation, the decoding stage parameters are adjusted first, and then the encoding stage parameters are adjusted.

[0208] Enter a business vector x i , the target vector is also set to x i , the output is set to y i . Calculate the error between the output and the target according to the loss function:

[0209] Loss(θ,β,x i ,y i )=∑x i -y i 2 .

[0210] The output y i It is expressed as:

[0211] y i =g β (f θ (x i )).

[0212] In the embodiment, the back propagation algorithm is used to adjust the network parameters, and the adjustment process is as follows:

[0213]

[0214] Among them, α is the learning rate. In addition, the parameters of the convolution layer in the encoding stage are {filter number, kernelsize}, which represent the number of filters and the size of the convolution kernel. The parameters of the three convolution layers are {10, 10}, {32, 10}, {1, 10}, and the pooling layer parameter is k. The pooling layer parameters after each convolution layer are set to k=3, k=2, and k=4. Similarly, in the decoding stage, the parameters of the three convolution layers are {1, 10}, {32, 10}, and {10, 10}, and the pooling layer parameters are k=4, k=2, and k=3.

[0215] Repeat this process to calculate and process all enterprise vectors, and finally obtain an autoencoder model that can extract enterprise feature vectors.

[0216] The same processing is performed on the enterprise production time difference matrix and commodity category matrix.

[0217] Step 3: Multi-input fusion.

[0218] According to the model obtained in step 2, the transaction information of 590 enterprises is feature extracted, and the dimension of the enterprise production matrix is ​​590*128. The dimension of each enterprise vector is compressed from 6690 to 128. Similarly, the dimension of the enterprise production time difference matrix is ​​590*128, and the commodity category matrix is ​​590*128. The above processed matrices are fused according to the following formula:

[0219]

[0220] After fusion, the final input matrix X is obtained for subsequent density clustering.

[0221] Step 4: Perform cluster analysis based on the density-based DBSCAN algorithm.

[0222] The processed enterprise feature vector is used as input, and the DBSCAN algorithm is designed to perform cluster analysis on the enterprises and detect abnormal enterprises with production deviation.

[0223] In this embodiment, the distance measurement method of DBSCAN adopts Euclidean distance, which is formally expressed as follows:

[0224]

[0225] Among them, x and y are any two data points, that is, two enterprise feature vectors, and N=128 is the dimension of the enterprise feature vector.

[0226] Two parameters of the DBSCAN algorithm, the distance parameter e and the minimum sample size P within the cluster min ,According to the distribution interval of data points, the appropriate distance parameter and the minimum sample size interval within the cluster are defined, which are [0.6, 1.5] and [5, 12] respectively.

[0227] The nested loop structure is used to perform multiple clustering operations, and finally the clustering results under each parameter are obtained. The results include the number of clusters k and the number of outliers n. o , and the silhouette coefficient S of the clustering result. The silhouette coefficient is expressed as:

[0228]

[0229] Among them, a and b are the average distance between a data point and the data points in the cluster, and the average distance between a data point and other cluster samples. i is the silhouette coefficient of a single data point, and S is the silhouette coefficient of the entire cluster. The closer the value is to 1, the better the performance.

[0230] The group with the highest silhouette coefficient is selected for detailed evaluation, and detailed transaction information of all outliers is obtained for review.

[0231] Step 5: Identify abnormal production of enterprises.

[0232] The representation learning method designed in step 2 is used to extract the representation vectors of 590 commercial enterprises. The DBSCAN algorithm proposed in step 4 is used to perform cluster analysis on the 590 commercial enterprises. The number of clusters and the abnormal enterprises that are not in the clusters are obtained. The suspicious abnormal enterprises are handed over to tax inspectors for further verification. This method provides a solution for the lack of labels in corporate invoice data and the difficulty in identifying production deviations.

[0233] It can be seen that this embodiment first preprocesses the original data to obtain multiple data matrices, then extracts the representation vector to obtain the representation vector corresponding to each data matrix, and then performs multi-input fusion to obtain the target representation vector of the fusion of multiple representation vectors, and finally performs cluster analysis to obtain abnormal points. In the context of lack of labeled data, abnormal data can be detected with the help of unsupervised clustering algorithms, thereby improving the accuracy of data detection.

[0234] The following is an introduction to a data anomaly detection device provided in an embodiment of the present application. The data anomaly detection device described below and the data anomaly detection method described above can be referenced to each other.

[0235] Please refer to Figure 2 , Figure 2 A schematic diagram of the structure of a data anomaly detection device provided in an embodiment of the present application.

[0236] In this embodiment, the device may include:

[0237] The data preprocessing module 100 is used to preprocess the original data based on the data format to obtain multiple data matrices;

[0238] A representation vector extraction module 200 is used to extract representation vectors from multiple data matrices using a convolutional denoising autoencoder model to obtain a representation vector corresponding to each data matrix;

[0239] A multi-input fusion module 300 is used to perform multi-input fusion on all representation vectors to obtain a target representation vector;

[0240] The cluster analysis module 400 is used to perform cluster analysis on the target representation vector based on the density DBSCAN algorithm to obtain abnormal points;

[0241] The abnormal data marking module 500 is used to mark the data of abnormal points as abnormal data.

[0242] Optionally, the data preprocessing module 100 is specifically used to clean the original data to obtain the data to be sorted; and to sort the data to be sorted into data matrices based on the data format and data attributes to obtain multiple data matrices.

[0243] The present application also provides a server, comprising:

[0244] Memory for storing computer programs;

[0245] A processor is used to implement the steps of the data anomaly detection method as described in the above embodiment when executing the computer program.

[0246] The present application also provides a computer-readable storage medium, on which a computer program is stored. When the computer program is executed by a processor, the steps of the data anomaly detection method described in the above embodiment are implemented.

[0247] The various embodiments in the specification are described in a progressive manner, and each embodiment focuses on the differences from other embodiments. The same or similar parts between the various embodiments can be referred to each other. For the device disclosed in the embodiment, since it corresponds to the method disclosed in the embodiment, the description is relatively simple, and the relevant parts can be referred to the method part description.

[0248] Professionals may further appreciate that the units and algorithm steps of each example described in conjunction with the embodiments disclosed herein can be implemented in electronic hardware, computer software, or a combination of the two. In order to clearly illustrate the interchangeability of hardware and software, the composition and steps of each example have been generally described in the above description according to function. Whether these functions are performed in hardware or software depends on the specific application and design constraints of the technical solution. Professionals and technicians may use different methods to implement the described functions for each specific application, but such implementation should not be considered to be beyond the scope of this application.

[0249] The steps of the method or algorithm described in conjunction with the embodiments disclosed herein may be implemented directly using hardware, a software module executed by a processor, or a combination of the two. The software module may be placed in a random access memory (RAM), a memory, a read-only memory (ROM), an electrically programmable ROM, an electrically erasable programmable ROM, a register, a hard disk, a removable disk, a CD-ROM, or any other form of storage medium known in the art.

[0250] The above is a detailed introduction to a data anomaly detection method, a data anomaly detection device, a server, and a computer-readable storage medium provided by the present application. Specific examples are used herein to illustrate the principles and implementation methods of the present application. The description of the above embodiments is only used to help understand the method of the present application and its core idea. It should be pointed out that for ordinary technicians in this technical field, without departing from the principles of the present application, several improvements and modifications can be made to the present application, and these improvements and modifications also fall within the scope of protection of the claims of the present application.

Claims

1. A data anomaly detection method, characterized in that: include: Preprocessing the original data based on the data format to obtain multiple data matrices; wherein the original data is the tax invoice data obtained from the business operation process of the enterprise, and the data matrix includes the enterprise production matrix, the enterprise production time difference matrix, and the commodity category matrix; Using a convolutional denoising autoencoder model to extract representation vectors from the multiple data matrices to obtain a representation vector corresponding to each data matrix; Perform multi-input fusion on all the representation vectors to obtain a target representation vector; Performing cluster analysis on the target representation vector based on the density DBSCAN algorithm to obtain outliers; Marking the data of the abnormal point as abnormal data; The enterprise production matrix A is the input matrix With the output matrix The matrix obtained after splicing; in, , ; is the first Enterprise purchase The amount of money spent on the product, is the output matrix; The calculation formula of the enterprise production time difference matrix is: ; in, is the time difference between the purchase and sale of the jth commodity of the i-th enterprise, and They represent the sales time and purchase time of the jth product of enterprise i in the invoice matrix, The maximum is 30 and the minimum is -30; The calculation formula of the commodity category matrix is: ; Among them, the definition of sgn function is: ; Specifically, if an enterprise has purchased or sold a certain commodity, there will be a positive value in the corresponding position of its enterprise production matrix A. After the sgn function, it will be converted into 1 in the corresponding position of the commodity category matrix, indicating that the enterprise has a purchase and sale record of this type of commodity, and 0 means that the enterprise has no purchase and sale record corresponding to this type of commodity.

2. The data anomaly detection method according to claim 1, characterized in that: The raw data is preprocessed based on the data format to obtain multiple data matrices, including: Cleaning the original data to obtain data to be sorted; The data to be sorted is sorted into data matrices based on the data format and data attributes to obtain the multiple data matrices.

3. The data anomaly detection method according to claim 1, characterized in that: The convolutional denoising autoencoder model is used to extract representation vectors from the multiple data matrices to obtain a representation vector corresponding to each data matrix, including: Constructing based on a preset model structure to obtain the convolutional denoising autoencoder model; Using the convolutional denoising autoencoder model to perform model training on the multiple data matrices; When the model training is completed, the result of the model training is used as the representation vector corresponding to each data matrix.

4. The data anomaly detection method according to claim 1, characterized in that: All the representation vectors are multi-input fused to obtain the target representation vector, including: All the representation vectors are multi-input fused based on a preset ratio to obtain the target representation vector.

5. The data anomaly detection method according to claim 1, characterized in that: Based on the density DBSCAN algorithm, cluster analysis is performed on the target representation vector to obtain abnormal points, including: Setting parameters for the density DBSCAN algorithm; The target representation vector is clustered and analyzed based on the density DBSCAN algorithm to obtain the outlier point.

6. The data anomaly detection method according to claim 1, characterized in that: Also includes: Prompt information is sent based on the abnormal data.

7. A data anomaly detection device, characterized in that: include: A data preprocessing module is used to preprocess the original data based on the data format to obtain multiple data matrices; wherein the original data is the tax invoice data obtained from the business operation process of the enterprise, and the data matrix includes the enterprise production matrix, the enterprise production time difference matrix, and the commodity category matrix; A representation vector extraction module, used to extract representation vectors from the multiple data matrices using a convolutional denoising autoencoder model to obtain a representation vector corresponding to each data matrix; A multi-input fusion module, used for performing multi-input fusion on all the representation vectors to obtain a target representation vector; A cluster analysis module, used to perform cluster analysis on the target representation vector based on a density DBSCAN algorithm to obtain abnormal points; An abnormal data marking module, used to mark the data of the abnormal point as abnormal data; The enterprise production matrix A is the input matrix With the output matrix The matrix obtained after splicing; among them, , ; is the first Enterprise purchase The amount of money spent on the product, is the output matrix; The calculation formula of the enterprise production time difference matrix is: ; in, is the time difference between the purchase and sale of the jth commodity of the i-th enterprise, and They represent the sales time and purchase time of the jth product of enterprise i in the invoice matrix, The maximum is 30 and the minimum is -30; The calculation formula of the commodity category matrix is: ; Among them, the definition of sgn function is: ; Specifically, if an enterprise has purchased or sold a certain commodity, there will be a positive value in the corresponding position of its enterprise production matrix A. After the sgn function, it will be converted into 1 in the corresponding position of the commodity category matrix, indicating that the enterprise has a purchase and sale record of this type of commodity, and 0 means that the enterprise has no purchase and sale record corresponding to this type of commodity.

8. The data anomaly detection device according to claim 7, characterized in that: The data preprocessing module is specifically used to clean the original data to obtain the data to be sorted; and to sort the data to be sorted into data matrices based on the data format and data attributes to obtain the multiple data matrices.

9. A server, characterized in that: include: Memory for storing computer programs; A processor, configured to implement the steps of the data anomaly detection method according to any one of claims 1 to 6 when executing the computer program.

10. A computer-readable storage medium, characterized in that: The computer-readable storage medium stores a computer program, and when the computer program is executed by a processor, the steps of the data anomaly detection method according to any one of claims 1 to 6 are implemented.