Methods, devices and electronic equipment for anomaly detection of time series data

By obtaining the characteristic sequence of time series data and analyzing its directivity and co-occurrence, a directed weighted graph is generated for anomaly detection, which solves the problem that traditional methods are difficult to deal with anomaly detection of time series operation and maintenance data, and achieves efficient and explainable anomaly detection. Effect.

CN113986674BActive Publication Date: 2024-08-23CCB FINTECH CO LTD
View PDF 0 Cites 0 Cited by

Patent Information

Application Number
CN202111279566.9
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2021-10-28
Publication Date
2024-08-23
Estimated Expiration
2041-10-28

AI Technical Summary

Technical Problem

Traditional operation and maintenance tools and methods are difficult to meet the needs for efficient emergency response of large amounts of operation and maintenance data. Especially in the context of complex cloud computing, big data and artificial intelligence technologies, time-series operation and maintenance data is growing exponentially, making it difficult to process through traditional methods. Effective anomaly detection.

Method used

By obtaining multiple feature sequences of time series data, analyzing their directivity and co-occurrence, generating a directed weighted graph, using the graph generation module to detect anomalies in the time series data, the direction and co-occurrence probability of nodes and connections represent abnormal points, Improve the interpretability and efficiency of anomaly detection.

Benefits of technology

It achieves efficient anomaly detection of time series data, improves the emergency response capabilities of operation and maintenance personnel, and enhances the interpretability and accuracy of detection through dynamic time-aware shapelets and graph embedding algorithms to adapt to complex operation and maintenance scenarios.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN113986674B
    Figure CN113986674B
Patent Text Reader

Abstract

The present disclosure provides a method for detecting anomalies in time series data, an apparatus for detecting anomalies in time series data, and an electronic device, the method comprising: in response to acquired time series data, obtaining multiple feature sequences for the time series data, and the directionality and co-occurrence between the multiple feature sequences; classifying the time series data segments excluding the feature sequences in the time series data into time series segment sets represented by at least part of the feature sequences in the multiple feature sequences, respectively, to obtain multiple candidate time series segment sets; determining the directionality and co-occurrence probability between the multiple candidate time series segment sets based on the directionality and co-occurrence between the multiple feature sequences; and generating a directed weighted graph for the multiple candidate time series segment sets, so as to perform anomaly detection on the time series data based on the directed weighted graph, wherein the nodes of the directed weighted graph represent the candidate time series segment sets, and the directed lines of the directed weighted graph represent the directionality and co-occurrence probability between two nodes connected to the directed lines.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present disclosure relates to the fields of artificial intelligence technology and finance, and more specifically, to a method for detecting anomalies in time series data, an apparatus for detecting anomalies in time series data, and an electronic device. Background Art

[0002] With the continuous development of technologies such as cloud computing, big data, and artificial intelligence, the Internet Technology (IT) infrastructure is becoming increasingly complex. The time series operation and maintenance data generated by the business plays a very important role in the process of operation and maintenance personnel locating system anomalies and problems.

[0003] However, with the complexity of application scenarios and the emergence of new technologies, time-series operation and maintenance data is growing exponentially, and it is difficult to meet the needs of efficient emergency response through traditional operation and maintenance tools and methods. Summary of the invention

[0004] In view of this, the present disclosure provides a method for detecting anomalies in time series data, a device for detecting anomalies in time series data, and an electronic device, so as to at least partially solve the problem that traditional operation and maintenance tools and methods are difficult to meet the needs of efficient emergency response for large amounts of operation and maintenance data.

[0005] One aspect of the present disclosure provides a method for detecting anomalies in time series data, including: in response to acquired time series data, obtaining multiple feature sequences for the time series data, and directionality and co-occurrence between the multiple feature sequences; classifying the time series data segments excluding the feature sequences in the time series data into time series segment sets represented by at least part of the feature sequences in the multiple feature sequences, respectively, to obtain multiple candidate time series segment sets; and generating a directed weighted graph for the multiple candidate time series segment sets, so as to perform anomaly detection on the time series data based on the directed weighted graph, wherein the nodes of the directed weighted graph represent the candidate time series segment sets, and the directed lines of the directed weighted graph represent the directionality and co-occurrence probability between two nodes connected to the directed lines.

[0006] In some embodiments, obtaining multiple feature sequences for time series data, as well as directionality and co-occurrence between multiple feature sequences includes: using a trained feature sequence acquisition model to process the time series data to obtain multiple feature sequences for the time series data, as well as directionality and co-occurrence between multiple feature sequences; wherein the objective function of the feature sequence acquisition model includes: the difference between positive samples and negative samples, the co-occurrence probability, the co-occurrence probability weight, the penalty term and the penalty term coefficient.

[0007] In some embodiments, the training process of the feature sequence acquisition model includes: using the trained feature sequence acquisition model to process historical time series data, and adjusting the values ​​of at least the co-occurrence probability and the penalty term so that the objective function reaches a maximum value or a minimum value; wherein the historical time series data includes time series data segments marked as feature sequences, and when the objective function reaches a maximum value or a minimum value, the time series data segments output by the feature sequence acquisition model approach the time series data segments marked as feature sequences.

[0008] In some embodiments, the above method further includes: after obtaining multiple feature sequences for the time series data, selecting a specified number of feature sequences from the multiple feature sequences to obtain a specified number of candidate time series segment sets.

[0009] In some embodiments, obtaining multiple feature sequences for time series data includes: obtaining a specified number of time series data segments closest to the time series data from multiple time series data segments included in the time series data by clustering as multiple feature sequences.

[0010] In some embodiments, obtaining a specified number of time series data segments closest to the time series data from multiple time series data segments included in the time series data by clustering includes: obtaining each time series data segment with a specified length included in the time series data to obtain a time series data segment set; obtaining a data segment vector of each time series data segment and a set vector of the time series data segment set; and taking the time series data segments corresponding to the specified number of data segment vectors with the highest similarity to the set vector as the specified number of time series data segments closest to the time series data.

[0011] In some embodiments, time series data segments excluding feature sequences in the time series data are classified into time series segment sets represented by at least part of the feature sequences in multiple feature sequences, and multiple candidate time series segment sets are obtained, including: for each of at least part of the time series data segments excluding the feature sequences in the time series data, obtaining the distances between the time series data segments relative to each of the multiple feature sequences; and classifying the time series data segments into time series segment sets corresponding to target feature sequences; wherein the target feature sequence is the feature sequence corresponding to the smallest distance among the multiple feature sequences, or the target feature sequence is the feature sequence corresponding to the distance less than a set threshold among the multiple feature sequences.

