Updating method and device of abnormality detection system
By integrating the results of multiple basic detection models and learning the model weights, the problem of insufficient accuracy and availability of existing anomaly detection methods is solved, and a more accurate and general anomaly detection system is realized.
Patent Information
- Application Number
- CN202111372050.9
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2021-11-18
- Publication Date
- 2024-11-08
- Estimated Expiration
- 2041-11-18
AI Technical Summary
The existing anomaly detection methods are difficult to meet the increasing actual needs and cannot effectively improve the accuracy and availability of abnormal detection results.
By introducing a variety of basic detection models, the abnormal detection results are effectively integrated, and the model weight learning network is used to automatically learn model weights, so as to realize end-to-end training and update of the abnormal detection system, and automatically determine the query weight and model weight of the query sequence. .
More accurate abnormal detection results are achieved, the universality and adaptability of the detection system are improved, and the changes in different sequence patterns and models can be automatically adapted to different sequence patterns and models, and the accuracy and usability of the detection results are improved.
Smart Images

Figure CN114139613B_ABST
Abstract
Description
Technical Field
[0001] One or more embodiments of the present specification relate to the field of machine learning technology, and more particularly, to a method and device for updating an anomaly detection system. Background Art
[0002] Anomaly detection is required in many fields, such as website maintenance, instrument performance maintenance, financial transaction maintenance, etc. Generally, anomaly detection aims to detect and identify abnormal data points or abnormal change trends, thereby assisting in tracing and judging the problems in the corresponding fields, or taking timely countermeasures, thereby reducing losses and ensuring user experience.
[0003] However, the current implementation methods of anomaly detection are difficult to meet the increasing practical needs. Therefore, a solution is needed to effectively improve the accuracy and availability of anomaly detection results. Summary of the invention
[0004] One or more embodiments of the present specification describe a method and device for updating anomaly detection system, which provides a more accurate final detection result by effectively fusing anomaly detection results of different basic models.
[0005] According to a first aspect, a method for updating an anomaly detection system is provided, wherein the anomaly detection system includes M basic detection models, and the method includes: obtaining multiple historical sequences and N typical sequences selected therefrom, each historical sequence including corresponding L indicator values arranged in chronological order; taking the various historical sequences as query sequences in turn, and determining N query weights of the query sequence for the N typical sequences; for each typical sequence in the N typical sequences, performing anomaly detection on it respectively using the M basic detection models to obtain M detection results, and fusing the M detection results to obtain a fused detection result corresponding to the typical sequence; using the N query weights to weight the N fused detection results corresponding to the N typical sequences to obtain a weighted result corresponding to the query sequence; and updating the anomaly detection system based on the weighted result and the anomaly category label corresponding to the query sequence.
[0006] In one embodiment, the above-mentioned acquisition of multiple historical sequences includes: acquiring multiple indicator values continuously collected for a specific indicator at a predetermined time interval to form a total historical sequence; for each indicator value among the multiple indicator values, tracing back L indicator values from the indicator value in the total historical sequence to form a historical sequence corresponding to the indicator value.
[0007] In a specific embodiment, before updating the anomaly detection system based on the weighted results and the anomaly category labels corresponding to the query sequence, the method further includes: obtaining multiple anomaly category labels corresponding to the multiple indicator values; after forming the historical sequence corresponding to the indicator value, using the anomaly category label corresponding to the indicator value as the anomaly category label corresponding to the historical sequence.
[0008] In one embodiment, the obtaining of multiple historical sequences and selecting N typical sequences therefrom includes: obtaining the multiple historical sequences; and clustering the multiple historical sequences to obtain N cluster centers as the N typical sequences.
[0009] In one embodiment, the determining of N query weights of the query sequence for the N typical sequences includes: calculating N similarities between the query sequence and the N typical sequences; and determining the N query weights based on the N similarities.
[0010] Further, in a specific embodiment, the calculating of N similarities between the query sequence and the N typical sequences includes: calculating a dot product between an embedding vector corresponding to the query sequence and an embedding vector corresponding to each typical sequence as the corresponding similarity.
[0011] On the other hand, in a specific embodiment, determining the N query weights based on the N similarities includes: normalizing the N similarities to obtain the N query weights.
[0012] In one embodiment, the anomaly detection system also includes a model weight learning network; the above-mentioned fusing the M detection results to obtain the fused detection result corresponding to the typical sequence includes: for each basic detection model in the M basic detection models, inputting its N detection results for the N typical sequences into the model weight learning network to obtain its corresponding model weight; using the M model weights corresponding to the M basic detection models, weighted processing is performed on the M detection results to obtain the fused detection result.
[0013] Further, in a specific embodiment, the detection results output by the above-mentioned each basic detection model are L-dimensional vectors, wherein each vector element indicates whether the corresponding indicator value in the input sequence is an abnormal value; the model weight learning network includes a pooling layer, a first fully connected layer, an activation layer, a second fully connected layer and a weight prediction layer; wherein, for each basic detection model in the M basic detection models, its N detection results for the N typical sequences are input into the model weight learning network to obtain its corresponding model weight, including: in the pooling layer, the N L-dimensional vectors corresponding to the N detection results are respectively pooled to obtain an N-dimensional vector; in the first fully connected layer, the N-dimensional vector is reduced in dimension using a first parameter matrix; in the activation layer, the vector after the reduced dimension processing is activated; in the second fully connected layer, the vector obtained by the activation processing is reduced in dimension to a scalar value using a second parameter matrix; in the weight prediction layer, the scalar value is processed using a sigmoid function to obtain the second weight.
[0014] On the other hand, in a specific embodiment, the M detection results are weighted using the M model weights corresponding to the M basic detection models to obtain the fused detection result, including: weighted processing the M detection results using the M model weights to obtain M weighted items; and splicing the M weighted items to obtain the fused detection result.
[0015] In one embodiment, the anomaly detection system also includes an output layer; wherein, based on the weighted result and the anomaly category label corresponding to the query sequence, the anomaly detection system is updated, including: in the output layer, using the parameter matrix therein to perform a linear transformation on the weighted result, and using a softmax function to process the result of the linear transformation, so as to obtain the anomaly detection result corresponding to the query history sequence; based on the anomaly detection result and the anomaly category label, the model parameters in the anomaly detection system are updated.
[0016] According to a second aspect, an updating device for an anomaly detection system is provided, wherein the anomaly detection system includes M basic detection models, and the device includes: a sequence acquisition unit, configured to acquire multiple historical sequences and N typical sequences selected therefrom, each historical sequence including corresponding L indicator values arranged in chronological order; a query weight determination unit, configured to use the respective historical sequences as query sequences in turn, and determine N query weights of the query sequence for the N typical sequences; a fusion result determination unit, configured to perform anomaly detection on each typical sequence in the N typical sequences using the M basic detection models respectively, obtain M detection results, and fuse the M detection results to obtain a fusion detection result corresponding to the typical sequence; a weighted result determination unit, configured to perform weighted processing on the N fusion detection results corresponding to the N typical sequences using the N query weights, to obtain a weighted result corresponding to the query sequence; and a parameter updating unit, configured to update the anomaly detection system based on the weighted result and the anomaly category label corresponding to the query sequence.
[0017] According to a third aspect, a computer-readable storage medium is provided, on which a computer program is stored. When the computer program is executed in a computer, the computer is caused to execute the method provided in the first aspect.
[0018] According to a fourth aspect, a computing device is provided, including a memory and a processor, wherein an executable code is stored in the memory, and when the processor executes the executable code, the method provided in the first aspect is implemented.
[0019] In summary, in the method and device disclosed in the embodiments of this specification, a newly designed anomaly detection system with extremely strong versatility is proposed, and basic models can be added or deleted arbitrarily. Using this anomaly detection system, the query weights of different typical sequences (corresponding to different sequence patterns) can be automatically determined for the query sequence. Furthermore, the model weights of different basic models can also be automatically learned, thereby realizing end-to-end training and updating of the anomaly detection system. Therefore, the trained anomaly detection system can be used to effectively integrate the anomaly detection results of multiple basic models, thereby realizing more accurate anomaly detection. BRIEF DESCRIPTION OF THE DRAWINGS
[0020] In order to more clearly illustrate the technical solutions disclosed in the embodiments of this specification, the drawings required for use in the description of the embodiments will be briefly introduced below. Obviously, the drawings described below are only some embodiments of the present invention. For ordinary technicians in this field, other drawings can be obtained based on these drawings without paying creative work.
[0021] Figure 1A schematic diagram of an implementation architecture of an update anomaly detection system according to an embodiment is shown;
[0022] Figure 2 A flow chart showing an updating method of an abnormality detection system according to an embodiment is shown;
[0023] Figure 3 A schematic diagram of an implementation architecture for determining model weights according to one embodiment is shown;
[0024] Figure 4 A schematic diagram of a model weight learning network according to an example is shown;
[0025] Figure 5 A schematic structural diagram of an updating device of an abnormality detection system according to an embodiment is shown. DETAILED DESCRIPTION
[0026] The solution provided in this specification is described below in conjunction with the accompanying drawings.
[0027] As mentioned above, a solution is needed to effectively improve the accuracy and availability of anomaly detection results. At present, with the rise of machine learning technology, building machine learning models for anomaly detection has become a major research hotspot. In traditional solutions, considering that time series of different types of indicators have different patterns, for example, there are stable patterns, non-stationary patterns, periodic patterns, etc., it is inclined to build a single machine learning model for time series with specific patterns in order to achieve better prediction results. The machine learning model constructed in this case is not universal. Even if anomaly detection models are trained for different sequence patterns, when facing time series that need to be detected for anomalies in actual applications, it is still necessary to manually select the anomaly detection model. In addition, the sequence pattern of a new type of indicator may be different from all the sequence patterns that have been considered.
[0028] Based on this, the embodiments of this specification provide a new anomaly detection solution, which introduces multiple existing anomaly detection models as basic detection models (or simply basic models), and effectively fuses the anomaly detection results of multiple basic models to determine a more accurate final detection result.
[0029] Figure 1 A schematic diagram of an implementation architecture of an update anomaly detection system according to an embodiment is shown, wherein the anomaly detection system at least includes Figure 1 The M base models shown in The data used for its update involves the historical sequence data set and N typical sequences {k1,...,k N}.
[0030] like Figure 1As shown, on the one hand, an arbitrary historical sequence is used as a query sequence, and N query weights {p1,...,p N}; On the other hand, for the typical sequence k i , use M basic models to perform anomaly detection and obtain M detection results So we get the fusion result v i ; Further, using N query weights {p1,...,p N} for N fusion results {v1,...,v N} to obtain the final detection result for the query sequence, and use the final detection result and the corresponding anomaly category label to update the model parameters of the anomaly detection system. In this way, the anomaly detection system can be iteratively updated, and after multiple rounds of iterative updates, the anomaly detection system can be used to accurately identify abnormal data points or abnormal change trends.
[0031] Next, the implementation steps of the above-mentioned inventive concept are described in conjunction with specific embodiments. Figure 2 A flowchart of an updating method of an abnormality detection system according to an embodiment is shown. The execution subject of the method can be any device, server or device cluster with computing and processing capabilities, such as Figure 2 As shown, the method comprises the following steps:
[0032] Step S210, obtaining multiple historical sequences and N typical sequences selected therefrom, each historical sequence including corresponding L indicator values arranged in chronological order; step S220, taking each of the historical sequences as a query sequence in turn, and determining N query weights of the query sequence for the N typical sequences; step S230, for each of the N typical sequences, using the M basic detection models to perform anomaly detection on it respectively, to obtain M detection results, and fusing the M detection results to obtain a fused detection result corresponding to the typical sequence; step S240, using the N query weights, weighting the N fused detection results corresponding to the N typical sequences to obtain a weighted result corresponding to the query sequence; step S250, updating the anomaly detection system based on the weighted result and the anomaly category label corresponding to the query sequence.
[0033] The above steps are expanded as follows:
[0034] First, in step S210, a plurality of historical sequences (denoted as n) and N typical sequences selected therefrom are obtained, each historical sequence including corresponding L indicator values arranged in chronological order.
[0035] The indicator values in the above n historical sequences involve one or more specific indicators. For example, in the website maintenance scenario, the specific indicator may be the number of visits, the number of complaints, or the number of new user registrations, etc.; in the instrument performance maintenance scenario, the specific indicator may be temperature, humidity, viscosity, power consumption, or pressure, etc.; in the financial transaction maintenance scenario, the characteristic indicator may be the number of transactions, transaction amount, number of orders created, or number of orders canceled, etc.
[0036] For obtaining the above n historical sequences, in one embodiment, n indicator values can be continuously collected at predetermined time intervals (for example, every 1 minute or every 5 minutes) for the above specific indicators to form a total historical sequence X = {x1, ..., x i ,...,x n}; Then, a sliding window mechanism can be used to slide and intercept a subsequence of length L as the historical sequence, or in other words, for any index value x among the n index values i , in the total historical sequence X, the index value x i Then, we trace back L index values to form the index value x i The corresponding historical sequence x i ={x i-L+1 ,...,x i It should be understood that the length L of the historical sequence is less than the length n of the total historical sequence X; and for the 1st to L-1st indicator values in the total historical sequence X, since the number of indicator values that can be traced back is less than L, the corresponding historical sequence can be obtained through padding in feature engineering. For example, the indicator value x L-1 The corresponding historical sequence is determined as x L-1 ={null,x1,...,x L-1}, where null is the default value used by the fill process.
[0037] In another embodiment, the indicator values collected in n historical periods may be obtained, and corresponding historical sequences may be formed based on L indicator values continuously collected in each historical period, thereby obtaining n historical sequences.
[0038] In this way, n historical sequences can be obtained. Further, N (<n=) historical sequences representing different sequence patterns can be selected as N typical sequences, denoted as {k1,...,k N In one embodiment, the n historical sequences may be clustered to obtain N cluster centers as the N typical sequences. Exemplarily, the clustering process may be implemented using a K-means clustering algorithm.
[0039] In another embodiment, N typical sequences can be selected in the following manner: first, a historical sequence is randomly selected from n historical sequences as the first typical sequence k1, then the similarity between the first typical sequence k1 and other n-1 historical sequences is calculated, and the similarity below a preset threshold (such as 0.4) is determined, and then a historical sequence is randomly selected from the historical sequences corresponding to the partial similarity as the second typical sequence k2, and so on, until the number of selected typical sequences reaches N.
[0040] From the above, n historical sequences can be obtained, and N typical sequences selected from them can be obtained. Based on this, in step S220, each of the above historical sequences is sequentially used as a query sequence (denoted as x i ), and determine the query sequence x i For the above N typical sequences {k1,...,k N} of N query weights {p1,...,p N}.
[0041] In one embodiment, the query sequence x is calculated i The N similarities between the query sequence x and the N typical sequences are calculated; based on the N similarities, the N query weights are determined. In a specific embodiment, the query sequence x can be calculated. i The embedding vector Φ X (x i ) and the typical sequence k i The embedding vector Φ K (k i ) as the similarity between the corresponding sequences. Exemplarily, the similarity between the embedded vectors can be calculated by calculating the dot product or the cosine similarity. On the other hand, in a specific embodiment, the above normalization process can be implemented by using a softmax function, or by calculating the proportion of a single similarity in the total similarity.
[0042] According to a specific example, calculate the query sequence x i The embedding vector Φ X (x i ) and the typical sequence k i The embedding vector Φ K (k i ) as the similarity, and the Softmax function is used to normalize the similarity. For example, the query sequence x can be calculated using the following formula (1): i For the typical sequence k i The assigned query weight p i .
[0043]
[0044] In another embodiment, the anomaly detection system further includes a query weight learning network. Accordingly, the query sequence x i With the typical sequence k i Input the query weight learning network to obtain the query weight p i In a specific embodiment, the query weight learning network may include fully connected layers and activation layers that are alternately arranged.
[0045] From the above, in step S220, the query sequence x can be determined. i For N typical sequences {k1,...,k N} of N query weights {p1,...,p N On the other hand, after the N typical sequences are obtained as described above, in step S230, for each typical sequence in the N typical sequences, anomaly detection can be performed on it respectively using M basic detection models in the anomaly detection system to obtain M detection results, and the M detection results are fused to obtain a fused detection result corresponding to the typical sequence.
[0046] It should be noted that the above-mentioned M basic detection models can include any existing algorithm model for anomaly detection, and M is an integer, usually greater than 1. For ease of understanding, a brief introduction to the existing anomaly detection algorithms is given. At present, anomaly detection algorithms can be roughly divided into three categories: statistical learning algorithms (Statistic based Method), algorithms based on traditional machine learning (Traditional Machine Learning based Methods) and algorithms based on deep learning (Deep Learning based Methods). Among them, statistical learning algorithms mainly include kernel density estimation (KDE) algorithm, exponentially weighted moving average (EWMA) algorithm, auto-regressive integrated moving average (ARIMA) algorithm, histogram-based outlier score (HBOS) algorithm, and spectral residual (SR) algorithm. Algorithms based on traditional machine learning mainly include the Isolation Forest (iForest) algorithm, One Class Support Vector Machine (OCSVM), K-nearest neighbors (K-NN) algorithm, and Principal Component Analysis (PCA) algorithm, etc. Algorithms based on deep learning mainly include the SRCNN algorithm that combines SR and Convolutional Neural Networks (CNN), in which the CNN network is used to learn the decision threshold, and the Variational Autoencoder (VAE) algorithm, etc.
[0047] Next, we determine any typical sequence k i The corresponding fusion detection result v i Take the example to illustrate the execution of this step. First, the typical sequence k i Input M basic detection models respectively In the output, M detection results are obtained It should be noted that the detection result output by the basic detection model can be a scalar, which indicates the typical sequence k iWhether there is an abnormal change trend, or it can also be an L-dimensional vector, in which the j-th vector element indicates whether the lower j-th index value in the input sequence is an abnormal index value.
[0048] Further, for the M test results Perform fusion processing to obtain the corresponding fusion detection result v i In one embodiment, the fusion process may include concatenation, summing, averaging, etc. For example, the fusion detection results It should be noted that the operator [,] is used in this paper to represent the concatenation of vectors, and the result of the concatenation is still a vector.
[0049] In another embodiment, a model weight learning network is introduced into the anomaly detection system to automatically learn M model weights (or second weights) corresponding to M basic detection models, so as to perform weighted processing on the above M detection results, thereby fully improving the fusion detection result v i accuracy and availability.
[0050] Figure 3 A schematic diagram of an implementation architecture for determining model weights according to an embodiment is shown, wherein the schematic diagram mainly shows how to determine any basic detection model. The corresponding model weight q j The implementation process, such as Figure 3 As shown, using the basic detection model For N typical sequences {k1,...,k N} are processed separately to obtain N detection results Input these N detection results into the model weight learning network to obtain the corresponding model weight q j .
[0051] Further, in a specific embodiment, Figure 4 A schematic diagram of the structure of a model weight learning network according to an example is shown, wherein the model weight learning network includes a pooling layer 41, a first fully connected layer 42, an activation layer 43, a second fully connected layer 44 and a weight prediction layer 45. Output test results In the case of an L-dimensional vector, first, in the pooling layer 41, the N detection results corresponding to the N L-dimensional vectors are pooled respectively to obtain an N-dimensional vector. For example, the pooling process can be a maximum pooling process, and the corresponding requirement is to take the maximum vector element in each L-dimensional vector, or a global average pooling process (Global average pooling, referred to as GAP) can also be used, and the corresponding requirement is to take the average value of L vector elements in each L-dimensional vector; then, in the first fully connected layer 42, the N-dimensional vector is reduced in dimension using the first parameter matrix in the layer to obtain an N / r-dimensional vector, for example, N=180, r=9; then, in the activation layer 43, the N / r-dimensional vector obtained by the dimensionality reduction process is activated, and the activation function in the activation layer 43 can be a relu function or a tanh function, etc.; then, in the second fully connected layer 45, the N / r-dimensional vector output by the activation layer 43 is reduced in dimension to a scalar value using the second parameter matrix in the layer; then, in the weight prediction layer 46, the sigmoid function is used to process the scalar value to obtain the basic detection model The corresponding model weight q j .
[0052] In another specific embodiment, the model weight learning network may include several groups of alternately arranged fully connected layers and activation layers, and the last activation layer outputs a signal for the basic detection model. The model score g j ,Afterwards, the M models corresponding to the M basic detection models are normalized to obtain the model weights of each basic detection model.
[0053] In this way, M basic detection models can be automatically learned The corresponding M model weights {q1,...,q M}. Further, use these M model weights to classify the above typical sequence k i M test results Perform weighted processing to obtain M weighted items So as to determine the fusion detection result v i .
[0054] In a specific embodiment, the fusion detection result v can be determined by concatenating the M weighted items. i ,at this time, In another specific embodiment, the M weighted items may be summed. In this case,
[0055] Therefore, the M model weights corresponding to the M basic detection models can be automatically learned through the model weight learning network, so as to determine the typical sequence k by weighted processing using the M model weights. iThe corresponding fusion detection result v i .
[0056] From the above, we can determine N typical sequences {k1,...,k N} corresponding to the N fusion detection results {v1,...,v N Then, in step S240, the N query weights {p1, ..., p N} for the N fusion detection results {v1,...,v N} are weighted and N weighted items {p1v1,...,p N v N}, and then determine the query sequence x i The corresponding weighted result o.
[0057] In one embodiment, the weighted result o can be obtained by summing N weighted items. In this case, In another embodiment, the weighted result o can be obtained by concatenating N weighted items. In this case, o=[p1v1,...,p N v N ].
[0058] After the weighted result o is determined above, in step S250, based on the weighted result o and the query sequence x i The abnormal category label y i , update the above anomaly detection system. It should be noted that, in one embodiment, the anomaly category label y i Indicates the query sequence x i Whether there is an abnormal change trend; in another embodiment, the abnormal category label y i Indicates the query sequence x i Whether one or more indicator values in are outliers, for example, each indicator value or the last indicator value.
[0059] In this step, based on the above weighted result o, the query sequence x is determined i Anomaly detection results Based on the abnormal detection results and the abnormal category label y i , update the anomaly detection system.
[0060] In one embodiment, the anomaly detection system further includes an output layer, which includes a plurality of fully connected sublayers connected in sequence, and a softmax sublayer or a sigmoid sublayer. Accordingly, in each fully connected sublayer, the input is linearly transformed using the parameter matrix contained therein, and in the softmax sublayer or the sigmoid sublayer, the linear transformation result output by the last fully connected sublayer is processed using the softmax function or the sigmoid function to obtain an anomaly detection result.
[0061] Furthermore, in a specific embodiment, the weighted result o can be directly used as the input of the output layer. In another specific embodiment, considering that the query sequence x may be lost in the weighted result o i The useful low-level information contained in , thus, the query sequence x can be spliced based on the weighted result o i The embedding vector Φ x (x i ), so that the concatenation vector As the input of the above output layer.
[0062] According to an example, the query sequence x i It is obtained by sliding the window based on the above historical total sequence X, and the abnormal category label y i Indicates the query sequence x i ={x i-L+1 ,...,x i} i Is it an outlier? Further, in this step, the concatenated vector is concatenated using the parameter matrix in the output layer. Perform a linear transformation and use the softmax function to process the result of the linear transformation to obtain the query sequence x i The index value x i The predicted probability of being an outlier as an outlier detection result
[0063] In another embodiment, the abnormality detection result can be determined directly based on the weighted result o For example, the fusion detection results Weighted results Accordingly, the weighted result o can be directly used as the anomaly detection result The L vector elements contained therein correspond to the query sequence x i The L indicator values in are the probabilities of abnormal points, or the last vector element in the weighted result o can be used as the abnormality detection result. It indicates the query sequence x i The last indicator value in is the probability of an outlier.
[0064] The anomaly detection results are obtained above After that, we can combine the abnormal category label y i The training loss is determined, and then based on the training loss, the model parameters in the anomaly detection system are updated using the back propagation method. In one example, the training loss can be calculated using a cross entropy loss function, and the calculation formula is as follows:
[0065]
[0066] In the above formula (2), T represents the number of query sequences in a batch.
[0067] The above can realize the training and updating of the anomaly detection system. Through multiple rounds of iterative updates, a trained anomaly detection system can be obtained to obtain anomaly detection results with high accuracy and high availability. It should be noted that in the process of using the anomaly detection system, the above N typical sequences remain unchanged. It is only necessary to input the newly collected indicator sequence (as the query sequence) into the anomaly detection system to obtain the anomaly detection results for the indicator sequence.
[0068] In summary, the embodiments of this specification propose a newly designed anomaly detection system with extremely strong versatility, which can arbitrarily add or delete basic models. Using this anomaly detection system, the query weights of different typical sequences (corresponding to different sequence patterns) can be automatically determined for the query sequence. Furthermore, the model weights of different basic models can also be automatically learned, thereby realizing end-to-end training and updating of the anomaly detection system. Therefore, the trained anomaly detection system can be used to effectively integrate the anomaly detection results of multiple basic models, thereby realizing more accurate anomaly detection.
[0069] Corresponding to the above-mentioned updating method, the embodiment of this specification also discloses an updating device. Figure 5 FIG. 1 is a schematic diagram showing the structure of an updating device of an abnormality detection system according to an embodiment, and the device can be integrated into any server or device cluster with computing and processing capabilities. Figure 5 As shown, the device 500 includes the following components:
[0070] The sequence acquisition unit 510 is configured to acquire multiple historical sequences and N typical sequences selected therefrom, each historical sequence including corresponding L indicator values arranged in chronological order; the query weight determination unit 520 is configured to use the respective historical sequences as query sequences in turn, and determine N query weights of the query sequence for the N typical sequences; the fusion result determination unit 530 is configured to perform anomaly detection on each typical sequence in the N typical sequences using the M basic detection models respectively, obtain M detection results, and fuse the M detection results to obtain a fusion detection result corresponding to the typical sequence; the weighted result determination unit 540 is configured to perform weighted processing on the N fusion detection results corresponding to the N typical sequences using the N query weights, and obtain a weighted result corresponding to the query sequence; the parameter updating unit 550 is configured to update the anomaly detection system based on the weighted result and the anomaly category label corresponding to the query sequence.
[0071] In one embodiment, the sequence acquisition unit 510 is specifically configured to: acquire multiple indicator values continuously collected for a specific indicator at a predetermined time interval to form a total historical sequence; for each indicator value among the multiple indicator values, trace back L indicator values from the indicator value in the total historical sequence to form a historical sequence corresponding to the indicator value.
[0072] In a specific embodiment, the device 500 also includes: a label determination unit 560, configured to obtain multiple exception category labels corresponding to the multiple indicator values; after forming the historical sequence corresponding to the indicator value, the exception category label corresponding to the indicator value is used as the exception category label corresponding to the historical sequence.
[0073] In one embodiment, the sequence acquisition unit 510 is specifically configured to: acquire the multiple historical sequences; and perform clustering processing on the multiple historical sequences to obtain N cluster centers as the N typical sequences.
[0074] In one embodiment, the query weight determination unit 520 includes: a similarity calculation subunit 521, configured to calculate N similarities between the query sequence and the N typical sequences; and a weight determination subunit 522, configured to determine the N query weights based on the N similarities.
[0075] Further, in a specific embodiment, the similarity calculation subunit 521 is specifically configured to: calculate the dot product between the embedding vector corresponding to the query sequence and the embedding vector corresponding to each typical sequence as the corresponding similarity.
[0076] In a specific embodiment, the weight determination subunit 522 is specifically configured to: perform normalization processing on the N similarities to obtain the N query weights.
[0077] In one embodiment, the anomaly detection system also includes a model weight learning network; the fusion result determination unit 530 includes: a model weight determination subunit 531, configured to input the N detection results of each basic detection model in the M basic detection models for the N typical sequences into the model weight learning network to obtain its corresponding model weight; a result fusion subunit 532, configured to use the M model weights corresponding to the M basic detection models to perform weighted processing on the M detection results to obtain the fused detection result.
[0078] In a specific embodiment, the detection results output by each basic detection model are L-dimensional vectors, wherein each vector element indicates whether the corresponding indicator value in the input sequence is an outlier; the model weight learning network includes a pooling layer, a first fully connected layer, an activation layer, a second fully connected layer and a weight prediction layer; the model weight determination subunit 531 is specifically configured as follows: in the pooling layer, the N L-dimensional vectors corresponding to the N detection results are respectively pooled to obtain N-dimensional vectors; in the first fully connected layer, the N-dimensional vector is reduced in dimension using the first parameter matrix; in the activation layer, the vector after the reduced dimension processing is activated; in the second fully connected layer, the vector obtained by the activation processing is reduced in dimension to a scalar value using the second parameter matrix; in the weight prediction layer, the scalar value is processed using the sigmoid function to obtain the second weight.
[0079] In a specific embodiment, the result fusion subunit 532 is specifically configured as follows: using the M model weights to perform weighted processing on the M detection results to obtain M weighted items; and splicing the M weighted items to obtain the fused detection result.
[0080] In one embodiment, the anomaly detection system also includes an output layer; the parameter updating unit 550 is specifically configured as follows: in the output layer, the weighted result is linearly transformed using the parameter matrix therein, and the result of the linear transformation is processed using a softmax function, so as to obtain an anomaly detection result corresponding to the query history sequence; based on the anomaly detection result and the anomaly category label, the model parameters in the anomaly detection system are updated.
[0081] According to another embodiment, there is also provided a computer-readable storage medium having a computer program stored thereon, which, when executed in a computer, causes the computer to execute a combination of Figure 2 The method described.
[0082] According to another embodiment of the present invention, a computing device is provided, including a memory and a processor, wherein an executable code is stored in the memory, and when the processor executes the executable code, the Figure 2 The method described.
[0083] Those skilled in the art should be aware that in one or more of the above examples, the functions described in the present invention can be implemented by hardware, software, firmware or any combination thereof. When implemented by software, these functions can be stored in a computer-readable medium or transmitted as one or more instructions or codes on a computer-readable medium.
[0084] The specific implementation methods described above further illustrate the objectives, technical solutions and beneficial effects of the present invention in detail. It should be understood that the above description is only a specific implementation method of the present invention and is not intended to limit the scope of protection of the present invention. Any modifications, equivalent substitutions, improvements, etc. made on the basis of the technical solution of the present invention should be included in the scope of protection of the present invention.
Claims
1. A method for updating an anomaly detection system, wherein the anomaly detection system includes M basic detection models. include: Acquire multiple historical sequences and N typical sequences selected therefrom, each historical sequence including L indicator values collected from the target system to be maintained for a specific indicator and arranged in chronological order; when the target system is a website system, the specific indicator is one of the number of visits, the number of complaints, and the number of new user registrations; when the target system is an instrument system, the specific indicator is one of temperature, humidity, viscosity, power consumption, and pressure; when the target system is a trading system, the specific indicator is one of the number of transactions, the transaction amount, the number of created orders, and the number of canceled orders; Taking any historical sequence as a query sequence, and determining N query weights of the query sequence for the N typical sequences according to N similarities between the query sequence and the N typical sequences; For each typical sequence of the N typical sequences, use the M basic detection models to perform anomaly detection on it respectively to obtain M detection results, and fuse the M detection results to obtain a fusion detection result corresponding to the typical sequence; Using the N query weights, weighted processing is performed on the N fusion detection results corresponding to the N typical sequences to obtain a weighted result corresponding to the query sequence; Based on the weighted result and the abnormal category label corresponding to the query sequence, the abnormality detection system is updated, and the abnormality detection system is used to detect the abnormality of the target system.
2. The method according to claim 1, in, Obtaining multiple historical sequences includes: Acquire multiple indicator values collected continuously for a specific indicator at predetermined time intervals to form a total historical sequence; For each indicator value among the multiple indicator values, L indicator values are traced back from the indicator value in the total historical sequence, so as to form a historical sequence corresponding to the indicator value.
3. The method according to claim 2, in, Before updating the anomaly detection system based on the weighted result and the anomaly category label corresponding to the query sequence, the method further includes: Obtain multiple abnormal category labels corresponding to the multiple indicator values; After the historical sequence corresponding to the indicator value is formed, the abnormal category label corresponding to the indicator value is used as the abnormal category label corresponding to the historical sequence.
4. The method according to claim 1 or 2, in, Get multiple historical sequences and select N typical sequences from them, including: Acquire the multiple historical sequences; The multiple historical sequences are clustered to obtain N cluster centers as the N typical sequences.
5. The method according to claim 1, in, Determining N query weights of the query sequence for the N typical sequences includes: Calculating N similarities between the query sequence and the N typical sequences; Based on the N similarities, the N query weights are determined.
6. The method according to claim 5, in, Calculating N similarities between the query sequence and the N typical sequences, comprising: The dot product between the embedding vector corresponding to the query sequence and the embedding vector corresponding to each typical sequence is calculated as the corresponding similarity.
7. The method according to claim 5, in, Determining the N query weights based on the N similarities includes: The N similarities are normalized to obtain the N query weights.
8. The method according to claim 1, in, The anomaly detection system also includes a model weight learning network; wherein the M detection results are fused to obtain a fused detection result corresponding to the typical sequence, including: For each basic detection model in the M basic detection models, inputting its N detection results for the N typical sequences into the model weight learning network to obtain its corresponding model weight; The M detection results are weighted by using the M model weights corresponding to the M basic detection models to obtain the fused detection result.
9. The method according to claim 8, in, The detection results output by each basic detection model are L-dimensional vectors, wherein each vector element indicates whether the corresponding indicator value in the input sequence is an abnormal value; the model weight learning network includes a pooling layer, a first fully connected layer, an activation layer, a second fully connected layer and a weight prediction layer; Among them, for each basic detection model in the M basic detection models, inputting its N detection results for the N typical sequences into the model weight learning network to obtain its corresponding model weight, including: In the pooling layer, the N L-dimensional vectors corresponding to the N detection results are respectively pooled to obtain N-dimensional vectors; In the first fully connected layer, a first parameter matrix is used to perform dimensionality reduction processing on the N-dimensional vector; In the activation layer, activation processing is performed on the vector after the dimension reduction processing; In the second fully connected layer, the vector obtained by the activation processing is reduced to a scalar value using a second parameter matrix; In the weight prediction layer, the scalar value is processed using a sigmoid function to obtain the model weight.
10. The method according to claim 8, in, The M detection results are weighted by using the M model weights corresponding to the M basic detection models to obtain the fusion detection result, including: Performing weighted processing on the M detection results using the M model weights to obtain M weighted items; The M weighted items are concatenated to obtain the fusion detection result.
11. The method according to claim 1, in, The anomaly detection system further includes an output layer; wherein, based on the weighted result and the anomaly category label corresponding to the query sequence, updating the anomaly detection system includes: In the output layer, the weighted result is linearly transformed using the parameter matrix therein, and the result of the linear transformation is processed using a softmax function, so as to obtain an anomaly detection result corresponding to the query history sequence; Based on the anomaly detection results and anomaly category labels, model parameters in the anomaly detection system are updated.
12. An updating device for an anomaly detection system, the anomaly detection system comprising M basic detection models, the device include: a sequence acquisition unit configured to acquire a plurality of historical sequences and N typical sequences selected therefrom, each historical sequence comprising L indicator values collected from a target system to be maintained for a specific indicator and arranged in chronological order; when the target system is a website system, the specific indicator is one of the number of visits, the number of complaints, and the number of new user registrations; when the target system is an instrument system, the specific indicator is one of temperature, humidity, viscosity, power consumption, and pressure; when the target system is a trading system, the specific indicator is one of the number of transactions, the transaction amount, the number of created orders, and the number of canceled orders; a query weight determination unit configured to use any historical sequence as a query sequence, and determine N query weights of the query sequence for the N typical sequences according to N similarities between the query sequence and the N typical sequences; a fusion result determination unit configured to perform anomaly detection on each typical sequence of the N typical sequences using the M basic detection models to obtain M detection results, and to fuse the M detection results to obtain a fusion detection result corresponding to the typical sequence; a weighted result determination unit, configured to perform weighted processing on the N fusion detection results corresponding to the N typical sequences using the N query weights to obtain a weighted result corresponding to the query sequence; A parameter updating unit is configured to update the anomaly detection system based on the weighted result and the anomaly category label corresponding to the query sequence, wherein the anomaly detection system is used to detect anomalies of the target system.
13. The device according to claim 12, in, The sequence acquisition unit is specifically configured as follows: Acquire multiple indicator values collected continuously for a specific indicator at predetermined time intervals to form a total historical sequence; For each indicator value among the multiple indicator values, L indicator values are traced back from the indicator value in the total historical sequence, so as to form a historical sequence corresponding to the indicator value.
14. The device according to claim 13, in, The device also includes: The label determination unit is configured to obtain multiple abnormal category labels corresponding to the multiple indicator values; after forming the historical sequence corresponding to the indicator value, the abnormal category label corresponding to the indicator value is used as the abnormal category label corresponding to the historical sequence.
15. The device according to claim 12 or 14, in, The sequence acquisition unit is specifically configured as follows: Acquire the multiple historical sequences; The multiple historical sequences are clustered to obtain N cluster centers as the N typical sequences.
16. The device according to claim 12, in, The query weight determination unit comprises: a similarity calculation subunit, configured to calculate N similarities between the query sequence and the N typical sequences; The weight determination subunit is configured to determine the N query weights based on the N similarities.
17. The device according to claim 16, in, The similarity calculation subunit is specifically configured as follows: The dot product between the embedding vector corresponding to the query sequence and the embedding vector corresponding to each typical sequence is calculated as the corresponding similarity.
18. The device according to claim 16, in, The weight determination subunit is specifically configured as follows: The N similarities are normalized to obtain the N query weights.
19. The device according to claim 12, in, The anomaly detection system also includes a model weight learning network; The fusion result determination unit comprises: A model weight determination subunit is configured to input, for each basic detection model in the M basic detection models, its N detection results for the N typical sequences into the model weight learning network to obtain its corresponding model weight; The result fusion subunit is configured to use the M model weights corresponding to the M basic detection models to perform weighted processing on the M detection results to obtain the fused detection result.
20. The device according to claim 19, in, The detection results output by each basic detection model are L-dimensional vectors, wherein each vector element indicates whether the corresponding indicator value in the input sequence is an abnormal value; the model weight learning network includes a pooling layer, a first fully connected layer, an activation layer, a second fully connected layer and a weight prediction layer; The model weight determination subunit is specifically configured as follows: In the pooling layer, the N L-dimensional vectors corresponding to the N detection results are respectively pooled to obtain N-dimensional vectors; In the first fully connected layer, a first parameter matrix is used to perform dimensionality reduction processing on the N-dimensional vector; In the activation layer, activation processing is performed on the vector after the dimension reduction processing; In the second fully connected layer, the vector obtained by the activation processing is reduced to a scalar value using a second parameter matrix; In the weight prediction layer, the scalar value is processed using a sigmoid function to obtain the model weight.
21. The device according to claim 19, in, The result fusion subunit is specifically configured as follows: Performing weighted processing on the M detection results using the M model weights to obtain M weighted items; The M weighted items are concatenated to obtain the fusion detection result.
22. The device according to claim 12, in, The anomaly detection system also includes an output layer; the parameter updating unit is specifically configured as follows: In the output layer, the weighted result is linearly transformed using the parameter matrix therein, and the result of the linear transformation is processed using a softmax function, so as to obtain an anomaly detection result corresponding to the query history sequence; Based on the anomaly detection results and anomaly category labels, model parameters in the anomaly detection system are updated.
23. A computer-readable storage medium having a computer program stored thereon, in, When the computer program is executed in a computer, the computer is caused to execute the method according to any one of claims 1 to 11.
24. A computing device comprising a memory and a processor, in, The memory stores executable codes, and when the processor executes the executable codes, the method according to any one of claims 1 to 11 is implemented.
