Big data anomaly detection method under weak supervision or non-supervision condition
Through the method of random sampling and perceptron comprehensive evaluation, it solves the problems of high time consumption and high computational complexity of anomaly detection in big data, and achieves efficient and accurate abnormal data detection, which is suitable for labeled and unlabeled data.
Patent Information
- Application Number
- CN202410796306.6
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2024-06-20
- Publication Date
- 2024-10-01
AI Technical Summary
Existing anomaly detection methods in big data are time-consuming and computationally expensive, and are difficult to effectively detect abnormal data in unlabeled or weakly labeled data. In particular, clustering and neural network-based methods have limitations and high computational costs. .
Anchor points are established through random sampling, the anomaly scores of the data are judged based on the anchor points, and the perceptron is used for comprehensive evaluation to reduce the computational complexity and is suitable for anomaly detection of labeled and unlabeled data.
It achieves efficient and accurate abnormal data detection, reduces computational complexity, is suitable for a variety of data conditions, and improves detection accuracy and robustness.
Smart Images

Figure FT_1 
Figure FT_2 
Figure QLYQS_1
Abstract
Description
Technical Field
[0001] The present invention belongs to the field of big data processing. The present invention mainly deals with the problem of discovering abnormal data in big data, and can be used to discover abnormal data in big data when there is no label at all in the big data or when only a small part of the data has a label.
[0002] Anomaly detection can be applied to many fields such as mechanical fault detection, product quality defect detection, network intrusion detection, commercial fraud detection, etc., to solve various practical application problems in production and life. Background Art
[0003] The development of information technology has created a huge explosion of data. At present, big data has been integrated into people’s daily lives and will continue to play an increasingly important role in people’s production and life.
[0004] Big data is a valuable resource. On the one hand, people hope that big data is as accurate as possible and always hope to eliminate abnormal data in big data. On the other hand, some abnormal data in big data often contain a lot of information, and this information is often the most valuable. Whether it is to eliminate abnormal data in big data, clean the data, or find valuable information through abnormal data, the abnormal data in the data must be detected first. The present invention provides an efficient abnormal data detection method that can be used with big data.
[0005] The existing anomaly detection methods mainly include clustering-based anomaly detection methods, probability distribution-based anomaly detection methods, isolation forest-based anomaly detection methods, and neural network-based anomaly detection methods. Clustering-based anomaly detection methods require clustering of data sets, finding cluster centers, and judging whether a data point is an anomaly by the distance between the data point and the center. However, clustering is often a time-consuming process, and the computational cost of anomaly detection is generally high. Probability distribution-based anomaly detection requires a large number of samples to estimate the overall distribution of the data set, which often has large errors. Isolation forest is a relatively good anomaly detection method with relatively high efficiency and accuracy, but isolation forests often divide and establish isolated trees according to the attributes of the data, and this division has certain limitations. There are many studies on anomaly detection based on neural networks, and good results have been achieved. However, the computational cost of training neural networks is large, and the interpretability is relatively poor.
[0006] The anomaly detection method proposed in the present invention establishes anchor points through random sampling, judges the anomaly score of each data according to the anchor points, then uses the perceptron to integrate the anomaly scores, and finally judges whether the data is an outlier according to the result of the perceptron. This scheme has the advantages of high efficiency of isolation forest, and is suitable for anomaly detection of labeled data and unlabeled data, and has wider applicability. Summary of the invention
[0007] The present invention discloses an anomaly detection method suitable for big data, which can be applied to anomaly detection of unlabeled data and anomaly detection of weakly labeled data. The present invention mainly includes three processes: anchor point extraction, anchor point-based anomaly value scoring, and perceptron-based anomaly value judgment.
[0008] D is the original data set, d i represents the i-th record in data D, |D| represents the number of records contained in data D, A k represents the kth anchor point dataset randomly drawn from D, Represents the anchor dataset A k The tth record in The original data set D is divided into several subsets according to the radius of each subset. The outlier score of each record is given. Finally, each record is evaluated according to the outlier score obtained from all anchor data sets to determine whether each record is an abnormal data point. The specific algorithm is shown in Algorithm 1.
[0009] Algorithm 1
[0010] Input: original data set D, initialization parameters M, N, S1, S2…, S N Represents N empty set outputs: the comprehensive outlier score for each data in the dataset D
[0011] (1) Randomly extract M anchor datasets A from dataset D with replacement k , where each anchor data set contains N records
[0012] (2) Fork = 1 to M / / Calculate an anomaly score for each anchor point dataset (3) Randomly select a distance calculation method dist from the distance dataset,
[0013] (4) For i = 1 to |D| / / Divide each record in the original data set
[0014] (5) T=0,
[0015] (6) Forj = 1 to N / / Calculate the distance between the original data set and each anchor point in the anchor data set
[0016] (7)
[0017] (8) T=j
[0018] (9) Endfor
[0019] (10) Put d i Put in data set S T
[0020] (11)Endfor
[0021] (12) Calculate S l=1…N The radius of each data set in
[0022] (13) Given a record d in data set D i This outlier score is Where S l is d i The dataset
[0023] (14)Endfor
[0024] (15) Use the perceptron to calculate each record d in D i Comprehensive outliers
[0025] (16) Determine whether each record is an outlier based on the comprehensive outlier value
[0026] In Algorithm 1, random sampling with replacement is used, which means that part of the data is randomly selected each time to form an anchor data set, and then the data in the anchor data set is put back into the original data set before the next anchor data set is extracted. Sampling with replacement ensures that the extracted data set can reflect the data characteristics of the original data set to the greatest extent.
[0027] The values of the initialization parameters M and N are specified by the user. M is the number of extracted anchor data sets. The larger the M value, the more anchor data sets are extracted, the better the characteristics of the original data set are reflected, and the higher the detection accuracy is. N represents the number of anchor points in each anchor data set. The larger its value, the more data is extracted, and the better the overall distribution of the data set is reflected. The more data is extracted, the greater the amount of calculation. It is generally recommended that the value of N be greater than the actual number of categories in the data set D and less than 0.1 times the actual number of records in the data set D.
[0028] The distance dataset contains multiple distance calculation methods. Each anchor dataset can randomly select a distance calculation method from them. When a distance calculation method is selected for an anchor dataset, all distance calculations related to the anchor point will use this distance calculation method. It mainly includes Euclidean distance, Manhattan distance, cosine distance, Hamming distance and user-defined distance. User-defined distance allows users to define their own distance according to the characteristics of the data record itself.
[0029] The radius of the data set S′ is r S′ , record d′ is a record selected arbitrarily from the data set S′, and the radius r is defined S′ =max(dist(d′,d i ′) i=1,…,S′), that is, the radius of the data set S′ is defined as the maximum distance between a record selected at random in S′ and other records. Using this radius calculation method, the complexity of calculating the radius of the data set S′ is reduced from O(n 2 ) is reduced to O(n), greatly improving the efficiency of the algorithm.
[0030] Each time an anchor data set is extracted, the records in the original data set are scored for outliers. i This outlier score is Where S l is d i The dataset where YesS l Radius. The larger the radius, the more dispersed the data subset in which the record is located, indicating that the data subset is more likely to contain outliers, so the outlier score of the records in the subset is higher. After completing an outlier scoring, another anchor data set is extracted for the next outlier scoring. Because abnormal data often deviates far from normal data, if a subset contains abnormal data, the records in the subset will have a higher outlier score. If a subset only contains normal data, the outlier score of the records in the subset will be relatively low. Since multiple anchor data sets will be extracted and different distance calculation methods will be used, subclass divisions with large differences will be formed, and the abnormal data will eventually have a relatively high anomaly score.
[0031] If some of the data has labels, then based on r k Construct a perceptron. First, transform r k The values are standardized to the interval [0,1], and the outlier value score of the outlier point is defined as 1, and the outlier value score of the normal point is defined as 0. Then, the sample data is used in the above anchor-based anomaly detection algorithm. The sample is scored based on the abnormality of different anchor point data sets, and the normalized score is used for the perception machine. Training, using the gradient descent algorithm to update w k After training, fix w k The value of is used for abnormal data detection.
[0032] If all data are unlabeled data, directly calculate the cumulative sum of the anomaly scores given based on each anchor point data set. Equivalent to w k The value of is 1.
[0033] Compared with other anomaly detection methods, the advantages of the present invention are its high efficiency and high precision. In the present invention, there is no need to cluster the data, and there is no need to calculate the distance between each data in the data set. It only needs to calculate the distance between the data in the data set and the extracted anchor point, so the calculation cost is relatively low. Generally speaking, the time complexity of calculating the distance between each record of the data is O(n 2 ), in the present invention, the complexity is reduced to O(n) through a random sampling strategy, which greatly improves the efficiency of the algorithm.
[0034] The extraction of anchor data collects the features of the original data to the greatest extent possible. The more anchor data sets there are and the more anchor points there are, the more the overall features of the original data set can be reflected. The extraction of multiple anchor data sets increases the robustness of the algorithm.
[0035] Distance plays a vital role in the field of data mining. Different distances describe the differences between data from different angles. In the present invention, multiple distances are used to judge the differences between data records from different angles, avoiding the system deviation caused by a single distance calculation method. The distances used mainly include Euclidean distance, Manhattan distance, cosine distance, Hamming distance and user-defined distance. The user-defined distance can be based on the nesting or integration of Euclidean distance, Manhattan distance, cosine distance and Hamming distance.
[0036] The present invention uses a perceptron to synthesize the abnormal score values of data obtained from data sets based on different anchor points. The introduction of the perceptron expands the applicability of the present invention, so that the present invention can be used for the detection of abnormal data under supervised, unsupervised and weakly supervised conditions. For unlabeled data sets, the weight vector of the perceptron is directly set to 1. If there is some labeled data, the perceptron is trained using these data, and the trained perceptron is used to detect abnormal data.
[0037] Another object of the present invention is to provide a computer-readable storage medium, comprising instructions, which, when executed on a computer and a corresponding system, enable the computer and the related system to execute the method for detecting anomalies in big data under weak supervision or unsupervised conditions.
[0038] Another object of the present invention is to provide a control system or application system for implementing the anomaly detection method of big data anomaly detection method under weak supervision or unsupervised conditions.
[0039] In summary, the advantages and effects of the present invention are:
[0040] The present invention provides a data anomaly detection method that is different from the existing methods. The method is significantly higher than the existing algorithms and has a higher detection accuracy. The method can be used for anomaly detection of labeled or partially labeled data, and can also be used for unlabeled anomaly detection. The present invention can be used to detect financial fraud in the financial field, detect network intrusion and network risks in the user network field, and check product defects in production. The application field of the present invention is not limited to the above-listed contents, and can be used to detect abnormal records in ordinary data sets. BRIEF DESCRIPTION OF THE DRAWINGS
[0041] Figure 1 System overall structure diagram
[0042] Figure 2 Anomaly detection diagram DETAILED DESCRIPTION
[0043] In order to make the purpose, technical solution and advantages of the present invention more clearly understood, the present invention is further described in detail below in conjunction with the embodiments. It should be understood that the specific embodiments described herein are only used to explain the present invention and are not used to limit the present invention.
[0044] In the present invention, uniform random sampling is used to extract anchor point data, and samples are extracted from the original data with equal probability. Compared with the entire data set, abnormal data often accounts for only a small number, so when sample points are extracted as anchor points with equal probability, the probability of extracting normal data will be relatively large, so the extracted anchor point set can be considered to contain no or very little abnormal data.
[0045] The following is a specific example to illustrate the algorithm operation process. Figure 2 As shown in the figure, the data set contains seven records. The first extracted anchor point data set contains data records d1 and d5. A distance calculation method is randomly selected, and the other data records are divided into two subclasses according to the proximity principle (such as Figure 2 As shown in (1), d1, d2, and d3 are divided into one category, and d4, d5, d6, and d7 are divided into another category. Then, the anomaly score of each record is calculated based on the radius of each subclass. Obviously, the anomaly values of d4, d5, d6, and d7 are greater than the anomaly scores of d1, d2, and d3. The second extraction of d3 and d4 forms an anchor data set, and a distance is randomly selected. Based on the anchor data set, the original data is divided into two subsets. The results are as follows Figure 2As shown in (2), d1, d3, d5, and d6 are divided into one subset, and d2, d4, and d7 are divided into one subset. Similarly, the anomaly score of each record is obtained based on the radius of the two subclasses. The anomaly score of d2, d4, and d7 is greater than the anomaly score of d1, d3, d5, and d6. After two anchor point extractions and detections, it is found that the anomaly score of d4 and d7 is higher than the anomaly score of other records. If the third and fourth rounds of anchor point data extraction are performed and the anomaly score is scored respectively, the anomaly score of d7 will become higher and higher, and it will eventually be determined as an anomaly point.
[0046] A distance calculation method is randomly selected in each judgment process. The use of multiple distance calculation methods can describe the differences between data records from multiple aspects, and can more comprehensively describe the characteristics of different records, avoiding improper selection of distance calculation methods and causing system misjudgment.
[0047] The present invention uses Euclidean distance, Manhattan distance, cosine distance, Hamming distance and user-defined distance.
[0048] Euclidean distance, also known as Euclidean distance, is the most widely used distance. For n, the distance between vectors a and b in space is where x i ,y i is the i-th component of vectors a and b.
[0049] Manhattan distance, also known as taxi distance, is mainly reflected in the grid, the distance a taxi travels from one point to another. The Manhattan distance between vectors a and b is defined as: where x i ,y i is the i-th component of vectors a and b.
[0050] The cosine distance measures the distance between two vectors by the cosine of the angle between them. For vector a = (x1, x2, x3, ..., x n ) and b=(y1,y2,y3,…,y n ) The distance between vectors a and b is defined as The larger the cosine, the smaller the angle between the two vectors.
[0051] The Hamming distance is the minimum number of character substitutions required to transform one of two strings of equal length into the other. The Hamming weight is the Hamming distance of a string relative to a zero string of the same length, that is, the number of non-zero elements in the string. For a binary string, it is the number of 1s, so the Hamming weight of 11101 is 4. Therefore, the Hamming distance between elements a and b in the vector space is equal to the difference ab in their Hamming weights. The Hamming distance is often used to measure the distance between non-numerical vectors.
[0052] User-defined distance mainly means that the user adopts, but is not limited to, a combination or nesting of part or all of the above distance measurement methods based on the characteristics of the data itself. Any simple replacement of the distance measurement method in the invention is within the protection scope of the present invention.
[0053] In the present invention, it can be implemented in whole or in part by software, hardware, firmware or any combination thereof. When the use is implemented in whole or in part in the form of a computer program product, the computer program product includes one or more computer instructions. When the computer program instructions are loaded or executed on a computer, the process or function described in the embodiment of the present invention is generated in whole or in part. The computer may be a general-purpose computer, a special-purpose computer, a computer network, or other programmable device. The computer instructions may be stored in a computer-readable storage medium, or transmitted from one computer-readable storage medium to another computer-readable storage medium. For example, the computer instructions may be transmitted from one website site, computer, server or data center by wired (e.g., coaxial cable, optical fiber, digital subscriber line (DSL) or wireless (e.g., infrared, wireless, microwave, etc.) mode) to another website site, computer, server or data center. The computer-readable storage medium may be any available medium that a computer can access or a data storage device such as a server or data center that includes one or more available media integrated. The available medium may be a magnetic medium (e.g., a floppy disk, a hard disk, a tape), an optical medium (e.g., a DVD), or a semiconductor medium (e.g., a solid-state hard disk Solid State Disk (SSD)), etc.
[0054] The above description is not intended to limit the present invention. Any modifications, equivalent substitutions and improvements made within the spirit and principles of the present invention should be included in the protection scope of the present invention.
Claims
1. The present invention discloses a big data anomaly detection method under weak supervision or unsupervised conditions. The method can be applied to anomaly detection of unlabeled data and anomaly detection of weakly labeled data. The present invention mainly includes three processes: anchor point extraction, anchor point-based anomaly value scoring, and perceptron-based anomaly value judgment.
2. The method for detecting anomalies in big data under weak supervision or unsupervised conditions as described in claim 1, wherein the specific process is as follows: Algorithm 1 Input: original data set D, initialization parameters M, N, S 1 ,S 2 …,S N Represents N empty set outputs: the comprehensive outlier score for each data in the dataset D (1) Randomly extract M anchor datasets A from dataset D with replacement k , where each anchor data set contains N records (2) Fork = 1 to M / / Calculate an anomaly score for each anchor point dataset (3) Randomly select a distance calculation method dist from the distance dataset, (4) For i = 1 to |D| / / Divide each record in the original data set (5) T=0, (6) Forj = 1 to N / / Calculate the distance between the original data set and each anchor point in the anchor data set (7) (8) T=j (9)Endfor (10) Put d i Put in data set S T (11)Endfor (12) Calculate S l=1…N The radius of each data set in (13) Given a record d in data set D i This outlier score is Where S l is d i The dataset (14)Endfor (15) Use the perceptron to calculate each record d in D i Comprehensive outliers (16) Determine whether each record is an outlier based on the comprehensive outlier value.
3. The detection method according to claim 1 and claim 2, It is characterized in that Anchor point extraction uses random sampling with replacement. Each time, part of the data is randomly extracted to form an anchor point data set. The data in the anchor point data set is then put back into the original data set before the next anchor point data set is extracted.
4. The detection method according to claim 1 and claim 2, It is characterized in that For each anchor point data set, a distance calculation method can be randomly selected from the distance data set. When a distance calculation method is selected for an anchor point data set, all distance calculations related to the anchor point use this distance calculation method. The distance data sets mainly include Euclidean distance, Manhattan distance, cosine distance, Hamming distance and user-defined distance. User-defined distance allows users to define their own distance according to the characteristics of the data record itself.
5. The detection method according to claim 1 and claim 2, It is characterized in that The radius of the data set S′ is r S′ , record d′ is a record selected arbitrarily from the data set S′, and the radius r is defined S′ =max(dist(d′,d i ′) i=1,…,|S′| ), that is, the radius of the data set S′ is defined as the maximum distance between an arbitrarily selected record in S′ and other records.
6. The detection method according to claim 1, It is characterized in that Each time an anchor data set is extracted, the records in the original data set are scored for outliers. i This outlier score is Where S l is d i The data subset where YesS l Radius: The larger the radius, the more dispersed the data subset in which the record is located, indicating that the data subset is more likely to contain outliers, so the outlier score of the record in the subset is higher.
7. The detection method according to claim 1 and claim 2, It is characterized in that If some of the data has labels, then based on r k Construct a perceptron. First, transform r k The values are standardized to the interval [0,1], and the outlier value score of the outlier point is defined as 1, and the outlier value score of the normal point is defined as 0. Then, the sample data is used in the above anchor-based anomaly detection algorithm. The sample is scored based on the abnormality of different anchor point data sets, and the normalized score is used for the perception machine. Training, using the gradient descent algorithm to update w k After the training is completed, the value of w is fixed. k The value of is used for abnormal data detection.
8. The detection method according to claim 1 and claim 2, It is characterized in that If all the data in the dataset are unlabeled data, directly calculate the cumulative sum of the anomaly scores given by each anchor point dataset. Equivalent to w k The value of is 1.
9. A computer-readable storage medium comprising instructions, which, when executed on a computer, enables the computer to execute the big data anomaly detection method under weak supervision or unsupervised conditions as described in claim 1.
10. A control system for implementing the big data anomaly detection method under weak supervision or unsupervised conditions as described in claim 1.