[0012] In some embodiments, determining the directionality and co-occurrence probability between multiple candidate time series segment sets based on the directionality and co-occurrence between multiple feature sequences includes: determining a feature sequence probability group of the probability that each feature sequence is assigned to each candidate time series segment; determining a probability weighted value of each feature sequence for the same time series data segment based on the feature sequence probability group; and determining a normalized co-occurrence probability between multiple candidate time series segment sets based on the probability weighted value of each feature sequence for the same time series data segment.

[0013] One aspect of the present disclosure provides an abnormality detection device for time series data, including: a feature sequence acquisition module, a classification module, a co-occurrence probability determination module and a graph generation module. Among them, the feature sequence acquisition module is used to respond to the acquired time series data to obtain multiple feature sequences for the time series data, as well as the directionality and co-occurrence between the multiple feature sequences; the classification module is used to classify the time series data segments excluding the feature sequences in the time series data into time series segment sets represented by at least part of the feature sequences in the multiple feature sequences, respectively, to obtain multiple candidate time series segment sets; the co-occurrence probability determination module is used to determine the directionality and co-occurrence probability between multiple candidate time series segment sets based on the directionality and co-occurrence between the multiple feature sequences; and the graph generation module is used to generate a directed weighted graph for multiple candidate time series segment sets, so as to perform abnormality detection on the time series data based on the directed weighted graph, the nodes of the directed weighted graph represent the candidate time series segment sets, and the directed lines of the directed weighted graph represent the directionality and co-occurrence probability between two nodes connected to the directed lines.

[0014] In some embodiments, the feature sequence acquisition module includes: a first feature sequence acquisition unit, and / or a second feature sequence acquisition unit. The first feature sequence acquisition unit is used to process the time series data using the trained feature sequence acquisition model to obtain multiple feature sequences for the time series data, as well as the directionality and co-occurrence between the multiple feature sequences; the objective function of the feature sequence acquisition model includes: the difference between positive samples and negative samples, the co-occurrence probability, the co-occurrence probability weight, the penalty term and the penalty term coefficient; the second feature sequence acquisition unit is used to obtain a specified number of time series data segments closest to the time series data from the multiple time series data segments included in the time series data by clustering, as multiple feature sequences.

[0015] In some embodiments, the above-mentioned device also includes: a model training module, which is used to use the trained feature sequence acquisition model to process historical time series data, and make the objective function reach a maximum value or a minimum value by at least adjusting the values ​​of the co-occurrence probability and the penalty term; wherein, the historical time series data includes time series data segments marked as feature sequences, and when the objective function reaches a maximum value or a minimum value, the time series data segments output by the feature sequence acquisition model approach the time series data segments marked as feature sequences.

[0016] Another aspect of the present disclosure provides an electronic device, including one or more processors and a storage device, wherein the storage device is used to store executable instructions, and when the executable instructions are executed by the processor, the above-mentioned method for detecting anomalies in time series data is implemented.

[0017] Another aspect of the present disclosure provides a computer-readable storage medium storing computer-executable instructions, which are used to implement the above-mentioned method for detecting anomalies in time series data when executed.

[0018] Another aspect of the present disclosure provides a computer program, which includes computer executable instructions, and the instructions are used to implement the above-mentioned method for detecting anomalies in time series data when executed. BRIEF DESCRIPTION OF THE DRAWINGS

[0019] The above and other objects, features and advantages of the present disclosure will become more apparent through the following description of the embodiments of the present disclosure with reference to the accompanying drawings, in which:

[0020] Figure 1 A schematic diagram of an application scenario of an anomaly detection method for time series data, an anomaly detection device for time series data, and an electronic device according to an embodiment of the present disclosure is schematically shown;

[0021] Figure 2 Schematically illustrates an exemplary system architecture to which a method for detecting anomalies in time series data and an apparatus for detecting anomalies in time series data according to an embodiment of the present disclosure can be applied;

[0022] Figure 3 A flowchart of a method for detecting anomalies in time series data according to an embodiment of the present disclosure is schematically shown;

[0023] Figure 4 A flowchart of a method for acquiring a feature sequence according to an embodiment of the present disclosure is schematically shown;

[0024] Figure 5 A flowchart of a method for model training according to an embodiment of the present disclosure is schematically shown;

[0025] Figure 6 A flowchart of a method for acquiring a feature sequence according to another embodiment of the present disclosure is schematically shown;

[0026] Figure 7 A block diagram of an abnormality detection device for time series data according to an embodiment of the present disclosure is schematically shown;

[0027] Figure 8 A block diagram schematically shows an apparatus for detecting abnormality in time series data according to another embodiment of the present disclosure; and

[0028] Fig. 9 A block diagram of an electronic device according to an embodiment of the present disclosure is schematically shown. DETAILED DESCRIPTION

[0029] Hereinafter, embodiments of the present disclosure will be described with reference to the accompanying drawings. However, it should be understood that these descriptions are exemplary only and are not intended to limit the scope of the present disclosure. In the following detailed description, for ease of explanation, many specific details are set forth to provide a comprehensive understanding of the embodiments of the present disclosure. However, it is apparent that one or more embodiments may also be implemented without these specific details. In addition, in the following description, descriptions of known structures and technologies are omitted to avoid unnecessary confusion of the concepts of the present disclosure.

[0030] The terms used herein are only for describing specific embodiments and are not intended to limit the present disclosure. The terms "comprise", "include", etc. used herein indicate the existence of features, steps, operations and / or components, but do not exclude the existence or addition of one or more other features, steps, operations or components.

[0031] All terms (including technical and scientific terms) used herein have the meanings commonly understood by those skilled in the art, unless otherwise defined. It should be noted that the terms used herein should be interpreted as having a meaning consistent with the context of this specification, and should not be interpreted in an idealized or overly rigid manner.

[0032] When using expressions such as "at least one of A, B or C", they should generally be interpreted according to the meaning of the expression commonly understood by technical personnel in this field (for example, "a system having at least one of A, B or C" should include but is not limited to a system having A alone, B alone, C alone, A and B, A and C, B and C, and / or A, B, C, etc.).

[0033] With the emergence and development of technologies such as cloud computing, big data, and artificial intelligence, IT infrastructure is becoming increasingly complex. The time series operation and maintenance data generated by the business plays a very important role in the location of system anomalies and problems for operation and maintenance engineers. However, due to the complexity of application scenarios and the emergence of new technologies, time series operation and maintenance data has shown an exponential growth, and it is difficult to meet the needs of efficient emergency response through traditional operation and maintenance tools and methods. In order to solve the above problems, time series data can be modeled and analyzed to locate abnormal data points, reduce the dimensionality of data, and help operation and maintenance personnel make decisions.

[0034] Since most of the interpretable time series modeling is discrete time series, the time series can be segmented on the time axis, and then the representation that can be used to judge abnormalities can be found from the segments. For example, the algorithm model can use wavelets (shapelets) to find special feature segment waves for time series classification, thereby performing explanatory reasoning.

[0035] In order to facilitate understanding of the technical solutions of the embodiments of the present disclosure, some terms are first explained.

[0036] Shapelet is a time series data with identifiable category features, which can accurately classify the time series by identifying local features.

[0037] The purpose of time series modeling is to discover relationships in time-ordered data. The key issue is how to extract key features from a time series. Some frameworks in related technologies range from classic feature engineering and representation learning to models based on deep learning. Although some methods have achieved good results, they lack interpretability.

[0038] After analysis, it is found that shapelets are usually regarded as static in related technologies, but in reality, shapelets are dynamic. First of all, the same shapelet appearing in different time slices may have a series of different effects. For example, the reasons for a significant increase in power consumption during peak access periods and a significant increase in power consumption during low access periods may be completely different. That is, an important clue is how shapelets develop over time. In the embodiments of the present disclosure, a subsequence in a time series that can reflect its representativeness in different time slices is called a time-aware shapelet.

[0039] The anomaly detection method for time series data provided by the embodiment of the present disclosure includes a time series data segment classification process and a directed weighted graph generation process. Among them, the time series data segment classification process includes: first, in response to the obtained time series data, multiple feature sequences for the time series data, and the directionality and co-occurrence between the multiple feature sequences are obtained. Then, the time series data segments excluding the feature sequences in the time series data are respectively classified into time series segment sets represented by at least part of the feature sequences in the multiple feature sequences, and multiple candidate time series segment sets are obtained. After executing the time series data segment classification process, the directed weighted graph generation process is entered to generate a directed weighted graph for multiple candidate time series segment sets, so as to perform anomaly detection on the time series data based on the directed weighted graph, the nodes of the directed weighted graph represent the candidate time series segment sets, and the directed lines of the directed weighted graph represent the directionality and co-occurrence probability between the two nodes connected to the directed lines.

[0040] In the disclosed embodiment, multiple feature sequences are extracted from the time series data, and these feature sequences can better characterize the time series data. In various scenarios, there will be different feature sequences, as well as the directionality and co-occurrence between feature sequences. Since the directed weighted graph includes the directionality and co-occurrence probability between multiple sets of time series data segments, the anomaly can be explained based on the directionality and co-occurrence probability, which improves the interpretability of the abnormal time series data.

[0041] In the technical solution disclosed in the present invention, the acquisition, storage and application of the time series data involved all comply with the provisions of relevant laws and regulations, take necessary confidentiality measures, and do not violate public order and good morals.

[0042] Figure 1 A schematic diagram of application scenarios of an anomaly detection method for time series data, an anomaly detection device for time series data, and an electronic device according to an embodiment of the present disclosure is schematically shown.

[0043] like Figure 1 As shown in the figure, there are two sets of time series data about operation and maintenance. One set of time series data has time series feature 1 and time series feature 2 relative to the other set of time series data. Through analysis, it can be predicted that time series feature 1 corresponds to the time series feature during the peak promotion period. Time series feature 2 corresponds to the time series feature during CPU abnormality. There is a clear directionality and high co-occurrence between time series feature 1 and time series feature 2. Based on this, it can be analyzed that the number of visits during the peak promotion period is high, resulting in a high CPU load, which is prone to being unable to cope with the subsequent visit peak under normal working conditions due to excessive load after running for a period of time.

[0044] Figure 2 The exemplary system architecture of the method for detecting anomalies in time series data and the device for detecting anomalies in time series data according to the embodiments of the present disclosure is schematically shown. It should be noted that: Figure 2 What is shown is merely an example of a system architecture to which the embodiments of the present disclosure can be applied, in order to help those skilled in the art understand the technical content of the present disclosure, but it does not mean that the embodiments of the present disclosure cannot be used in other devices, systems, environments or scenarios.

[0045] like Figure 2 As shown, the system architecture 200 according to this embodiment may include terminal devices 201, 202, 203, a network 204 and a server 205. The network 204 may include multiple gateways, routers, hubs, network cables, etc., which are used to provide a medium for communication links between the terminal devices 201, 202, 203 and the server 205. The network 204 may include various connection types, such as wired, wireless communication links or optical fiber cables, etc.

[0046] The user can use the terminal devices 201, 202, 203 to interact with other terminal devices and the server 205 through the network 204 to receive or send information, such as sending service requests, service data, user identity related information, etc. The terminal devices 201, 202, 203 can be installed with various communication client applications, such as operation and maintenance applications, web browser applications, banking applications, e-commerce applications, search applications, office applications, instant messaging tools, email clients, social platform software and other applications (only for example).

[0047] The terminal devices 201, 202, 203 include but are not limited to smart phones, augmented reality devices, tablet computers, laptop computers, electronic devices with functions such as web page interaction, etc. The terminal device can send an anomaly detection request to the server.

[0048] The server 205 may receive a request for anomaly detection of time series data, and process the request. For example, the server 205 may be a background management server, a server cluster, etc. The background management server may analyze and process the received service request, information request, etc., and feed back the processing result (such as feature sequence, anomaly detection result, etc.) to the terminal device.

[0049] It should be noted that the anomaly detection method for time series data provided in the embodiment of the present disclosure can be executed by the server 205. Accordingly, the anomaly detection device for time series data provided in the embodiment of the present disclosure can be set in the server 205. It should be understood that the number of terminal devices, networks and servers is only illustrative. According to the implementation requirements, there can be any number of terminal devices, networks and servers.

[0050] Figure 3 The flowchart of the method for detecting anomalies in time series data according to an embodiment of the present disclosure is schematically shown.

[0051] like Figure 3 As shown, the abnormality detection method for time series data may include operations S310 to S340.

[0052] In operation S310 , in response to the acquired time series data, a plurality of feature sequences for the time series data, and directionality and co-occurrence between the plurality of feature sequences are acquired.

[0053] In this embodiment, the time series data may be data generated in a certain scenario, and the time series data may include multiple feature sequences, which can distinguish the time series data from other time series data. The feature sequence may be a shapelet. For example, the time series data may be streaming real-time operation and maintenance data accessed through Kafka.

[0054] Improve shapelet interpretable anomaly detection, measure the temporal impact of shapelets at different time positions by defining two elements, local and global, and then design time-aware shapelets. This makes it easier to build directed weight graphs based on time-aware shapelets (such as modeling time evolution graphs), analyze them through graph embedding algorithms, make shapelets more interpretable, and make anomaly detection and positioning more scenario-based and interpretable.

[0055] Specifically, to capture the dynamics of shapelets, two factors are defined to measure the temporal impact of shapelets at different time positions. For example, a local factor ω is defined n To represent the internal importance of the nth element of a specific shapelet. For example, in the global scope, the influence of the temporal position across segments on the discriminability of the shapelet is mainly measured, and a global factor u is set by adding the weight of the temporal segment m , by measuring such deviations, we can capture the impact of cross-time series data segments. n and u m Related to specific scenarios and specific time series data shape graphs.

[0056] That is, if the parameter ω corresponding to the current time series data n and u m If it matches a specific scenario and a specific time series data shape graph, it can be inferred that the current time series data is generated in the specific scenario. The specific scenario includes but is not limited to: holiday access peaks, hardware anomalies, environmental fluctuations (such as power grid fluctuations), etc.

[0057] In operation S320, time series data segments excluding the feature sequences in the time series data are respectively classified into time series segment sets represented by at least part of the feature sequences in the plurality of feature sequences, to obtain a plurality of candidate time series segment sets.

[0058] In this embodiment, in order to improve the accuracy of the results of abnormality detection, not only the feature sequence is analyzed, but all time series data are analyzed. To achieve this goal, the time series data segments excluding the feature sequence in the time series data are classified into the class where the closest feature sequence is located. This makes it easier to determine the direction and co-occurrence probability between the classes.

[0059] In operation S330, the directionality and co-occurrence probability between the plurality of candidate time sequence segments sets are determined based on the directionality and co-occurrence between the plurality of feature sequences.

[0060] Specifically, the probability of each feature sequence being assigned to each candidate time series segment can be calculated. The whole of the feature sequence and the time series data segment excluding the feature sequence is the time series data. The directionality and co-occurrence probability between the categories can be determined based on the probability of each feature sequence being assigned to each candidate time series segment. Each category corresponds to a set of candidate time series segments. Each time series data segment has a series of probabilities, which is a probability group of the current time series data segment being assigned to each candidate time series segment set. The above probabilities are related to the similarity between the current time series data segment and each feature sequence. For example, the higher the similarity, the larger the corresponding probability value. For example, the directionality and co-occurrence probability between the categories can be determined by weighted summing the above feature sequence probabilities.

[0061] In operation S340, a directed weighted graph is generated for multiple candidate time segment sets so as to perform anomaly detection on the time series data based on the directed weighted graph, wherein the nodes of the directed weighted graph represent the candidate time segment sets, and the directed lines of the directed weighted graph represent the direction and co-occurrence probability between two nodes connected to the directed lines.

[0062] Modeling is performed through a constructed directed weighted graph (also called a shapelet evolution graph), and representations of shapelets and given time series are learned. The representation vector of the node shapelet is obtained by using a graph embedding algorithm (such as DeepWalk) in related technologies. Then, for each segment in the time series, it is assigned to a set of candidate time series segments where different shapelets are located, and the weights of the connections between the candidate time series segments are determined. Finally, all these embedded vectors (representation vectors) are linked or aggregated to obtain the representation vector of the time series data (the most original event sequence). The learned representation vector is applied to various downstream time series tasks. For example, the attributes of the unreached time series data are predicted based on the arrived time series data.

[0063] Specifically, a directed weighted graph (also called a shapelet evolution graph) is constructed based on the directions and co-occurrence probabilities between multiple candidate time segment sets. The shapelet evolution graph is a directed weighted graph G = (V, E). The shapelet evolution graph consists of k vertices, each vertex represents a shapelet. Each directed edge e i,j ∈E and its weight ω i,j (refer to ω in equation (8)), which means that in the same time series, shapelet v i ∈V followed by another shapelet v j ∈V appears. The paths in the shapelet evolution graph can naturally reflect the evolution of shapelets and their transfer patterns.

[0064] In this way, it is possible to perform explainable anomaly detection analysis based on the above analysis results and combined with operation and maintenance scenarios.

[0065] Figure 4 A flow chart of a method for acquiring a feature sequence according to an embodiment of the present disclosure is schematically shown.

[0066] like Figure 4 As shown, obtaining multiple feature sequences for time series data, and determining the directionality and co-occurrence between the multiple feature sequences may include operation S401.

[0067] In operation S401, the time series data is processed using a trained feature sequence acquisition model to obtain multiple feature sequences for the time series data, as well as directionality and co-occurrence between the multiple feature sequences.

[0068] Among them, the objective function of the feature sequence acquisition model includes: the difference between positive samples and negative samples, the co-occurrence probability, the co-occurrence probability weight, the penalty term and the penalty term coefficient.

[0069] In some embodiments, the time series data set is defined as shown in formula (1):

[0070] T={t1,…,t |T| Formula (1)

[0071] Among them, each time series data (t1~t |T| ) includes n elements arranged in time order, for example, t = {x1, x2, ..., x n}. T≥1, n is a positive integer.

[0072] s is a continuous subsequence of t (a time series data segment). For example, a time series data segment can be represented as s={x i ,…,x j}, if t can be divided into m segments of length l, then t={x l*k+1 ,…,x l*k+l}, 0≤k≤m-1. In order to distinguish the differences between these time series data segments, two different time series data segments s are intuitively defined. i ,s j The Euclidean distance d(s i ,s j ). Where l, m, i, j are positive integers. However, Euclidean cannot handle different sequence lengths and time shifts. In the context of time series modeling, time shift techniques are often used to solve the above problems. The core of this method is to find a suitable alignment method for a given sequence, which can be defined as follows:

[0073] With two time series data segments s i ,s jFor example, their lengths are l i ,l j , define alignment a=(a1,a2), that is, a pair of two index sequences of length p that satisfy the conditions shown in formula (2).

[0074]

[0075] For two segments i ,s j All possible alignments of i ,s j ), then the corresponding time conversion method DTW can be expressed as shown in formula (3).

[0076]

[0077] Among them, T(s i ,s j |a) is the predefined dissimilarity between two sequences under alignment mode a, and the minimum alignment value in the above formula is set to a * ,

[0078] Further define the time series data segment s and time series t (t={s1,…,s m}), if there is a time series data segment s′ in t whose distance to s is quite small, then the distance between s and t is defined as shown in formula (4).

[0079] D(s,t)=min 1≤k≤m d(s,s k ) Formula (4)

[0080] According to the definition, it is necessary to extract typical subsequences, and shapelet is a representative for extracting typical subsequences and distinguishing segments. Among them, Shapelet is a time series data with identifiable category features, and the purpose of accurately classifying time series is achieved by identifying local features.

[0081] Shapelet v represents a certain type of time series data segment. According to some specific criteria, T can be divided into two sets, a set S close to v pos (v,T), a set S corresponding to v neg (v,T). Especially for typical time series data, positive samples and negative samples can correspond to two different groups, which can be expressed as shown in formula (5):

[0082] L=-g(S pos (v,T),S neg (v,T)) Formula (5)

[0083] For v, L represents the dissimilarity between positive samples and negative samples.

[0084] S * (v,T) means relative to group T * The function g takes two finite sets as input and returns a scalar value representing the distance between the two sets.

[0085] To capture the dynamics of shapelets, two factors are defined to measure the temporal impact of shapelets at different time positions and a local factor ω is defined. n To represent the internal importance of the nth element of a specific shapelet. The distance between shapelet v and the time series data segment S can be defined as shown in formula (6).

[0086]

[0087] Among them, a * It refers to the use of DTW distance to measure the matching of Shapelet and time series data segments. In the global scope, it mainly measures the influence of the time position across time series data segments on the discriminability of shapelet. By adding the weight of the time series data segment, a global factor u is set m , so that the impact of cross-series data segments can be captured by measuring such deviations. In addition, the distance between shapelet v and time series t is defined as follows:

[0088]

[0089] Among them, t is divided into m segments, that is, t={s1,…,s m}. The parameters ω,u are related to the specific scenario and the specific shape graph of the time series data.

[0090] According to the type of operation and maintenance data, historical data is learned, ω and u are set, and the corresponding shapelet is set. This process can be achieved through model training.

[0091] In some embodiments, the feature sequence acquisition model may be trained in the following manner.

[0092] For example, the training process of the feature sequence acquisition model may include the following operations: using the trained feature sequence acquisition model to process historical time series data, and adjusting at least the co-occurrence probability and the value of the penalty term so that the objective function reaches the maximum value or the minimum value.

[0093] Among them, the historical time series data includes time series data segments marked as feature sequences. When the objective function reaches a maximum value or a minimum value, the time series data segment output by the feature sequence acquisition model approaches the time series data segment marked as the feature sequence.

[0094] Specifically, through supervised learning of a certain type of time series operation and maintenance data, the most important time-aware shapelet is selected, and the time factor ω corresponding to each shapelet is learned. i and u i In particular, for a set of labeled time series T, a candidate pool of segments that can be used as Shapelets (i.e., a set of candidate time series segments) is screened from all subsequences. For each candidate v, the objective function can be expressed as formula (8).

[0095]

[0096] Among them, λ, ε are the penalty coefficients of hyperparameters, and the g function is the same as the g function in formula (5) for calculating the distance distribution between two specific sets.

[0097] Figure 5 A flowchart of a method for model training according to an embodiment of the present disclosure is schematically shown.

[0098] like Figure 5 As shown, the model training method may include operations S501 to S507.

[0099] In operation S501, historical data is learned according to the operation and maintenance data type, so that ω, μ and a shapelet corresponding to the operation and maintenance data type can be obtained through model training.

[0100] The model may be iterated during use to improve the prediction accuracy of the model. For example, the model iteration training process may be implemented through operations S502 to S507.

[0101] In operation S502, streaming real-time operation and maintenance data is accessed.

[0102] In operation S503 , for a certain type of time series operation and maintenance data, a pool of k shapelet fragment candidates is obtained.

[0103] In operation S504, a shapelet evolution graph model is constructed.

[0104] In operation S505 , the evolution graph is analyzed by a graph embedding algorithm.

[0105] In operation S506, scenario-based and explainable anomaly detection analysis is performed.

[0106] In operation S507, the processed time series operation and maintenance data is written into the database, so that the time series operation and maintenance data written into the database historically can be used as training data for model training, so as to iteratively update the feature sequence acquisition model.

[0107] In some embodiments, after obtaining multiple feature sequences for time series data, the above method may further include the following operation: selecting a specified number of feature sequences from the multiple feature sequences to obtain a specified number of candidate time series segment sets.

[0108] Specifically, after learning the temporal factors from multiple shapelet candidates respectively, the first k shapelets with the smallest loss are selected as the final time-aware shapelet candidate pool. k is a positive integer.

[0109] In some embodiments, shapelets may also be screened by clustering. Specifically, obtaining multiple feature sequences for time series data includes: obtaining a specified number of time series data segments closest to the time series data from multiple time series data segments included in the time series data by clustering as multiple feature sequences.

[0110] For example, obtaining a specified number of time series data segments closest to the time series data from multiple time series data segments included in the time series data by clustering may include the following operations.

[0111] First, each time series data segment with a specified length included in the time series data is obtained to obtain a time series data segment set.

[0112] Then, the data segment vector of each time series data segment and the set vector of the time series data segment set are obtained.

[0113] Next, the time series data segments corresponding to the specified number of data segment vectors having the highest similarity to the set vector are taken as the specified number of time series data segments closest to the time series data.

[0114] Figure 6 A flow chart of a method for acquiring a feature sequence according to another embodiment of the present disclosure is schematically shown.

[0115] like Figure 6 As shown, the feature sequence may be acquired by executing operations S601 to S604.

[0116] In operation S601, the user may input a time series data sequence T, a sequence length (ie, a time series data segment) l, and a candidate pool length (ie, the length of the feature sequence).

[0117] In operation S602, all subsequences (time series data segments) of length l in the time series data sequence T are calculated and recorded as seq.

[0118] In operation S603, the index of the subsequence in seq that is closest to the center of seq is set to 1. That is, the subsequence with the most similar semantics to seq (closest vector or shortest distance) is found among all subsequences of length l in the time series data sequence T.

[0119] In operation S604, a specified number of subsequences closest to the center of seq are extracted in sequence from seq, and these subsequences are used as feature sequences.

[0120] In the above manner, the time series data segment that is most similar to the semantics of the time series data can be selected and used as the feature sequence.

[0121] In some embodiments, classifying the time series data segments excluding the feature sequences in the time series data into time series segment sets represented by at least part of the feature sequences in the plurality of feature sequences to obtain a plurality of candidate time series segment sets may include the following operations.

[0122] For each of at least a portion of the time series data segments excluding the feature sequence in the time series data: first, obtain the distances between the time series data segments and the plurality of feature sequences, respectively. Then, classify the time series data segments into a time series segment set corresponding to the target feature sequence.

[0123] The target feature sequence is a feature sequence corresponding to the smallest distance among multiple feature sequences, or the target feature sequence is a feature sequence corresponding to a distance less than a set threshold among multiple feature sequences.

[0124] For example, solving for each time series segment s i When the distance to the nearest shapelets is reached, a threshold δ is calculated based on the experimental statistics of the training data set. As long as the distance is less than δ, the time series segment distance can be judged to be very close. i They are classified into the class where a shapelet belongs.

[0125] In some embodiments, determining the directionality and co-occurrence probability between a plurality of candidate time sequence segments based on the directionality and co-occurrence between a plurality of feature sequences may include the following operations.

[0126] First, a feature sequence probability group is determined to determine the probability that each feature sequence is assigned to each candidate time segment.

[0127] Next, the probability weighted value of each feature sequence for the same time series data segment is determined based on the feature sequence probability group.

[0128] Then, the normalized co-occurrence probability between multiple candidate time series segment sets is determined based on the probability weighted value of each feature sequence for the same time series data segment.

[0129] In a specific embodiment, shapelets are assigned to s i , marked as v i,* , that is, v i,j is the jth pair of s iThe assignment of shapelet is standardized as shown in formula (9):

[0130]

[0131] Among them, max() is to find the maximum value, and min() is to find the minimum value. In addition, there are the following predefined constraints, as shown in formula (10).

[0132]

[0133] And meet

[0134] Shapelets correspond to the set v i,* Assigned to the time series data segment s i The probability is p i,* . According to the time series characteristics, and so on, we can get the feature sequence probability group shapelet group (j, k).

[0135] Then, for each shapelet group (j, k), v i,j to v i+1,j Create weighted edges and pass them by weight p i,j ·p i+1,k Merge all duplicate edges. Then, normalize the edge weights obtained from each node to 1, which is naturally interpreted as the edge weight between each pair of nodes. For example, v i and v j Converted into conditional probability p(v j |v i ), shapeletv can be used in adjacent time steps i Convert to v j .

[0136] Through the above method, a shapelet evolution graph can be constructed, and then the graph embedding algorithm can be applied to the learning of shapelet features and time series representation, and then reasoning and interpretation can be performed.

[0137] Another aspect of the present disclosure also provides an anomaly detection device for time series data.

[0138] Figure 7 A block diagram of a device for detecting anomalies in time series data according to an embodiment of the present disclosure is schematically shown.

[0139] like Figure 7 As shown, the above-mentioned device 700 may include: a feature sequence acquisition module 710 , a classification module 720 , a co-occurrence probability determination module 730 and a graph generation module 740 .

[0140] The feature sequence acquisition module 710 is used to obtain multiple feature sequences for the time series data in response to the obtained time series data, as well as the directionality and co-occurrence between the multiple feature sequences.

[0141] The classification module 720 is used to classify the time series data segments excluding the feature sequences in the time series data into time series segment sets represented by at least part of the feature sequences in the plurality of feature sequences, to obtain a plurality of candidate time series segment sets.

[0142] The co-occurrence probability determination module 730 is used to determine the directionality and co-occurrence probability between multiple candidate time sequence segments based on the directionality and co-occurrence between multiple feature sequences.

[0143] The graph generation module 740 is used to generate a directed weighted graph for multiple candidate time segment sets so as to perform anomaly detection on time series data based on the directed weighted graph. The nodes of the directed weighted graph represent the candidate time segment sets, and the directed lines of the directed weighted graph represent the direction and co-occurrence probability between two nodes connected to the directed lines.

[0144] In some embodiments, the feature sequence acquisition module 710 may include: a first feature sequence acquisition unit, and / or a second feature sequence acquisition unit.

[0145] Among them, the first feature sequence acquisition unit is used to process time series data using a trained feature sequence acquisition model to obtain multiple feature sequences for the time series data, as well as directionality and co-occurrence between multiple feature sequences; wherein the objective function of the feature sequence acquisition model includes: the difference between positive samples and negative samples, co-occurrence probability, co-occurrence probability weight, penalty term and penalty term coefficient.

[0146] The second feature sequence acquisition unit is used to acquire a specified number of time series data segments closest to the time series data from the multiple time series data segments included in the time series data by clustering as multiple feature sequences.

[0147] In some embodiments, the apparatus 700 may further include a model training module, wherein the model training module is used to obtain a model using a trained feature sequence to process historical time series data, and adjust at least the co-occurrence probability and the value of the penalty term so that the objective function obtains a maximum value or a minimum value.

[0148] The historical time series data includes time series data segments marked as feature sequences. When the objective function reaches a maximum value or a minimum value, the time series data segments output by the feature sequence acquisition model approach the time series data segments marked as feature sequences.

[0149] In some embodiments, the feature sequence acquisition module 710 may further include a data segment extraction unit, a vectorization unit, and a feature sequence determination unit.

[0150] The data segment extraction unit is used to obtain each time series data segment with a specified length included in the time series data to obtain a time series data segment set.

[0151] The vectorization unit is used to obtain the data segment vector of each time series data segment and the set vector of the time series data segment set.

[0152] The feature sequence determination unit is used to use the time series data segments corresponding to the specified number of data segment vectors with the highest similarity to the set vector as the specified number of time series data segments closest to the time series data.

[0153] Figure 8 A block diagram of an apparatus for abnormality detection of time series data according to another embodiment of the present disclosure is schematically shown.

[0154] like Figure 8 As shown, the device 800 may include a historical data offline learning module, a streaming data access module, a shapelet candidate pool acquisition module, a shapelet evolution graph construction module, a graph embedding algorithm and a specific operation and maintenance scenario evolution graph analysis and interpretation module, and an operation and maintenance data library writing module.

[0155] Among them, the historical data offline learning module is used to perform offline classification learning on the historical operation and maintenance data stored in the database, set the influencing factor values ​​and sort out the corresponding shapelets.

[0156] The streaming data access module is used to connect to Kafka to access streaming operation and maintenance data in real time.

[0157] The shapelet candidate pool acquisition module is used to obtain a fragment candidate pool of k shapelets through supervised learning for a certain type of time series operation and maintenance data.

[0158] The shapelet evolution graph construction module is used to construct a shapelet evolution graph model based on k shapelets.

[0159] The graph embedding algorithm and the specific operation and maintenance scenario evolution graph analysis and interpretation module are used to analyze the evolution graph through the graph embedding algorithm, and analyze it in combination with the operation and maintenance scenario and explainable anomaly detection.

[0160] The operation and maintenance data writing module is used to write and update the processed operation and maintenance data.

[0161] It should be noted that the implementation methods, technical problems solved, functions realized, and technical effects achieved of each module / unit in the device part embodiment are the same or similar to the implementation methods, technical problems solved, functions realized, and technical effects achieved of each corresponding step in the method part embodiment, and they will not be repeated here one by one.

[0162] According to the modules and units of the embodiments of the present disclosure, any multiple or at least part of the functions of any multiple thereof can be implemented in one module. According to the modules and units of the embodiments of the present disclosure, any one or more can be split into multiple modules for implementation. According to the modules and units of the embodiments of the present disclosure, any one or more can be at least partially implemented as a hardware circuit, such as a field programmable gate array (FPGA), a programmable logic array (PLA), a system on a chip, a system on a substrate, a system on a package, an application-specific integrated circuit (ASIC), or can be implemented by hardware or firmware of any other reasonable way of integrating or packaging the circuit, or implemented in any one of the three implementation methods of software, hardware and firmware or in any appropriate combination of any of them. Alternatively, according to the modules and units of the embodiments of the present disclosure, one or more can be at least partially implemented as a computer program module, and when the computer program module is run, the corresponding function can be executed.

[0163] For example, any multiple of the feature sequence acquisition module 710, the classification module 720, the co-occurrence probability determination module 730, and the graph generation module 740 can be combined in one module for implementation, or any one of the modules can be split into multiple modules. Alternatively, at least part of the functions of one or more of these modules can be combined with at least part of the functions of other modules and implemented in one module. According to an embodiment of the present disclosure, at least one of the feature sequence acquisition module 710, the classification module 720, the co-occurrence probability determination module 730, and the graph generation module 740 can be at least partially implemented as a hardware circuit, such as a field programmable gate array (FPGA), a programmable logic array (PLA), a system on a chip, a system on a substrate, a system on a package, an application specific integrated circuit (ASIC), or can be implemented by hardware or firmware such as any other reasonable way of integrating or packaging the circuit, or by any one of the three implementation methods of software, hardware, and firmware, or by a suitable combination of any of them. Alternatively, at least one of the feature sequence acquisition module 710, the classification module 720, the co-occurrence probability determination module 730 and the graph generation module 740 may be at least partially implemented as a computer program module, which may perform a corresponding function when executed.

[0164] Fig. 9 A block diagram of an electronic device according to an embodiment of the present disclosure is schematically shown. Fig. 9 The electronic device shown is only an example and should not bring any limitation to the functions and scope of use of the embodiments of the present disclosure.

[0165] like Fig. 9As shown, the electronic device 900 according to an embodiment of the present disclosure includes a processor 901, which can perform various appropriate actions and processes according to a program stored in a read-only memory (ROM) 902 or a program loaded from a storage part 908 into a random access memory (RAM) 903. The processor 901 may include, for example, a general-purpose microprocessor (e.g., a CPU), an instruction set processor and / or a related chipset and / or a special-purpose microprocessor (e.g., an application-specific integrated circuit (ASIC)), etc. The processor 901 may also include an onboard memory for caching purposes. The processor 901 may include a single processing unit or multiple processing units for performing different actions of the method flow according to an embodiment of the present disclosure.

[0166] In RAM 903, various programs and data required for the operation of electronic device 900 are stored. Processor 901, ROM 902 and RAM 903 are connected to each other through bus 904. Processor 901 performs various operations of the method flow according to the embodiment of the present disclosure by executing the program in ROM 902 and / or RAM 903. It should be noted that the program can also be stored in one or more memories other than ROM 902 and RAM 903. Processor 901 can also perform various operations of the method flow according to the embodiment of the present disclosure by executing the program stored in one or more memories.

[0167] According to an embodiment of the present disclosure, the electronic device 900 may further include an input / output (I / O) interface 905, which is also connected to the bus 904. The electronic device 900 may further include one or more of the following components connected to the I / O interface 905: an input portion 906 including a keyboard, a mouse, etc.; an output portion 907 including a cathode ray tube (CRT), a liquid crystal display (LCD), etc., and a speaker, etc.; a storage portion 908 including a hard disk, etc.; and a communication portion 909 including a network interface card such as a LAN card, a modem, etc. The communication portion 909 performs communication processing via a network such as the Internet. A drive 910 is also connected to the I / O interface 905 as needed. A removable medium 911, such as a magnetic disk, an optical disk, a magneto-optical disk, a semiconductor memory, etc., is installed on the drive 910 as needed, so that a computer program read therefrom is installed into the storage portion 908 as needed.

[0168] According to an embodiment of the present disclosure, the method flow according to an embodiment of the present disclosure can be implemented as a computer software program. For example, an embodiment of the present disclosure includes a computer program product, which includes a computer program carried on a computer-readable storage medium, and the computer program contains a program code for executing the method shown in the flowchart. In such an embodiment, the computer program can be downloaded and installed from the network through the communication part 909, and / or installed from the removable medium 911. When the computer program is executed by the processor 901, the above-mentioned functions defined in the system of the embodiment of the present disclosure are executed. According to an embodiment of the present disclosure, the system, equipment, device, module, unit, etc. described above can be implemented by a computer program module.

[0169] It should be noted that the anomaly detection method for time series data, the anomaly detection device for time series data, and the electronic device provided in the embodiments of the present disclosure can be used in the related aspects of anomaly detection of time series data in other fields of artificial intelligence, and can also be used in various fields other than other fields of artificial intelligence, such as the field of anomaly detection of time series data, and can also be applied in the financial field. The application fields of the anomaly detection method for time series data, the anomaly detection device for time series data, and the electronic device provided in the embodiments of the present disclosure are not limited.

[0170] The present disclosure also provides a computer-readable storage medium, which may be included in the device / apparatus / system described in the above embodiments; or may exist independently without being assembled into the device / apparatus / system. The above computer-readable storage medium carries one or more programs, and when the above one or more programs are executed, the method according to the embodiment of the present disclosure is implemented.

[0171] According to an embodiment of the present disclosure, a computer-readable storage medium may be a non-volatile computer-readable storage medium, for example, may include but is not limited to: a portable computer disk, a hard disk, a random access memory (RAM), a read-only memory (ROM), an erasable programmable read-only memory (EPROM or flash memory), a portable compact disk read-only memory (CD-ROM), an optical storage device, a magnetic storage device, or any suitable combination thereof. In the present disclosure, a computer-readable storage medium may be any tangible medium containing or storing a program, which may be used by or in combination with an instruction execution system, an apparatus, or a device. For example, according to an embodiment of the present disclosure, a computer-readable storage medium may include the ROM 902 and / or RAM 903 described above and / or one or more memories other than ROM 902 and RAM 903.

[0172] An embodiment of the present disclosure also includes a computer program product, which includes a computer program, which contains program code for executing the method provided by the embodiment of the present disclosure. When the computer program product runs on an electronic device, the program code is used to enable the electronic device to implement the image model training method or the anomaly detection method for time series data provided by the embodiment of the present disclosure.

[0173] When the computer program is executed by the processor 901, the above functions defined in the system / device of the embodiment of the present disclosure are executed. According to the embodiment of the present disclosure, the system, device, module, unit, etc. described above can be implemented by a computer program module.

[0174] In one embodiment, the computer program may be based on a tangible storage medium such as an optical storage device, a magnetic storage device, etc. In another embodiment, the computer program may also be transmitted and distributed in the form of a signal on a network medium, and downloaded and installed through the communication part 909, and / or installed from a removable medium 911. The program code contained in the computer program may be transmitted using any appropriate network medium, including but not limited to: wireless, wired, etc., or any suitable combination of the above.

[0175] According to an embodiment of the present disclosure, the program code for executing the computer program provided by the embodiment of the present disclosure can be written in any combination of one or more programming languages. Specifically, these computing programs can be implemented using high-level process and / or object-oriented programming languages, and / or assembly / machine languages. Programming languages ​​include, but are not limited to, Java, C++, python, "C" language or similar programming languages. The program code can be executed entirely on the user computing device, partially on the user device, partially on the remote computing device, or entirely on the remote computing device or server. In the case of a remote computing device, the remote computing device can be connected to the user computing device through any type of network, including a local area network (LAN) or a wide area network (WAN), or can be connected to an external computing device (for example, using an Internet service provider to connect through the Internet).

[0176] Those skilled in the art will appreciate that the features described in the various embodiments and / or claims of the present disclosure may be combined and / or combined in a variety of ways, even if such combinations or combinations are not explicitly described in the present disclosure. These embodiments are for illustrative purposes only and are not intended to limit the scope of the present disclosure. Although the various embodiments are described above, this does not mean that the measures in the various embodiments cannot be used in combination to advantage. The scope of the present disclosure is defined by the attached claims and their equivalents. Without departing from the scope of the present disclosure, those skilled in the art may make a variety of substitutions and modifications, all of which should fall within the scope of the present disclosure.

Claims

1. A method for detecting anomalies in time series data, comprising: In response to the acquired time series data, a plurality of feature sequences for the time series data, and directivity and co-occurrence between the plurality of feature sequences are acquired; Classifying the time series data segments excluding the feature sequences in the time series data into time series segment sets represented by at least part of the feature sequences in the multiple feature sequences, respectively, to obtain multiple candidate time series segment sets; Determine the directionality and co-occurrence probability between the plurality of candidate time sequence segments based on the directionality and co-occurrence between the plurality of feature sequences; as well as Generate a directed weighted graph for the plurality of candidate time series segment sets, so as to perform anomaly detection on the time series data based on the directed weighted graph, wherein the nodes of the directed weighted graph represent the candidate time series segment sets, and the directed lines of the directed weighted graph represent the direction and co-occurrence probability between two nodes connected to the directed lines, The acquiring of multiple feature sequences for the time series data, and the directionality and co-occurrence between the multiple feature sequences includes: Processing the time series data using a trained feature sequence acquisition model to obtain a plurality of feature sequences for the time series data, and directionality and co-occurrence between the plurality of feature sequences; The objective function of the feature sequence acquisition model includes: the difference between positive samples and negative samples, the co-occurrence probability, the co-occurrence probability weight, the penalty term and the penalty term coefficient.

2. The method according to claim 1, wherein: The training process of the feature sequence acquisition model includes: Using the trained feature sequence acquisition model to process the historical time series data, by at least adjusting the co-occurrence probability and the value of the penalty term, the objective function obtains a maximum value or a minimum value; Among them, the historical time series data includes time series data segments marked as feature sequences, and when the objective function reaches a maximum value or a minimum value, the time series data segments output by the feature sequence acquisition model approach the time series data segments marked as feature sequences.

3. The method according to claim 1, further comprising: After obtaining a plurality of feature sequences for the time series data, A specified number of feature sequences are selected from the multiple feature sequences to obtain a specified number of candidate time segment sets.

4. The method according to claim 1, wherein: The acquiring of a plurality of feature sequences for the time series data comprises: A specified number of time series data segments closest to the time series data are obtained from the multiple time series data segments included in the time series data in a clustering manner as the multiple feature sequences.

5. The method according to claim 4, wherein: The step of obtaining a specified number of time series data segments closest to the time series data from the multiple time series data segments included in the time series data by clustering includes: Acquire each time series data segment with a specified length included in the time series data to obtain a time series data segment set; Obtaining a data segment vector of each time series data segment and a set vector of the time series data segment set; and The time series data segments corresponding to the specified number of data segment vectors with the highest similarity to the set vector are taken as the specified number of time series data segments closest to the time series data.

6. The method according to any one of claims 1 to 5, wherein: The step of classifying the time series data segments excluding the feature sequence in the time series data into time series segment sets represented by at least some of the feature sequences in the multiple feature sequences to obtain multiple candidate time series segment sets comprises: for each of at least some of the time series data segments excluding the feature sequence in the time series data, Obtaining distances between the time series data segments and the respective feature sequences; and Classifying the time series data segments into a set of time series segments corresponding to a target feature sequence; The target feature sequence is a feature sequence corresponding to the smallest distance among the multiple feature sequences, or the target feature sequence is a feature sequence corresponding to a distance less than a set threshold among the multiple feature sequences.

7. The method according to any one of claims 1 to 5, wherein: The determining of the directionality and co-occurrence probability between the plurality of candidate time sequence segments based on the directionality and co-occurrence between the plurality of feature sequences comprises: Determine the probability of each feature sequence being assigned to each candidate time segment, and obtain a feature sequence probability group; Determining a probability weighted value of each feature sequence for the same time series data segment based on the feature sequence probability group; and The normalized co-occurrence probability between multiple candidate time series segment sets is determined based on the probability weighted value of each feature sequence for the same time series data segment.

8. A device for detecting anomalies in time series data, comprising: A feature sequence acquisition module, configured to acquire, in response to the acquired time series data, a plurality of feature sequences for the time series data, and directionality and co-occurrence between the plurality of feature sequences; a classification module, configured to classify the time series data segments excluding the feature sequences in the time series data into time series segment sets represented by at least part of the feature sequences in the multiple feature sequences, respectively, to obtain multiple candidate time series segment sets; a co-occurrence probability determination module, configured to determine the directionality and co-occurrence probability between the plurality of candidate time sequence segments based on the directionality and co-occurrence between the plurality of feature sequences; and A graph generation module is used to generate a directed weighted graph for the plurality of candidate time series segment sets, so as to perform anomaly detection on the time series data based on the directed weighted graph, wherein the nodes of the directed weighted graph represent the candidate time series segment sets, and the directed lines of the directed weighted graph represent the direction and co-occurrence probability between two nodes connected to the directed lines. The feature sequence acquisition module is further used to process the time series data using the trained feature sequence acquisition model to obtain multiple feature sequences for the time series data, and the directionality and co-occurrence between the multiple feature sequences; The objective function of the feature sequence acquisition model includes: the difference between positive samples and negative samples, the co-occurrence probability, the co-occurrence probability weight, the penalty term and the penalty term coefficient.

9. The device according to claim 8, wherein: The feature sequence acquisition module comprises: A first feature sequence acquisition unit is used to process the time series data using a trained feature sequence acquisition model to obtain a plurality of feature sequences for the time series data, and directionality and co-occurrence between the plurality of feature sequences; wherein the objective function of the feature sequence acquisition model includes: the difference between positive samples and negative samples, the co-occurrence probability, the co-occurrence probability weight, the penalty term and the penalty term coefficient; and / or The second feature sequence acquisition unit is used to acquire a specified number of time series data segments closest to the time series data from the multiple time series data segments included in the time series data by clustering as the multiple feature sequences.

10. An electronic device comprising: one or more processors; A storage device is used to store executable instructions, and when the executable instructions are executed by the processor, the method for detecting anomalies in time series data according to any one of claims 1 to 7 is implemented.

11. A computer-readable storage medium having executable instructions stored thereon, which, when executed by a processor, implements the method for detecting anomalies in time series data according to any one of claims 1 to 7.