WO2024114618A1 - Method for detecting abnormal event, and method and apparatus for constructing abnormal-event detection model - Google Patents

Method for detecting abnormal event, and method and apparatus for constructing abnormal-event detection model Download PDF

Info

Publication number
WO2024114618A1
WO2024114618A1 PCT/CN2023/134620 CN2023134620W WO2024114618A1 WO 2024114618 A1 WO2024114618 A1 WO 2024114618A1 CN 2023134620 W CN2023134620 W CN 2023134620W WO 2024114618 A1 WO2024114618 A1 WO 2024114618A1
Authority
WO
WIPO (PCT)
Prior art keywords
event
node
similarity
abnormal
nodes
Prior art date
Application number
PCT/CN2023/134620
Other languages
French (fr)
Chinese (zh)
Inventor
石川
任宇翔
闫博
Original Assignee
华为技术有限公司
Priority date (The priority date is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the date listed.)
Filing date
Publication date
Application filed by 华为技术有限公司 filed Critical 华为技术有限公司
Publication of WO2024114618A1 publication Critical patent/WO2024114618A1/en

Links

Definitions

  • the present application relates to the field of artificial intelligence, and in particular to an abnormal event detection method, an abnormal event model construction training method and a device.
  • Each event may contain multiple types of attribute entities and complex interactions between them, thus forming an attribute heterogeneous information network.
  • attribute heterogeneous information network With the booming development of social media, abnormal event detection in attribute heterogeneous information networks has become an important but rarely explored task.
  • two events can be interacted with each other, and all scores can be weighted by interaction category to obtain the abnormal score of the entire event.
  • the interaction score is in the form of vector dot product, and the higher the score, the more normal the interaction.
  • the model can automatically learn the importance of different types of node interactions. By maximizing the score of normal events to optimize the final loss function, a normal event will have a higher score, while an abnormal event will have a lower score.
  • this detection method can only detect anomalies for simple category events, and its detection accuracy is far from enough for some events with complex interactions.
  • the present application provides an abnormal event detection method, an abnormal event model construction training method and a device in the field of artificial intelligence, which are used to construct an abnormal event detection model based on an attribute heterogeneity graph and are applied to perform anomaly detection on a variety of complex event data generated by users.
  • the present application provides an abnormal event detection method, comprising: obtaining a first attribute heterogeneity graph, the first attribute heterogeneity graph is used to represent at least one event, the first attribute heterogeneity graph includes multiple nodes and association relationships between the multiple nodes, each event is represented by at least two nodes among the multiple nodes and the association relationship between the at least two nodes, and each node in each event includes information of event elements that form the event; using the first attribute heterogeneity graph as an input of an abnormal event detection model to obtain an output result, the output result is used to indicate whether at least one event includes an abnormal event, and the abnormal event is determined based on the similarity between events or the similarity between nodes within an event.
  • the abnormal event detection model can identify the abnormality of an event based on the similarity between nodes within an event or the similarity between events, so that abnormal events can be more accurately identified from multiple dimensions.
  • the abnormal event detection model includes one or more of the following modules: a node pair comparison module, a multivariate interaction module, or an event comparison module, the node comparison module is used to obtain the similarity between nodes within an event, the multivariate interaction module is used to obtain the similarity between nodes within an event and event categories, and the event comparison module is used to obtain the similarity between events.
  • the abnormal event detection model may include an identification module for the degree of abnormality between nodes within an event or an identification module for the degree of abnormality between events, which can accurately identify abnormal events from multiple dimensions.
  • taking the first attribute heterogeneity graph as the input of the abnormal event detection model to obtain an output result may include: outputting a first degree of abnormality for each event according to the node pair comparison module, wherein the node pair comparison module is used to obtain the similarity between the node pairs in each event, and obtaining the first degree of abnormality according to the similarity between the node pairs in each event; judging whether each event is an abnormal event according to the first degree of abnormality of each event to obtain an output result.
  • the similarity between nodes within an event can be calculated through a node pair comparison module, so that the abnormal event detection model can identify the abnormality of the event based on the similarity between nodes within the event and accurately identify the abnormal event.
  • the abnormal event detection model includes a multivariate interaction module
  • the first attribute heterogeneity graph is used as the input of the abnormal event detection model to obtain an output result, and may also include: outputting the second abnormality degree of each event through the multivariate interaction module, wherein the multivariate interaction module is used to fuse multiple nodes in at least one event to obtain an identifier node, or to use the center point of each event as the identifier node, and to obtain the second abnormality degree of each event through the similarity between at least one node and the identifier node; based on the second abnormality degree of each event, judging whether each event is an abnormal event to obtain an output result.
  • the abnormal event detection model includes an event comparison module
  • the first attribute heterogeneity graph is used as the input of the abnormal event detection model to obtain an output result, and it may also include: outputting the third abnormality degree of each event through the event comparison module, wherein the event comparison module is used to obtain the similarity between event pairs, and calculate the third abnormality degree of each event according to the similarity between the event pairs; according to the third abnormality degree of each event, determine whether each event is an abnormal event to obtain an output result.
  • an event comparison module may also be set in the abnormal event detection model to identify the abnormality degree between events, so as to identify abnormal events in units of events.
  • the event comparison module can be specifically used to: filter out a positive sample set corresponding to each event from multiple events; and obtain a third abnormality degree of each event based on the similarity between each event and the events in the corresponding positive sample set.
  • a positive sample set for each event may be determined, and whether an event is abnormal may be identified based on the similarity between adjacent times.
  • the event comparison module is specifically used to: perform semantic recognition on each event to obtain a representation of each event; and calculate the similarity between each event and the events in the corresponding positive sample set based on the representation of each event. Therefore, the embodiment of the present application can accurately calculate the similarity between events based on the extracted features.
  • the abnormal event detection model includes a node pair comparison module, a multivariate interaction module and an event comparison module
  • the first attribute heterogeneity graph is used as the input of the abnormal event detection model to obtain an output result
  • the first attribute heterogeneity graph is used as the input of the node pair comparison module, the multivariate interaction module and the event comparison module respectively; fusing the first abnormality degree of each event output by the node pair comparison module, the second abnormality degree of each event output by the multivariate interaction module and the third abnormality degree of each event output by the event comparison module to obtain a fourth abnormality degree of each event; judging whether each event is an abnormal event according to the fourth abnormality degree of each event to obtain an output result.
  • the results output by the multiple modules can be fused to identify abnormal events from multiple granularities and obtain accurate identification results.
  • the aforementioned use of the first attribute heterogeneity graph as input to the abnormal event detection model includes: mapping each node in each event in the first attribute heterogeneity graph to the same space to obtain a second data representation of each event in the same space; and using the second data representation as input to the abnormal event detection model to obtain an output result.
  • the nodes in the attribute heterogeneity graph may be nodes of different dimensions.
  • Each node can be mapped to the same space to obtain the representation of each node in the same dimension, so as to facilitate identification based on the representation of each node in the same dimension.
  • At least one event in the first attribute heterogeneity graph is used to represent: a financial transaction behavior of a user, a comment behavior of a user, or an item transaction behavior of a user. Therefore, the abnormal event detection model constructed by the method provided in this application can be applied to a variety of scenarios, and has a very strong generalization ability.
  • the present application provides a method for constructing an abnormal event detection model, comprising:
  • a second attribute heterogeneity graph is obtained, the second attribute heterogeneity graph represents multiple events, the second attribute heterogeneity graph includes multiple nodes and association relationships between the multiple nodes, each event is represented by at least two nodes among the multiple nodes and the association relationship between the at least two nodes, and the nodes in each event include information of event elements that form the event; then, an abnormal event detection model is constructed according to the second attribute heterogeneity graph, the abnormal event detection model is used to detect abnormal events among multiple events, and the abnormal events are determined according to the similarity between events or the similarity between nodes within an event.
  • the present application can model based on the attribute heterogeneity graph that can represent complex cases, and obtain a model that can be used to detect abnormal events, that is, an abnormal event detection model, so as to realize abnormal detection of more complex events.
  • the abnormal event detection model includes a node pair comparison module, which can be used to obtain the similarity of node pairs, that is, the similarity between nodes, and every at least two nodes form a node pair;
  • the aforementioned construction of the abnormal event detection model based on the second attribute heterogeneity graph may include: first, multiple nodes in each event are grouped into at least one pair of node pairs, and each pair of node pairs may include at least two nodes; then, through the node pair comparison module, the first similarity of each pair of node pairs in at least one pair of node pairs is obtained, that is, the similarity between every at least two nodes; then, according to the first similarity of each pair of node pairs, the composition of each node in the multiple nodes is obtained.
  • the pairwise contrast loss values are calculated, and the abnormal event detection model is updated according to the pairwise contrast loss values of each node pair to obtain an updated abnormal event detection model.
  • the similarity between nodes within an event can be calculated through a node pair comparison module, and comparative learning can be performed based on the similarity between the nodes, so that the abnormal event detection model can identify the degree of abnormality of the event based on the similarity between the nodes within the event, and accurately identify the abnormal event.
  • the aforementioned updating of the abnormal event detection model according to the pairwise contrast loss value of each node pair to obtain an updated abnormal event detection model may include: fusing the pairwise contrast loss values of multiple node pairs in each event to obtain a first loss value; updating the abnormal event detection model according to the first loss value to obtain an updated abnormal event detection model.
  • the contrast loss of each node pair in updating the abnormal event detection model, can be combined to calculate the node pair contrast loss of the event as a whole, so as to learn based on the entire event and learn an abnormal event detection model that can identify abnormal events based on the similarity between nodes.
  • the aforementioned obtaining of the pairwise contrast loss value of each node based on the first similarity of each pair of node pairs may include: obtaining a positive sample node set of the first node from multiple nodes, and constructing a negative sample node set, the first similarity between the nodes in the positive sample node set and the first node is higher than the first similarity between the nodes in the negative sample node set and the first node, and the first node is any one of the multiple nodes in each event; then calculating the pairwise contrast loss value corresponding to the first node through the first similarity between the first node and the nodes in the positive sample node set, and the similarity between the first node and the nodes in the negative sample node set.
  • a positive sample node set can be collected from the nodes within the event, and a negative sample node set can be constructed based on the nodes within the event, so as to perform comparative learning based on the positive sample node set and the negative sample node set, so that the learned node pair comparison module can identify abnormal nodes in the event.
  • the aforementioned calculation of the pairwise contrast loss value corresponding to the first node through the first similarity between the first node and the nodes in the positive sample node set, and the similarity between the first node and the nodes in the negative sample node set may include: obtaining a temperature coefficient, where the temperature coefficient is related to the similarity between the nodes in the negative sample node set and the first node; and combining the temperature coefficient, calculating the pairwise contrast loss value corresponding to the first node through the first similarity between the first node and the nodes in the positive sample node set, and the similarity between the first node and the nodes in the negative sample node set.
  • a temperature coefficient can be set when calculating the paired contrast loss, so as to adjust the focus on difficult samples through the temperature coefficient, thereby reducing the influence of difficult samples on the training results and improving the training effect.
  • the abnormal event detection model further includes a multivariate interaction module, which is used to cluster nodes in the event to obtain at least one category, and obtain the similarity between each node in the event and at least one category, where the similarity is used to indicate the abnormality degree of the corresponding event;
  • the aforementioned construction of an abnormal event detection model based on the second attribute heterogeneity graph may also include: first, obtaining a second similarity between at least one node among multiple nodes in each event and an identifier node through a multivariate interaction module, and the identifier node may include a central node of each event or a node obtained by fusing multiple nodes; then calculating a second loss value based on the second similarity between at least one node and the identifier node; then updating the abnormal event detection model based on the second loss value to obtain an updated abnormal event detection model.
  • the multivariate interaction module can also be used to cluster multiple nodes in each event to obtain at least one category; when calculating the second loss value, the first node can be replaced by the second node, the first node is one of the points in the first event, and the second node has the same attributes as the first node but a different category; obtain the third similarity between the second node and the identifier node; calculate the loss value based on the second similarity and the third similarity to obtain the second loss value.
  • the nodes in the event can be replaced with nodes with the same attributes but different categories, thereby constructing negative samples and realizing unsupervised contrastive learning.
  • the abnormal event detection model further includes an event comparison module, which is used to obtain the similarity between events;
  • the aforementioned construction of the abnormal event detection model based on the second attribute heterogeneity graph may also include: first, from multiple events The positive sample set and the negative sample set corresponding to each event are screened out; then, the third loss value is calculated according to the fourth similarity between each event and the events in the positive sample set and the fifth similarity between each event and the events in the negative sample set; then, the abnormal event detection model can be updated according to the third loss value to obtain an updated abnormal event detection model.
  • an event comparison module can also be constructed to identify the similarities between events, and comparative learning can be achieved by screening the positive sample set and the negative sample set of the event, thereby achieving unsupervised learning.
  • the aforementioned screening out of positive sample sets and negative sample sets corresponding to each event from multiple events may include: obtaining the number of shared nodes between each pair of events through an event comparison module; obtaining at least one event whose number of shared nodes with a second event is greater than a first threshold, and obtaining a positive sample set, wherein the second event is any one of the multiple events; obtaining at least one event whose number of shared nodes with the second event is not greater than the first threshold, and obtaining a negative sample set.
  • the positive sample set and the negative sample set of each event can be determined by the number of nodes shared between events, so that samples with higher similarity can be screened out as positive samples of the current sample, and samples with lower similarity can be screened out as negative samples of the current sample, so as to facilitate subsequent comparative learning.
  • the aforementioned obtaining of the fourth similarity between each pair of events in a plurality of events through an event comparison module may include: performing semantic recognition on each event through the event comparison module to obtain a representation of each event; and the event comparison module may calculate the fourth similarity between the events based on each event representation.
  • the representation of each event can be obtained through semantic recognition, so that the similarity can be accurately calculated through the representation.
  • the aforementioned construction of an abnormal event detection model based on the second attribute heterogeneity graph may also include: first, mapping the data corresponding to each node in each event in the second attribute heterogeneity graph to the same space to obtain a first data representation of each event in the same space; and constructing an abnormal event detection model based on the first data representation.
  • the nodes in the attribute heterogeneity graph may be nodes of different dimensions.
  • the representation of each node in the same dimension can be obtained, so as to facilitate comparative learning based on the representation of each node in the same dimension and obtain an abnormal event detection model.
  • the abnormal event detection model constructed by the method provided in this application can be applied to a variety of scenarios, and has a very strong generalization ability.
  • an abnormal event detection device comprising:
  • An acquisition module is used to acquire a first attribute heterogeneity graph, wherein the first attribute heterogeneity graph includes at least one event, the first attribute heterogeneity graph includes a plurality of nodes and association relationships between the plurality of nodes, each event is represented by at least two nodes among the plurality of nodes and the association relationship between the at least two nodes, and each node in each event includes information of event elements forming the event;
  • the detection module is used to use the first attribute heterogeneity graph as the input of the abnormal event detection model to obtain an output result, and the output result is used to indicate whether at least one event includes an abnormal event, and the abnormal event is determined based on the similarity between events or the similarity between nodes within an event.
  • the abnormal event detection model includes one or more of the following modules: a node pair comparison module, a multivariate interaction module or an event comparison module.
  • the node comparison module is used to obtain the similarity between nodes within an event.
  • the multivariate interaction module is used to obtain the similarity between nodes within an event and event categories.
  • the event comparison module is used to obtain the similarity between events.
  • the detection module is specifically used to: output a first abnormality degree of each event according to the node pair comparison module, wherein the node pair comparison module is used to obtain the similarity between the node pairs in each event, and obtain the first abnormality degree according to the similarity between the node pairs in each event; according to the first abnormality degree of each event, determine whether each event is an abnormal event to obtain an output result.
  • the detection module is specifically used to: output the second abnormality degree of each event through the multivariate interaction module, wherein the multivariate interaction module is used to fuse multiple nodes in at least one event to obtain an identifier node, or use the center point of each event as the identifier node, and obtain the second abnormality degree of each event through the similarity between at least one node and the identifier node; determine whether each event is abnormal according to the second abnormality degree of each event; Normal events to get output results.
  • the detection module is specifically used to: output the third abnormality degree of each event through the event comparison module, wherein the event comparison module is used to obtain the similarity between event pairs, and calculate the third abnormality degree of each event based on the similarity between the event pairs; based on the third abnormality degree of each event, determine whether each event is an abnormal event to obtain an output result.
  • the event comparison module is specifically used to: filter out a positive sample set corresponding to each event from multiple events; and obtain a third abnormality degree of each event based on the similarity between each event and an event in the corresponding positive sample set.
  • the event comparison module is specifically used to: perform semantic recognition on each event to obtain a representation of each event; and calculate the similarity between each event and an event in a corresponding positive sample set based on the representation of each event.
  • the detection module is specifically used to: use the first attribute heterogeneity graph as the input of the node pair comparison module, the multivariate interaction module and the event comparison module respectively; fuse the first abnormality degree of each event output by the node pair comparison module, the second abnormality degree of each event output by the multivariate interaction module and the third abnormality degree of each event output by the event comparison module to obtain the fourth abnormality degree of each event; judge whether each event is an abnormal event according to the fourth abnormality degree of each event to obtain an output result.
  • the detection module is specifically used to: map each node in each event in the first attribute heterogeneity graph to the same space to obtain a second data representation of each event in the same space; and use the second data representation as an input to an abnormal event detection model to obtain an output result.
  • At least one event in the first attribute heterogeneity graph is used to represent: a financial transaction behavior of a user, a comment-posting behavior of a user, or an item transaction behavior of a user.
  • the present application provides a device for constructing an abnormal event detection model, comprising:
  • an acquisition module configured to acquire a second attribute heterogeneity graph, wherein the second attribute heterogeneity graph represents a plurality of events, the second attribute heterogeneity graph includes a plurality of nodes and association relationships between the plurality of nodes, each event is represented by at least two nodes among the plurality of nodes and the association relationship between the at least two nodes, and the node in each event includes information of event elements forming the event;
  • a construction module is used to construct an abnormal event detection model according to the second attribute heterogeneity graph.
  • the abnormal event detection model is used to detect abnormal events among multiple events.
  • the abnormal events are determined based on the similarity between events or the similarity between nodes within an event.
  • the abnormal event detection model includes a node pair comparison module, which is used to obtain the similarity of the node pairs, and the similarity is used to indicate the abnormality degree of the event;
  • the construction module is specifically used to: group multiple nodes in each event into at least one pair of node pairs; obtain the first similarity of each pair of node pairs in at least one pair of node pairs through the node pair comparison module; obtain the pairwise comparison loss value of each node in the multiple nodes according to the first similarity of each pair of node pairs; update the abnormal event detection model according to the pairwise comparison loss value of each node pair to obtain the updated abnormal event detection model.
  • the construction module is specifically used to: fuse the pairwise comparison loss values of multiple node pairs in each event to obtain a first loss value; and update the abnormal event detection model according to the first loss value to obtain an updated abnormal event detection model.
  • a construction module is specifically used to: obtain a positive sample node set of a first node from multiple nodes, and construct a negative sample node set, the first similarity between the nodes in the positive sample node set and the first node is higher than the first similarity between the nodes in the negative sample node set and the first node, and the first node is any one of the multiple nodes in each event; calculate the pairwise comparison loss value corresponding to the first node through the first similarity between the first node and the nodes in the positive sample node set, and the similarity between the first node and the nodes in the negative sample node set.
  • a construction module is specifically used to: obtain a temperature coefficient, where the temperature coefficient is related to the similarity between the nodes in the negative sample node set and the first node; and calculate the pairwise comparison loss value corresponding to the first node in combination with the temperature coefficient through the first similarity between the first node and the nodes in the positive sample node set, and the similarity between the first node and the nodes in the negative sample node set.
  • the abnormal event detection model further includes a multivariate interaction module, which is used to Nodes are clustered to obtain at least one category, and the similarity between each node in the event and at least one category is obtained. The similarity is used to indicate the abnormality degree of the corresponding event;
  • the construction module is also used to obtain the second similarity between at least one node among multiple nodes in each event and the identifier node through the multivariate interaction module, the identifier node includes the central node of each event or a node obtained by fusing multiple nodes; calculate the second loss value according to the second similarity between at least one node and the identifier node; update the abnormal event detection model according to the second loss value to obtain the updated abnormal event detection model.
  • the multivariate interaction module is further used to cluster multiple nodes in each event to obtain at least one category;
  • the construction module is specifically used to: replace the first node with the second node, the first node is one of the points in the first event, and the second node has the same attributes as the first node but a different category; obtain the third similarity between the second node and the identifier node; calculate the loss value according to the second similarity and the third similarity to obtain the second loss value.
  • the abnormal event detection model further includes an event comparison module, which is used to obtain similarities between events;
  • the construction module is specifically used to: filter out a positive sample set and a negative sample set corresponding to each event from multiple events; calculate a third loss value based on a fourth similarity between each event and the events in the positive sample set and a fifth similarity between each event and the events in the negative sample set; update the abnormal event detection model based on the third loss value to obtain an updated abnormal event detection model.
  • a construction module is specifically used to: obtain the number of shared nodes between each pair of events through an event comparison module; obtain at least one event whose number of shared nodes with a second event is greater than a first threshold, and obtain a positive sample set, where the second event is any one of multiple events; obtain at least one event whose number of shared nodes with the second event is not greater than the first threshold, and obtain a negative sample set.
  • the construction module is specifically used to: perform semantic recognition on each event through an event comparison module to obtain each event representation; and calculate the fourth similarity between events according to each event representation through the event comparison module.
  • the construction module is also used to: map the data corresponding to each node in each event in the second attribute heterogeneity graph to the same space to obtain a first data representation of each event in the same space; and construct an abnormal event detection model based on the first data representation.
  • the multiple events in the second attribute heterogeneity graph are used to represent: a financial transaction behavior of a user, a comment-posting behavior of a user, or an item transaction behavior of a user.
  • the present application provides an abnormal event detection model, comprising: at least one of a node pair comparison module, a multivariate interaction module or an event comparison module, the node comparison module is used to obtain the similarity between nodes within an event, the multivariate interaction module is used to obtain the similarity between nodes within an event and event categories, and the event comparison module is used to obtain the similarity between events.
  • the abnormal event detection model can be used to execute the steps in the aforementioned first aspect or any optional implementation manner of the first aspect, which will not be repeated here.
  • an embodiment of the present application provides an abnormal event detection device, comprising: a processor and a memory, wherein the processor and the memory are interconnected via a line, and the processor calls a program code in the memory to execute the processing-related functions in the abnormal event detection method shown in any one of the first aspects above.
  • the abnormal event detection device can be a chip.
  • an embodiment of the present application provides an abnormal event detection model construction device, which can also be called a digital processing chip or chip.
  • the chip includes a processing unit and a communication interface.
  • the processing unit obtains program instructions through the communication interface, and the program instructions are executed by the processing unit.
  • the processing unit is used to perform functions related to processing as described in the second aspect or any optional embodiment of the second aspect.
  • an embodiment of the present application provides a computer-readable storage medium, including instructions, which, when executed on a computer, enables the computer to execute a method in any optional implementation of the first aspect or the second aspect above.
  • an embodiment of the present application provides a computer program product comprising instructions, which, when executed on a computer, enables the computer to execute a method in any optional implementation of the first aspect or the second aspect.
  • FIG1 is a schematic diagram of a system architecture provided by the present application.
  • FIG2 is a schematic diagram of another system architecture provided by the present application.
  • FIG3 is a schematic diagram of another system architecture provided by the present application.
  • FIG4 is a flow chart of a method for constructing an abnormal event detection model provided by the present application.
  • FIG5 is a schematic diagram of the structure of an attribute heterogeneity graph provided by the present application.
  • FIG6 is a schematic diagram of the structure of another attribute heterogeneity graph provided by the present application.
  • FIG7 is a schematic diagram of a structure of star-structured data provided by the present application.
  • FIG8 is a flow chart of an abnormal event detection method provided by the present application.
  • FIG9 is a schematic diagram of another system architecture provided by the present application.
  • FIG10 is a flow chart of another abnormal event detection model construction method provided by the present application.
  • FIG11 is a flow chart of another abnormal event detection method provided by the present application.
  • FIG12 is a schematic diagram of the structure of a common event detection model building device provided by the present application.
  • FIG13 is a schematic diagram of the structure of an abnormal event detection device provided by the present application.
  • FIG14 is a schematic diagram of the structure of another common event detection model building device provided by the present application.
  • FIG15 is a schematic diagram of the structure of another abnormal event detection device provided by the present application.
  • FIG16 is a schematic diagram of the structure of a chip provided in the present application.
  • each user's behavior will be associated with some entities or generate some data.
  • a user's behavior or the data generated by the behavior can be regarded as an event.
  • an event may include event element nodes with multiple attributes, and there may be complex interactions between nodes, thus forming an attributed heterogeneous information network (AHIN).
  • AHIN attributed heterogeneous information network
  • neural networks can be used to detect abnormal events.
  • the input data includes a set of events, each of which is composed of category attributes.
  • the model first passes the input through the embedding lookup layer to obtain the representation of each category attribute, then models the pairwise interaction scores between attributes, and finally weights all scores according to the interaction category to obtain the abnormality score of the entire event.
  • the interaction score is in the form of vector dot product, and the higher the score, the more normal the interaction. By weighted summing the scores, the model can automatically learn the importance of different types of node interactions.
  • noise-contrastive estimation is used, that is, not all possible event scores are calculated, but approximated by sampling noise events.
  • noise events a context-dependent noise event construction method is proposed, that is, for each event, a noise event is obtained by replacing another entity of the same type.
  • this detection method is only suitable for simple category event anomaly detection (i.e., the representation of each event element is just a simple attribute such as a value), and only models The pairwise interactions between entities are far from sufficient to model the rich attributes and large number of complex interactions of different types of entities in attribute heterogeneous graphs.
  • the second-order neighbor information of entities based on meta-path in heterogeneous graphs can be integrated on the basis of modeling the pairwise interaction patterns between event entities.
  • Abnormal events are detected by combining attribute and structural anomalies. Its input is a set of events, each of which is represented by a meta-path in a heterogeneous graph.
  • the model first linearly transforms the attribute features of the entity to obtain the representation of each entity, and then reconstructs the second-order neighbor matrix of each entity using an autoencoder to obtain the intermediate representation of the autoencoder, and then concatenates this intermediate representation with the entity representation to obtain the final representation of the entity.
  • the autoencoder models structural anomalies, and the intermediate representation of the autoencoder is different for abnormal structures and normal structures.
  • the pairwise interaction between entities is modeled by vector dot multiplication, and finally the pairwise interaction scores are weighted summed to obtain the final abnormal event score.
  • the model uses the method of replacing one entity in the event to obtain abnormal events, and the loss function includes autoencoder reconstruction loss, event score loss and regularization loss. By minimizing the loss function to maximize the score of normal events, a normal event will have a higher score, while an abnormal event will have a lower score.
  • this detection method defines abnormal events as meta-path instances in heterogeneous graphs, but heterogeneous graphs contain more complex events (such as network pattern instances), which may be more common in users' lives. Detecting only abnormal events based on meta-paths cannot be extended to detecting richer events. Moreover, this scheme only models the pairwise interaction anomalies between entities, which is far from enough for modeling complex interactions in heterogeneous graphs. At the same time, the method of reconstructing global high-order neighbors is difficult to extend to dense large-scale graphs, and cannot fully utilize the local structural information of heterogeneous graphs.
  • AHIN How to model complex event patterns in AHIN.
  • Events in AHIN contain different types of rich attribute nodes, which constitute a complete semantic unit.
  • the interactions between these nodes are more complex.
  • the event of publishing a paper is associated with many types of attribute nodes, so that the interactions between nodes are not limited to structural interactions (e.g., authors write papers), but meaningful semantic interactions (e.g., authors specializing in data mining collaborate with radiologists to write text processing papers). Therefore, in addition to simple pairwise interaction anomaly patterns, there are more complex and diverse anomaly patterns in AHIN.
  • the present application proposes a general framework to model events in AHIN and fully consider various anomaly patterns.
  • the method provided in this application performs abnormal event detection in an unsupervised manner, that is, this application has no prior knowledge of abnormal events.
  • the training set set in this application includes abnormal events. That is, the abnormal event detection model must derive normal patterns from AHIN containing abnormal events without any supervision. Therefore, the key to abnormal event detection in AHIN is to make full use of valuable information in existing samples.
  • some existing methods can directly model the normal patterns between nodes and their context nodes. However, this method is not enough to fully capture the complex event interaction patterns in AHIN, nor is it enough to measure the degree of abnormality in an unsupervised manner. An appropriate abnormal event scoring function is required, which should be able to truly reflect the degree of abnormality of the event.
  • the present application provides a method for constructing an abnormal event model based on contrastive learning and an abnormal event detection method.
  • the abnormal event detection model can be constructed based on AHIN and contrastive learning, more complex events can be detected, abnormal events can be accurately identified, and it can be applied to a variety of scenarios with very strong generalization ability.
  • AI artificial intelligence
  • AI is a theory, method, technology and application system that uses digital computers or machines controlled by digital computers to simulate, extend and expand human intelligence, perceive the environment, acquire knowledge and use knowledge to obtain the best results.
  • artificial intelligence is a branch of computer science that attempts to understand the essence of intelligence and produce a new intelligent machine that can respond in a similar way to human intelligence.
  • Artificial intelligence is to study the design principles and implementation methods of various intelligent machines so that the machines have the functions of perception, reasoning and decision-making.
  • Research in the field of artificial intelligence includes robotics, natural language processing, computer vision, decision-making and reasoning, human-computer interaction, recommendation and search, basic AI theory, etc.
  • the "intelligent information chain” reflects the process from data acquisition to processing.
  • a series of processes For example, it can be a general process of intelligent information perception, intelligent information representation and formation, intelligent reasoning, intelligent decision-making, intelligent execution and output.
  • data undergoes the condensation process of "data-information-knowledge-wisdom”.
  • the "IT value chain” reflects the value that artificial intelligence brings to the information technology industry from the underlying infrastructure of human intelligence, information (providing and processing technology implementation) to the industrial ecological process of the system.
  • the infrastructure provides computing power support for the artificial intelligence system, enables communication with the outside world, and is supported by the basic platform. It communicates with the outside world through sensors; computing power is provided by smart chips (CPU, NPU, GPU, ASIC, FPGA and other hardware acceleration chips); the basic platform includes distributed computing frameworks and networks and other related platform guarantees and support, which can include cloud storage and computing, interconnected networks, etc. For example, sensors communicate with the outside world to obtain data, and these data are provided to the smart chips in the distributed computing system provided by the basic platform for calculation.
  • smart chips CPU, NPU, GPU, ASIC, FPGA and other hardware acceleration chips
  • the basic platform includes distributed computing frameworks and networks and other related platform guarantees and support, which can include cloud storage and computing, interconnected networks, etc.
  • sensors communicate with the outside world to obtain data, and these data are provided to the smart chips in the distributed computing system provided by the basic platform for calculation.
  • the data on the upper layer of the infrastructure is used to represent the data sources in the field of artificial intelligence.
  • the data involves graphics, images, voice, text, and IoT data of traditional devices, including business data of existing systems and perception data such as force, displacement, liquid level, temperature, and humidity.
  • Data processing usually includes data training, machine learning, deep learning, search, reasoning, decision-making and other methods.
  • machine learning and deep learning can symbolize and formalize data for intelligent information modeling, extraction, preprocessing, and training.
  • Reasoning refers to the process of simulating human intelligent reasoning in computers or intelligent systems, using formalized information to perform machine thinking and solve problems based on reasoning control strategies. Typical functions are search and matching.
  • Decision-making refers to the process of making decisions after intelligent information is reasoned, usually providing functions such as classification, sorting, and prediction.
  • some general capabilities can be further formed based on the results of the data processing, such as an algorithm or a general system, for example, translation, text analysis, computer vision processing, speech recognition, image recognition, etc.
  • Smart products and industry applications refer to the products and applications of artificial intelligence systems in various fields. They are the encapsulation of the overall artificial intelligence solution, which productizes intelligent information decision-making and realizes practical applications. Its application areas mainly include: smart terminals, smart transportation, smart medical care, autonomous driving, smart cities, etc.
  • Machine learning Build a statistical model, use optimization methods to fit model parameters on sample data, and make predictions on new sample data.
  • a machine learning task usually includes a training part and a prediction part.
  • the parameters of the statistical model can be used to predict the training sample data, and the update direction of the parameters of the statistical model is calculated based on the prediction error. The process is repeated until the parameters converge.
  • the trained model can be used to predict new samples.
  • Contrastive learning is a type of self-supervised learning. Positive and negative samples can be compared in feature space to learn the features of the samples. Using this method, machine learning models can be trained to distinguish between similar and different data sample images. The internal workings of contrastive learning can be expressed as a score function, which is a measure of the similarity between two features.
  • the loss function can usually include mean square error, cross entropy, logarithm, exponential loss functions, etc.
  • the error back propagation algorithm can be used to correct the size of the parameters in the initial network model during the training process, so that the reconstruction error loss of the model becomes smaller and smaller. Specifically, the forward transmission of the input signal to the output will generate error loss, and the error loss information is back-propagated to update the parameters in the initial model, so that the error loss converges.
  • the back propagation algorithm is a back propagation movement dominated by error loss, aiming to obtain the optimal model parameters, such as the weight matrix.
  • the method provided in the present application can be applied to a variety of abnormal event detection scenarios.
  • the abnormal event model construction method provided in the present application can be deployed on a server, such as a cloud server or a local server, and the constructed abnormal event detection model can be deployed on the client or on the cloud.
  • the abnormal event detection model When the abnormal event detection model is deployed on the client, the user can directly request abnormal event detection on the client, and the client can obtain the data generated by the user behavior to perform abnormal event detection.
  • the abnormal event detection model is deployed on the cloud, the user can request the cloud to perform abnormal event detection through the client, and the cloud obtains the data generated by the user behavior to perform abnormal event detection.
  • the recommendation method provided in the embodiment of the present application can be executed on a server or on a terminal device.
  • the terminal device can be a mobile phone with image processing function, a tablet personal computer (TPC), a media player, a smart TV, a laptop computer (LC), a personal digital assistant (PDA), a personal computer (PC), a camera, a video camera, a smart watch, a wearable device (WD) or an autonomous driving vehicle, etc., and the embodiment of the present application does not limit this.
  • an embodiment of the present application provides a system architecture 200 .
  • a data acquisition device 260 can be used to collect training data.
  • the training data is stored in a database 230 , and the training device 220 trains the abnormal event detection model 201 based on the training data maintained in the database 230 .
  • the training device 220 obtains the abnormal event detection model 201 based on the training data.
  • the training device 220 constructs the abnormal event detection model based on the attribute heterogeneity graph, and updates the parameters of the abnormal event detection model through comparative learning, thereby completing the training of the abnormal event detection model 201.
  • the training method see the training method below.
  • the abnormal event detection model 201 in the embodiment of the present application can specifically be a neural network. It should be noted that in actual applications, the training data maintained in the database 230 does not necessarily all come from the collection of the data acquisition device 260, and may also be received from other devices. It should also be noted that the training device 220 does not necessarily train the abnormal event detection model 201 based entirely on the training data maintained by the database 230, and may also obtain training data from the cloud or other places for model training. The above description should not be used as a limitation on the embodiments of the present application.
  • the abnormal event detection model 201 obtained by training the training device 220 can be applied to different systems or devices, such as the execution device 210 shown in FIG1 .
  • the execution device 210 can be a terminal, such as a mobile phone terminal, a tablet computer, a laptop computer, augmented reality (AR)/virtual reality (VR), a vehicle terminal, a television, etc., and can also be a server or a cloud.
  • the execution device 210 is configured with a transceiver 212, which can include an input/output (I/O) interface or other wireless or wired communication interfaces, etc., for data interaction with external devices. Taking the I/O interface as an example, a user can input data to the I/O interface through the client device 240.
  • I/O input/output
  • the execution device 210 When the execution device 210 preprocesses the input data, or when the computing module 211 of the execution device 210 performs calculations and other related processing, the execution device 210 can call the data, code, etc. in the data storage system 250 for corresponding processing, and can also store the data, instructions, etc. obtained from the corresponding processing into the data storage system 250.
  • the I/O interface returns the processing result to the client device 240 for providing to the user.
  • the training device 220 can generate a corresponding abnormal event detection model 201 based on different training data for different goals or different tasks.
  • the corresponding abnormal event detection model 201 can be used to achieve the above goals or complete the above tasks, thereby providing the user with the desired results.
  • the user can manually input the data, which can be operated through the interface provided by the transceiver 212.
  • the client device 240 can automatically send the input data to the transceiver 212. If the client device 240 is required to automatically send the input data, the user can set the corresponding permissions in the client device 240.
  • the user can The device 240 checks the result output by the execution device 210, and the specific presentation form can be a specific method such as display, sound, action, etc.
  • the client device 240 can also be used as a data collection terminal to collect the input data of the input transceiver 212 and the output result of the output transceiver 212 as shown in the figure as new sample data, and store them in the database 230.
  • FIG1 is only a schematic diagram of a system architecture provided in an embodiment of the present application.
  • the positional relationship between the devices, components, modules, etc. shown in the figure does not constitute any limitation.
  • the data storage system 250 is an external memory relative to the execution device 210. In other cases, the data storage system 250 can also be placed in the execution device 210.
  • the system architecture of the application of the abnormal event detection model construction method provided by the present application can be shown in Figure 2.
  • the server cluster 310 is implemented by one or more servers, and optionally, cooperates with other computing devices, such as data storage, routers, load balancers and other devices.
  • the server cluster 310 can use the data in the data storage system 250, or call the program code in the data storage system 250 to implement the steps of the abnormal event detection model construction method provided by the present application.
  • Each local device can represent any computing device, such as a personal computer, a computer workstation, a smart phone, a tablet computer, a smart camera, a smart car or other type of cellular phone, a media consumption device, a wearable device, a set-top box, a game console, etc.
  • the local device of each user can interact with the server cluster 310 through a communication network of any communication mechanism/communication standard, and the communication network can be a wide area network, a local area network, a point-to-point connection, or any combination thereof.
  • the communication network may include a wireless network, a wired network, or a combination of a wireless network and a wired network.
  • the wireless network includes, but is not limited to: a fifth-generation mobile communication technology (5th-Generation, 5G) system, a long-term evolution (long term evolution, LTE) system, a global system for mobile communication (global system for mobile communication, GSM) or a code division multiple access (code division multiple access, CDMA) network, a wideband code division multiple access (wideband code division multiple access, WCDMA) network, wireless fidelity (wireless fidelity, WiFi), Bluetooth (bluetooth), Zigbee protocol (Zigbee), radio frequency identification technology (radio frequency identification, RFID), long-range (Lora) wireless communication, and near-field wireless communication (NFC) Any one or more combinations.
  • the wired network may include an optical fiber communication network or a network composed of coaxial cables, etc.
  • one or more aspects of the execution device 210 may be implemented by each local device.
  • the local device 301 may provide local data or feedback calculation results to the execution device 210 .
  • the local device 301 implements the functions of the execution device 210 and provides services to its own user, or provides services to the user of the local device 302.
  • the application scenario of the method provided in this application can be seen in FIG3 .
  • An abnormal event detection model can be built and trained in the server, and the trained abnormal event detection model can be sent and deployed on the client.
  • the user can enter an abnormal event detection request in the client, that is, request the client to detect the data generated by the user behavior to identify whether there is an abnormal event.
  • the client can read data related to user behavior, such as reading data generated by user behavior uploaded by the user terminal, reading user log data stored in the server, or reading data generated by user behavior stored by itself, etc., and construct an attribute heterogeneity graph for the read data, so as to represent the entities involved in the user behavior and the association relationship between entities through the attribute heterogeneity graph, wherein the user-related entities or other associated information in the generated events can be used as event elements, and the attribute heterogeneity graph is used as the input of the abnormal event detection model to detect abnormal events, and output the detected abnormal events.
  • user behavior such as reading data generated by user behavior uploaded by the user terminal, reading user log data stored in the server, or reading data generated by user behavior stored by itself, etc.
  • the abnormal event of user cashing out can be detected; in the task of detecting the water army on the social platform, the event of malicious comments by the water army can be detected; in the task of detecting contraband, the malicious event of sellers selling contraband can be detected, etc.
  • events can be used to describe users and user-related operations (such as transferring money, logging into devices, etc.), indicating a user's financial transaction behavior.
  • the method provided by this application can be used to model this abnormal event pattern, that is, to build an abnormal event detection model. For example, a user logs in to a computer that the user does not log in frequently, or makes an unusual large transaction, which may be an abnormal event.
  • the abnormality score of such events is relatively high.
  • Another example is the task of detecting water army on social platforms.
  • social platforms are full of water army, that is, users who make profits by posting malicious comments to mislead buyers.
  • an event can be defined as a user posting a comment.
  • the associated elements include user, comment, Social platforms, etc.
  • the method provided by the present application can construct an attribute heterogeneous graph using the relationships in the social network, thereby deeply mining abnormal patterns in the attribute heterogeneous graph and better helping to detect water army.
  • contraband detection task usually in e-commerce platforms, merchants will illegally sell some contraband for profit, such as selling wild protected animals or banned drugs.
  • Merchants can define product listing events, and other elements can also include users, etc., to form an attribute heterogeneous graph.
  • complex abnormal buying and selling patterns can be captured, thereby detecting abnormal buying and selling events and improving the accuracy of contraband detection.
  • the steps of the method provided in the present application can be divided into a training part and a reasoning part, wherein the training part is to construct and train an abnormal event detection model, and in the reasoning part, abnormal events can be detected by the abnormal event detection model obtained in the training part.
  • the training part is the abnormal event detection model construction method provided by the present application
  • the reasoning part is the abnormal event detection method provided by the present application.
  • FIG4 is a flowchart of a method for building an abnormal event detection model provided in the present application.
  • the attribute heterogeneity graph may include data corresponding to multiple events, that is, it can be used to represent multiple events.
  • the attribute heterogeneity graph may include multiple nodes and associations between the multiple nodes.
  • Each event includes at least two nodes and associations between the at least two nodes.
  • Each node in each event may include information of an event element that forms the event.
  • the attribute heterogeneity graph used in the training part is called the second attribute heterogeneity graph.
  • the data of multiple events may include data generated by user behavior, and the data generated by each behavior can be called the data of an event.
  • the data generated by a user's financial transaction, an operation such as transfer, login or transaction can be called an event, and the nodes in the event can include the user, transfer operation, amount, etc.
  • the data generated by a user's comment, an event can be defined as a user posting a comment, and the nodes in the event can include information such as the user, comment content, comment platform, etc.
  • the data generated by a user's purchase of items, such as a purchase or additional purchase can be defined as an event, and the nodes in the event can include the user, the purchased or additional items, the additional purchase or purchase time, quantity, etc.
  • each node of each event in the second attribute heterogeneity graph can be mapped to the same space to obtain a data representation of the node of each event in the same space.
  • the data representation of the training part is referred to as the first data representation. Therefore, in the implementation of the present application, before modeling, the input data can be mapped to the same space to unify the data dimension so that subsequent modeling can be performed based on data of the same dimension, thereby improving modeling efficiency.
  • an attribute heterogeneous graph is defined as Include node collection and an edge set ⁇ , each edge in the edge set can be used to represent the association relationship between nodes.
  • the attribute heterogeneous graph can also include an attribute matrix X ⁇ R
  • An attribute heterogeneous graph is also associated with a node type mapping function ⁇ : and an edge type mapping function association, and Represents a predefined set of node and edge types, satisfying FIG5 shows an example of an AHIN of a citation network. It consists of three types of attribute nodes (i.e., author, paper, and conference) and their rich interactions (e.g., author writes a paper).
  • the attribute heterogeneity graph may include multiple events, and each event may include nodes of multiple attribute types, i.e., author, paper, and conference, as well as interactions between nodes, such as an author writing a paper as an edge.
  • the network model (as shown in FIG6) specifies the type constraints of a set of nodes and their relationships.
  • a star-shaped model network is a commonly used network structure. Under the guidance of the star network model, a model instance can be extracted from AHIN.
  • the data structure of the data required for input can refer to the data structure shown in FIG6, that is, each event can determine a central node, and the remaining nodes can be represented as nodes corresponding to the contextual semantics.
  • FIG7 shows an example of an event, showing that a star-shaped model instance forms a complete semantic unit (i.e., publishing a paper). Therefore, the present application can use a star-shaped model instance to represent events in AHIN.
  • comparative learning can be performed based on the nodes and associations of each event included in the second attribute heterogeneity graph to construct an abnormal event detection model for abnormal event detection.
  • the abnormal event detection model can identify abnormal events based on the similarity between nodes within an event or the similarity between events.
  • an abnormal event detection model can be constructed based on the attribute heterogeneity graph.
  • the attribute heterogeneity graph can represent complex events, so the method provided by the present application can model more complex events, and can also perform abnormal identification for complex events, accurately identify abnormal events, and can adapt to a variety of application scenarios with strong generalization ability.
  • an initial model may be constructed first, and then the second attribute heterogeneity graph may be used for comparative learning to obtain a trained abnormal event detection model.
  • the abnormal event detection model includes one or more of the following modules: a node pair comparison module, a multivariate interaction module or an event comparison module, etc.
  • the node comparison module can be used to obtain the similarity between nodes within an event
  • the multivariate interaction module can be used to cluster the nodes in the event and obtain the similarity between the nodes within the event and the event category
  • the event comparison module can be used to obtain the similarity between events.
  • the multiple nodes in each event can be combined into at least one node pair, such as combining every two nodes into a node pair.
  • the similarity between each pair of node pairs can be obtained through the node pair comparison module, which is called the first similarity for the convenience of distinction.
  • the first similarity can be used to measure the degree of abnormality of the event. For example, the higher the similarity, the lower the degree of abnormality of the event, and the lower the similarity, the higher the degree of abnormality of the event.
  • the pairwise comparison loss value of each pair of node pairs is obtained according to the similarity of each pair of node pairs, and the abnormal event detection model is updated based on the pairwise comparison loss value of each pair of node pairs to obtain an updated abnormal event detection model.
  • the method of calculating the pairwise contrast loss value corresponding to each node may include: taking the calculation method of any node as an example, in order to facilitate the distinction of the first node, a positive sample node set of the first node is selected from multiple nodes, and a negative sample node set is constructed, such as selecting nodes in other events to join the negative sample node set.
  • the first similarity between the nodes in the positive sample node set and the first node is higher than the first similarity between the nodes in the negative sample node set and the first node; the pairwise contrast loss value of the first node is calculated by the first similarity between the first node and the nodes in the positive sample node set, and the similarity between the first node and the nodes in the negative sample node set.
  • a positive sample node set and a negative sample node set can be constructed for each node, such as taking a node with high similarity to each node as a positive sample node, and a node with low similarity to each node as a negative sample of each node, thereby realizing contrast learning through the positive sample node and the negative sample node of each node, and realizing unsupervised learning.
  • the pairwise contrast losses of multiple node pairs in multiple events can be fused to obtain a loss value for the overall model output, which is called the first loss value for easy distinction.
  • the first loss value is used to reversely update the abnormal event detection model to obtain an updated abnormal event detection model.
  • the similarity between the negative sample of the node and the node is too high.
  • This kind of negative sample is usually called a difficult sample. Difficult samples will greatly increase the difficulty of identifying abnormal events, such as the situation where the negative sample node may be classified as a positive sample node set.
  • the present application can set a temperature coefficient to adjust the attention paid to difficult samples. That is, when calculating the paired contrast loss, the temperature coefficient can be combined for calculation, so as to further reduce the influence of difficult samples on the loss value. For example, when calculating the paired contrast loss value, the similarity can be divided by the temperature coefficient. Generally, the smaller the temperature coefficient, the more attention is paid to distinguishing the current sample from similar negative samples, thereby improving the accuracy of identifying abnormal events.
  • the abnormal event detection model may include a module for determining abnormal conditions between nodes in an event.
  • the loss value may be calculated based on the output result of the node pair comparison module, thereby learning abnormal node pairs in the event, so that the model can identify abnormal conditions between nodes in the event, thereby accurately identifying abnormal events.
  • the corresponding training process may include:
  • the identifier node can be obtained through the multivariate interaction module, and the similarity between one or more nodes in the event and the identifier can be obtained, which is called the second similarity for easy distinction. Then, the corresponding loss value can be calculated based on the second similarity, which is called the second loss value for easy distinction. Then, the abnormal event detection model is reversely updated based on the second loss value to obtain an updated abnormal event detection model.
  • the central node of each event can be used as the identifier node, or multiple nodes of each event can be fused to obtain an identifier node, such as clustering the nodes in each event to obtain at least one category, and selecting a node in one of the categories as the identifier node.
  • Identifier nodes such as the cluster center or the node closest to the center, are used as identifier nodes; then the similarity between each node in the event and the identifier node is calculated, and the similarity can be used to indicate the abnormality of each node. The higher the similarity, the lower the abnormality of the event. If the similarity is lower, the abnormality of the event is higher. Then the loss value corresponding to each node can be calculated based on the similarity, and the event detection model is reversely updated based on the loss value to obtain an updated abnormal event detection model.
  • the present application can construct negative samples, so as to perform contrastive learning based on positive samples and constructed negative samples.
  • the method of calculating the second loss value can include, taking any event (referred to as the first event for ease of understanding) as an example, replacing the first node in the first event with a second node, the second node has the same attributes as the first node but is in a different cluster (or is called a different category), thereby forming a negative sample; calculating the similarity between the second node and the identifier, which is referred to as the third similarity for ease of distinction, and calculating the loss value based on the second similarity and the third similarity to obtain a second loss value.
  • negative samples can be constructed by replacing the same type but different clusters to calculate the loss value between positive samples and negative samples, and the abnormal event detection model can be updated according to the loss value, thereby realizing contrastive learning.
  • This is equivalent to realizing contrastive learning by constructing negative samples to obtain an updated abnormal event detection model, thereby realizing unsupervised learning.
  • the multivariate interaction module can use a scoring function to calculate the third similarity.
  • a scoring function can be used to construct a model based on the similarity between the identifier node and the context node, in which a first linear transformation layer is set.
  • the parameters of the first linear transformation layer also need to be updated, so that the similarity value output by the multivariate interaction module is more accurate.
  • the event comparison module can be used to output the similarity between events. Specifically, in the embodiment of the present application, the event comparison module can be used to screen the positive sample set corresponding to each event and output the similarity between the positive samples corresponding to each event.
  • the training process of the event comparison module may specifically include:
  • the positive sample set and negative sample set corresponding to each event are screened out, and then the loss value is calculated according to the fourth similarity between each event and the events in the corresponding positive sample set and the fifth similarity between the event and the events in the corresponding negative sample set, which is called the third loss value for easy distinction; then the abnormal event detection model is reversely updated according to the third loss value to obtain an updated event detection model. Therefore, in the implementation of the present application, unsupervised learning can be achieved by constructing a positive sample set and a negative sample set for each event for comparative learning.
  • the method of screening the positive sample set and the negative sample set may specifically include: calculating the number of shared nodes between events, and screening the positive sample set and the negative sample set corresponding to each event from multiple events according to the number of shared nodes.
  • the method of screening the positive sample set and the negative sample set may specifically include: calculating the number of shared nodes between events, and screening the positive sample set and the negative sample set corresponding to each event from multiple events according to the number of shared nodes.
  • the second event at least one event whose number of shared nodes with the second event is greater than a first threshold is obtained to obtain a positive sample set, and the second event is any event among the multiple events; at least one event whose number of shared nodes with the second event is not greater than the first threshold is obtained to obtain a negative sample set.
  • calculating the similarity between events may include multiple methods, such as extracting features of the events, calculating the similarity between the features, and using the similarity between the features as the similarity between the events.
  • positive samples and negative samples can also be screened by the similarity between events, such as taking events whose similarity with the second event is higher than a second threshold as positive samples to obtain a positive sample set, and taking events whose similarity with the second event is not higher than the second threshold as a negative sample set, etc.
  • the similarity between events can also be measured by the number of shared nodes between events.
  • the fourth similarity can be positively correlated with the number of shared nodes, that is, the more shared nodes there are, the higher the similarity between events.
  • the specific method of calculating the third loss value can be expressed as follows: taking the second event as an example, the similarity between the second event and the samples in the positive sample set can be output through the event comparison module, which is called the fourth similarity for easy distinction.
  • a second linear transformation layer can be set in the event comparison module, and the similarity between the second event and the samples in the positive sample set is output through the second linear transformation layer.
  • the loss value is then calculated based on the fourth similarity and the fifth similarity to obtain the third loss value.
  • the first linear transformation layer and the second linear transformation layer may be updated.
  • the first linear transformation layer can be set and trained separately, or the second linear transformation layer can be used to output the similarity between the second event and the samples in the negative sample set.
  • the specific adjustment can be made according to the actual application scenario.
  • a positive sample set and a negative sample set corresponding to each event can be constructed, so as to perform comparative learning through the positive sample set and the negative sample set corresponding to each event to achieve unsupervised learning, so that the abnormal event detection model can combine the similarity between events to accurately identify whether an event is abnormal.
  • the reasoning part provided by this application can be deployed in the cloud, local server or local client, that is, the abnormal event detection method provided by this application can be implemented by the cloud, local server or local client.
  • the user can interact with the cloud through the local client.
  • the user interacts with the client as an example for exemplary introduction.
  • a flow chart of an abnormal event detection method provided by the present application is as follows.
  • the attribute heterogeneity graph may include multiple nodes and associations between the multiple nodes.
  • the attribute heterogeneity graph may be used to represent at least one event, and each event may include at least two nodes and associations between the at least two nodes.
  • Each node in each event may include information forming an event element of the event.
  • it is called the first attribute heterogeneity graph, which may be the same as or different from the aforementioned second attribute heterogeneity graph.
  • the user can request abnormal event detection through the client.
  • the cloud can provide a server for the user through the client. After the user requests abnormal event detection on the client, the client sends the request to the cloud. After receiving the user request, the cloud can read the user's relevant data from the local based on the user request, or request the user's relevant data from the server, terminal or other device that stores the user data.
  • the cloud can generate an attribute heterogeneity graph based on the received data, which can be called the first attribute heterogeneity graph for ease of distinction.
  • user-related data may include data related to the user's financial operations.
  • the cloud After the cloud receives an abnormal event detection request initiated by the user or merchant, it can request data from the device that stores the user data. After the cloud receives data sent by other devices, an attribute heterogeneity graph and a corresponding event set can be generated based on the received data.
  • the attribute heterogeneity graph may include multiple types of nodes, such as user, operation type, transaction amount, operation time, login device or login time nodes, and the event set includes specific user information, operation type, transaction amount, operation time, login device or login time information.
  • There is a mapping relationship between the event set and the nodes in the attribute heterogeneity graph so that the data generated by the user's financial operation behavior is represented by the attribute heterogeneity graph, the event set and the mapping relationship.
  • the cloud can also automatically generate a request for abnormal event detection for one or more users, and request data from a device that stores the data of the one or more users.
  • the cloud can generate an attribute heterogeneity graph and a corresponding event set based on the received data.
  • the attribute heterogeneity graph includes multiple types of nodes, and the attribute heterogeneity graph has a mapping relationship with the events in the event set.
  • a water army detection task can be performed on social platforms.
  • social platforms are full of water armies, which mislead users by posting malicious comments. Therefore, a social platform can initiate an abnormal event detection request.
  • the cloud can collect comments posted by multiple users on the social platform and generate an attribute heterogeneity graph.
  • the attribute heterogeneity graph can include multiple nodes, such as users, posting time, login devices, or comment content, etc. as nodes; accordingly, the information of one or more users, the time of posting comments, the information of login devices, or the content of comments, etc. are collected to obtain an event set.
  • the event data in the event set can be mapped to the attribute heterogeneity graph, thereby mapping the specific information of the event to each node. This is equivalent to mapping the specific data of each event to the same space, unifying the dimensions of each event, and obtaining the data representation of each event in the same distribution, so that abnormal events can be identified based on the data in the same space in the future.
  • the attribute heterogeneity graph and the corresponding specific data of each event represented can be used as the input of the abnormal event detection model to obtain the output result, which can be used to indicate whether each event in the input data is abnormal.
  • abnormal events can be determined by the similarity between events calculated by the abnormal event detection model or the similarity between nodes in the event.
  • the abnormal event detection model may specifically include the abnormal event detection model learned through the steps corresponding to the aforementioned FIG. 4 , and the training process will not be described in detail herein.
  • the abnormal event detection model provided by the present application can detect whether an event is abnormal by the similarity between events or the similarity between nodes within an event, so as to accurately identify abnormal events. Even in the case of complex events, such as a large number of nodes or a large number of events, abnormal events can be accurately identified, and the generalization ability is strong.
  • the abnormal event detection model may include: at least one of a node pair comparison module, a multivariate interaction module, or an event comparison module.
  • the node comparison module may be used to obtain the similarity between nodes in an event
  • the multivariate interaction module is used to obtain the similarity between nodes in an event and event categories
  • the event comparison module is used to obtain the similarity between events.
  • the abnormality degree of each event can be output by the node pair comparison module.
  • the abnormality degree output by the node pair comparison module is called the first abnormality degree.
  • the node pair comparison module can be used to calculate the similarity between the node pairs in each event, and the first abnormality degree is calculated based on the similarity between the node pairs.
  • the first abnormality degree can be calculated based on the similarity between one or more pairs of nodes with the lowest similarity in the event.
  • the similarity with the lowest value can be directly used as the value of the first abnormality degree, or the first abnormality degree can be obtained by weighted fusion of multiple nodes with the lowest similarity in the event.
  • the degree of abnormality of an event can be represented by the similarity between nodes. Therefore, whether an event is abnormal can be identified from the similarity between nodes within the event.
  • the abnormality degree of each event can be output through the multivariate interaction module.
  • the abnormality degree output by the multivariate interaction module is called the second abnormality degree.
  • the multivariate interaction module can be used to fuse multiple nodes in each event to obtain an identifier node, and other nodes in the event can be called context nodes.
  • the abnormality degree of the event is measured by the similarity between each node and the identifier node to obtain the first abnormality degree. For example, the higher the similarity, the lower the abnormality degree, and the lower the similarity, the higher the abnormality degree.
  • the multivariate interaction module may cluster multiple nodes in each event, classify the multiple nodes into one or more categories, and then determine a cluster center from the one or more categories as an identifier node.
  • the multivariate interaction module can calculate the degree of abnormality of an event by using a scoring function to calculate the similarity or compatibility between the identifier node and the context node.
  • a scoring function can be used to construct a model for calculating the degree of abnormality based on the identifier node and the context node.
  • the multivariate interaction module can calculate the degree of abnormality by identifying the similarity between the context node and the identification node, so that whether the event is abnormal can be measured from the dimension of the similarity between the node and the category, and abnormal events can be accurately identified.
  • the event comparison module can output the abnormality degree of the event by comparing the similarities between events, which is called the third abnormality degree for easy distinction.
  • the event comparison module can be used to filter out the positive sample sets corresponding to each event from multiple events, and output the third abnormality degree corresponding to each event according to the similarity between each event and the events in the corresponding positive sample set.
  • the method of filtering out the positive sample set corresponding to each event from multiple events can specifically include: filtering out the events whose number of shared nodes with the current event is greater than a first threshold from the multiple events as positive samples with the current event, to obtain the positive sample set.
  • the event comparison module may calculate the degree of abnormality by performing semantic recognition on each event to obtain a representation of each event, and then calculating the similarity between each event and the events in the positive sample set based on the representation of each event, and calculating based on the similarity.
  • a scoring function can be used to calculate the third abnormality degree, such as a bilinear scoring function can be used to calculate the third abnormality degree of each event.
  • the third abnormality level For example, a second linear transformation layer can be set in the event comparison module to calculate the abnormality level based on a bilinear function. When the abnormal event detection model is reversely updated, the parameters of the second linear transformation layer also need to be updated to make the similarity value output by the multivariate interaction module more accurate.
  • the abnormal degree of the event output by the set module can be used as the output result. If at least two modules in the pair comparison module, the multivariate interaction module or the event comparison module are set in the abnormal event detection model, the abnormal degree output by the at least two modules can be fused to obtain the abnormal degree of each event after fusion, which is called the fourth abnormal degree for the convenience of distinction, and each event is judged to be an abnormal event according to the fourth abnormal degree of each event to obtain the final output result.
  • the type and number of modules set in the abnormal event detection model can be selected according to the actual application scenario, and this application does not limit this.
  • the first abnormal degree, the second abnormal degree and the third abnormal degree of each event can be mechanically weighted and fused to obtain the fourth abnormal degree, and each event can be judged to be an abnormal event according to the fourth abnormal degree of each event, such as identifying an event with a fourth abnormal degree higher than a preset value as an abnormal event, to obtain the output result.
  • whether an event is abnormal can be identified by combining the similarity between nodes within the event, the similarity between nodes within the event and the identifier node, or the similarity between events. Therefore, even if the event is complex, such as each event has multiple nodes or nodes have multiple attributes, the abnormal event detection model provided by the present application can accurately identify the abnormal event, which has a very strong generalization ability.
  • the present application provides a new abnormal event detection framework (such as can be called AEHCL), that is, an abnormal event detection model based on hypergraph contrastive learning.
  • AEHCL a new abnormal event detection framework
  • events in AHIN are defined as star pattern instances, and the present application can further use the concept of hyperedges in the hypergraph to simulate complex interactions in events.
  • the present application proposes a new hypergraph contrast learning method to fully capture complex and diverse abnormal patterns.
  • two contrast strategies are provided from the intra-event and inter-event levels.
  • the intra-event contrast module focuses on mining abnormal patterns in events, and the module consists of two sub-modules.
  • the pairwise contrast module captures pairwise interaction abnormal patterns, while the multivariate contrast module captures multivariate high-order interaction abnormal patterns.
  • An event contrast module is also provided to model abnormal patterns between events, that is, situations where abnormal events are inconsistent with their contextual events. These modules are optimized simultaneously in an end-to-end manner and promote each other.
  • a contrast-based abnormal event scoring function is provided to measure the degree of abnormality, which integrates the detection results of the above modules.
  • this application defines events in attribute heterogeneous graphs as network pattern instances and further models them with hypergraphs, so that more complex interactions of abnormal elements in attribute heterogeneous graphs can be mined.
  • the attribute heterogeneity graph can represent multiple events.
  • the nodes included in each event and the association relationship between the nodes can be saved in the event set.
  • Each event in the event set can be represented as a star topology graph.
  • the attribute heterogeneity graph can be defined as a hypergraph.
  • a hypergraph is a generalized graph in which an edge can connect any number of vertices.
  • Each event is uniquely determined by the central node in the set, and the other nodes in the set are the context nodes of the event. For example, in e-commerce fraud detection, an event can be regarded as a transaction, the central node is the transaction device, and the context node is the event element involved in this transaction, such as users and products.
  • node attributes are mapped to the same space and unified in dimension through linear transformation, which is used as the training set for training the abnormal event detection model.
  • the training set is used to train the abnormal event detection model to obtain the trained abnormal event detection model.
  • the trained abnormal event detection model can be deployed in the cloud, server or client.
  • the model can be deployed in the client so that the client can calculate the abnormal event score to indicate the degree of abnormality of the event.
  • the abnormal event detection model constructed in this application can fully capture abnormal patterns in events, including intra-event and inter-event anomalies.
  • the intra-event comparison module can include:
  • Paired comparison that is, for each node, the positive samples are other nodes in the event, and the negative samples are nodes in other events.
  • the positive sample is the aggregated representation of the context nodes in this event, and the negative sample is constructed
  • the nodes are first clustered, and then one or more nodes are selected for replacement with nodes from other clusters.
  • the resulting context set is a negative sample.
  • the event comparison module first defines the neighbor events of an event, that is, the event with the largest number of meta-paths linking the nodes in two events. Then the set of neighbor events is used as the positive sample set, and the events with fewer meta-paths are negative samples.
  • the abnormal event scoring function provided by this application needs to consider more complex abnormal patterns and various abnormalities, so the design is more complex.
  • the abnormal event detection model provided by this application has low computational complexity and high universality, and can be applied to a variety of real-world attribute heterogeneous graph scenarios.
  • the training part can be divided into multiple steps, as shown in Figure 10.
  • the input data for the training part is introduced.
  • Figure 7 above shows an example of an event in a citation network.
  • the central node is the paper node, which uniquely identifies a certain event of publishing a paper, and the context nodes are conferences and authors.
  • the event is further modeled using a hypergraph, and all the nodes involved are studied as a whole.
  • the event of publishing a paper is modeled by a hypergraph, and is thus associated with multiple types of nodes (i.e., papers, authors, and conferences).
  • An event is abnormal if it exhibits a rare interaction pattern.
  • Figure 5 above shows an abnormal collaboration event in a citation network.
  • the event contains the semantics of a data mining expert collaborating with a radiologist to publish a paper, which rarely occurs, so it is considered an anomaly.
  • ⁇ d is the original node feature
  • W (t) ⁇ Rd ⁇ h and b (t) ⁇ R1 ⁇ h are the transformation parameters of the t-type node.
  • ⁇ ( ⁇ ) represents the activation function.
  • the h-dimensional representation of each node is in the same space, and z represents the representation set of the node.
  • the abnormal event detection model includes modules for identifying anomalies within events and identifying anomalies between events, which are introduced below.
  • pairwise similarity is also used in many hypergraph representation learning methods.
  • the basic basis behind it is that the matching degree of paired nodes in an event should be higher than that of other nodes, so incompatible abnormal node pairs can be found based on the similarity between node pairs, that is, node pairs with similarity below a certain value.
  • the normal matching pattern of node pairs can be modeled, and then the node pairs that do not conform to the pattern are considered abnormal. If all pairwise interactions in the event are directly fused to obtain the event anomaly score, the degree of abnormality of the abnormal node pairs may be weakened.
  • sim( ⁇ ) is the cosine similarity matching function, which can also be replaced by other similarity functions, that is, it represents the similarity between nodes, and exp( ⁇ ) is an exponential function with the natural constant e as the base.
  • z i is the representation of node vi .
  • P i and N i are the positive sample set and Negative sample set.
  • the role of the temperature coefficient ⁇ is to adjust the degree of attention to difficult samples: the smaller the temperature coefficient, the more attention is paid to separating the current sample from the most similar other samples. Difficult samples can be understood as negative samples with high similarity to the current sample.
  • the paired comparison module can be reversely updated based on the final paired comparison loss to obtain an updated paired comparison module. If the abnormal event detection model includes multiple modules, the results output by the multiple modules can be used to calculate the overall loss value, and the abnormal event detection model as a whole can be reversely updated to obtain an updated abnormal event detection model.
  • More complex abnormal interactions in events can be identified through the multi-element interaction module provided in this application.
  • an event may be abnormal when interactions with more than two nodes are considered.
  • the present application can use a multivariate comparison module to model such abnormal events.
  • the module captures multivariate interaction patterns in events by modeling the compatibility between identifier nodes and context nodes (i.e., non-identifier nodes in events).
  • Identifier nodes may include nodes fused from multiple nodes in an event, central nodes or clustering centers of an event, etc.
  • context nodes are nodes other than identifier nodes in an event.
  • the compatibility of identifier nodes and context nodes is high, i.e., the similarity is high.
  • the content of a paper is highly correlated with the type of conference in which it is published and the interests of the author.
  • a type embedding ti i.e., an identifier node
  • h i : hi z i + ti
  • Type embedding enables the model to capture the interactions between heterogeneous nodes, thereby capturing more meaningful interaction patterns. Then for the context node set in event e i The above formula can be used to get their expression In order to model the multivariate interactions between the identifier node and the context node and obtain the final context representation c i , this application can use the self-attention mechanism selfatt( ⁇ ) followed by a maximum pooling layer:
  • a bilinear scoring function can be used to model the compatibility between the identifier node and the context node, i.e., the second similarity:
  • hi is the identifier node representation of event e i
  • ⁇ ( ⁇ ) is the sigmoid activation function
  • Wm is the linear transformation layer, that is, the first linear transformation layer mentioned above, which needs to be updated when performing reverse update.
  • the score si of normal events should be close to 1
  • the score si of abnormal events should be close to 0.
  • This application can use unsupervised learning, that is, there is no need to collect abnormal events as prior knowledge.
  • negative samples can be constructed to achieve comparative learning.
  • the nodes in the current event can be replaced with other nodes, but the embedded nodes must not be too similar to the original nodes, such as not higher than the preset similarity, to avoid forming difficult samples.
  • node clustering can be performed based on the original features of the nodes, and then for each type of context node, a node is randomly selected and replaced with another node with the same attribute type but a different cluster (i.e., a different category). Subsequently, the score s′ i of the negative sample event is obtained through a bilinear function, and then the standard binary cross entropy (BCE) loss (of course, it can also be replaced by other loss functions) can be used as the multivariate contrast loss, i.e., the second loss value:
  • BCE binary cross entropy
  • the abnormal event detection model can then be updated in reverse based on the multivariate contrast loss.
  • Abnormal event patterns may not only be limited to abnormal interactions of elements within an event, but also occur between events. Similar to mismatch anomalies between local nodes, mismatch anomalies also exist between local events. In general, normal events are more likely to have similar semantics with adjacent events, while abnormal events do not. Therefore, this application can use event-event contrastive learning to model the compatibility between adjacent events.
  • this application first uses an attention layer to obtain event representation. Given an event e, a type-specific attention parameter P ⁇ R h ⁇ h is applied to each context node hi to obtain the key representation of the attention mechanism:
  • z is the representation of the identifier node in the event
  • z i is the representation of the identifier node in e i
  • the identifier node can refer to the introduction in the aforementioned multivariate interaction module.
  • the context embedding can be obtained by the weighted sum of all context node embeddings and the learned weight ⁇ :
  • the following inter-event contrast loss i.e., the third loss value
  • e ip is sampled from P(e i ), and e in is sampled from N(e i ).
  • ⁇ ( ⁇ ) is the activation function
  • W inter is the linear transformation layer for abnormal event score evaluation in the event comparison module, that is, the second linear transformation layer, which is usually a matrix
  • W m is the linear transformation layer for abnormal event score evaluation in the aforementioned multivariate interaction module.
  • the overall optimization function can be expressed as:
  • ⁇ , ⁇ and ⁇ are parameters to adjust the impact of the three modules on the results, and they usually need to be updated when performing reverse updates. Specifically, they can be adjusted manually or according to other algorithms.
  • the abnormal event detection model is based on the mining of abnormal patterns within and between events through contrastive learning.
  • the intra-event contrastive learning task the interaction anomalies of elements within the event are modeled;
  • the inter-event contrastive learning task the contextual anomalies between events are modeled.
  • an abnormal event scoring function is finally provided, which provides a more accurate detection method for measuring the degree of abnormality of an event.
  • the method of detecting abnormal events in the inference stage is similar to the aforementioned training part. The difference is that there is no need to calculate the loss value in the inference stage.
  • Each module can be used directly to output the detected similarity or abnormal value.
  • the structure and execution steps of the abnormal event detection model can be shown in Figure 11.
  • the events in the attribute heterogeneity graph can also be converted to the same space, and the converted data representation in the same space is used as the input of the abnormal event detection model to output the abnormal degree value for the event.
  • Each stage is introduced below.
  • the input data may refer to the input data in the description corresponding to the aforementioned FIG. 10 , which will not be described in detail here.
  • ⁇ d is the original node feature
  • W (t) ⁇ Rd ⁇ h and b (t) ⁇ R1 ⁇ h are the transformation parameters of the t-type node.
  • ⁇ ( ⁇ ) represents the activation function.
  • the h-dimensional representation of each node is in the same space, and z represents the representation set of the node.
  • the abnormal event detection model includes modules for identifying anomalies within events and identifying anomalies between events, which are introduced below.
  • pairwise similarity is also used in many hypergraph representation learning methods.
  • the basic basis behind it is that the matching degree of paired nodes in an event should be higher than that of other nodes, so incompatible abnormal node pairs can be found based on the similarity between node pairs, that is, node pairs with similarity below a certain value.
  • the normal matching pattern of node pairs can be modeled, and then the node pairs that do not conform to the pattern are considered abnormal. If all pairwise interactions in the event are directly fused to obtain the event anomaly score, the degree of abnormality of the abnormal node pairs may be weakened.
  • the abnormality can be expressed in the form of a negative number.
  • Paired interactions in events are usually normal interactions, but when considering interactions with more than two nodes, events are usually abnormal.
  • the present application can use a multivariate comparison module to model such abnormal events.
  • This module captures multivariate interaction patterns in events by modeling the compatibility between identifier nodes and context nodes (i.e., non-identifier nodes in events).
  • Identifier nodes may include nodes fused from multiple nodes in an event, central nodes or clustering centers of an event, etc.
  • context nodes are nodes other than identifier nodes in an event.
  • the compatibility of identifier nodes and context nodes is very high, i.e., the similarity is very high.
  • the content of a paper is highly correlated with the type of conference in which it is published and the interests of the author.
  • a type embedding ti i.e., an identifier node
  • h i : hi z i + ti
  • Type embedding enables the model to capture the interactions between heterogeneous nodes, thereby capturing more meaningful interaction patterns. Then for the context node set in event e i The above formula can be used to get their expression In order to model the multivariate interactions between the identifier node and the context node and obtain the final context representation c i , this application can use the self-attention mechanism selfatt( ⁇ ) followed by a maximum pooling layer:
  • a bilinear scoring function can be used to model the compatibility between the identifier node and the context node, i.e., the second similarity:
  • hi is the identifier node representation of event e i
  • ⁇ ( ⁇ ) is the sigmoid activation function
  • Wm is the linear transformation layer, that is, the first linear transformation layer mentioned above, which needs to be updated when performing reverse update.
  • the score si of normal events should be close to 1
  • the score si of abnormal events should be Close to 0. Therefore, in the subsequent abnormality degree identification process, the abnormality degree can also be expressed in the form of negative numbers.
  • Abnormal event patterns may not only be limited to abnormal interactions of elements within an event, but also occur between events. Similar to mismatch anomalies between local nodes, mismatch anomalies also exist between local events. In general, normal events are more likely to have similar semantics with adjacent events, while abnormal events do not. Therefore, this application can use event-event contrastive learning to model the compatibility between adjacent events.
  • this application first uses an attention layer to obtain event representation. Given an event e, a type-specific attention parameter P ⁇ R h ⁇ h is applied to each context node hi to obtain the key representation of the attention mechanism:
  • z is the representation of the identifier node in the event
  • z i is the representation of the identifier node in e i
  • the identifier node can refer to the introduction in the aforementioned multivariate interaction module.
  • the context embedding can be obtained by the weighted sum of all context node embeddings and the learned weight ⁇ :
  • ep is the positive sample adjacent event of the current event e i .
  • ep can be an event whose number of shared nodes with e i exceeds T pos .
  • the ⁇ , ⁇ and ⁇ parameters can be used to adjust the impact of the three modules on the results, and can be trained in the aforementioned training stage.
  • the minimum value min(sim(z i ,z j )) indicates that this application uses the smallest node pair similarity in the event to measure the degree of abnormality of paired interactions. It can be understood that when a node pair similarity is relatively small, the event may be abnormal. It can also be replaced by the sum of all node pair similarity scores.
  • ⁇ (c i W m z i ) and ⁇ (e i W inter e p ) indicate that this application uses the bilinear scores of positive sample pairs to measure the multivariate and event scores of positive pairs to measure the degree of abnormality between multivariate and events.
  • the bilinear scores of abnormal events are re-added with the scores output by these three modules to obtain the final abnormal event score s. Due to the use of a negative sign, the larger the abnormal score s, the more likely the event is abnormal.
  • an abnormal event detection model is constructed based on complex interactive events in attribute heterogeneous graphs, while considering anomalies within events and anomalies between events, fully exploring various complex abnormal patterns, and providing a more comprehensive method for abnormal event detection.
  • the architecture of the present application can be used for various types of tasks, it has a certain universality. Since most business scenarios in real life can be modeled using attribute heterogeneous graphs. Therefore, the method provided by the present application can be used in various attribute heterogeneous graph scenarios, such as in academic networks, recommendation scenarios, and movie networks, and has good effects.
  • the method provided by this application can be applied to the detection of complex interactive abnormal events in attribute heterogeneous graphs, and is not limited to events of a specific form.
  • this application also fully considers various abnormal and complex interactive patterns in attribute heterogeneous graphs, and can detect abnormal patterns that cannot be modeled by existing solutions.
  • This application also proposes a scoring function for the degree of abnormality of events, which can measure the degree of abnormality of events in attribute heterogeneous graphs.
  • APE models the pairwise interactions of nodes in an event to obtain the probability of an event.
  • AEHE utilizes rich node attributes and combines the pairwise interactions within an event and the second-order structural embedding of nodes to perform abnormal event detection.
  • CoLA is a GNN-based model for detecting abnormal nodes in homogeneous graphs, using contrastive learning to model inconsistent patterns between abnormal nodes and their context nodes.
  • ANEMONE adopts a similar scheme to CoLA, except that it uses multi-scale contrastive learning at the context level.
  • Metapath2vec uses meta-path-based random walks to model node similarities.
  • This application first obtains node embeddings through metapath2vec, and then performs pairwise dot products to obtain node pair similarity scores, and the lowest score in the event is used to measure the degree of abnormality.
  • HeCo uses a collaborative contrast strategy to learn node representations in HIN, while this application uses the contrast loss of identified nodes as the abnormal event score.
  • HeteHG-VAE uses a hypergraph variational autoencoder to learn robust node representations.
  • the model input can be some public data sets, such as Aminer, IMDB, and Meituan.
  • anomalies can be created manually.
  • a variety of indicators can be used to represent the output effect. For example, average precision (AP) and area under the curve (AUC) can be used. Generally speaking, AP can reflect the recall ability, that is, the ability to detect more abnormal events, and AUC reflects the accuracy of the model. The effects achieved are shown in Table 1.
  • a schematic diagram of a structure of an abnormal event detection model building device includes:
  • the acquisition module 1201 is used to acquire a second attribute heterogeneity graph, the second attribute heterogeneity graph represents multiple events, the second attribute heterogeneity graph includes multiple nodes and association relationships between the multiple nodes, each event is represented by at least two nodes of the multiple nodes and the association relationship between the at least two nodes, and the node in each event includes information of event elements forming the event;
  • the construction module 1202 is used to construct an abnormal event detection model according to the second attribute heterogeneity graph.
  • the abnormal event detection model is used to detect abnormal events among multiple events.
  • the abnormal events are determined according to the similarity between adjacent events or the similarity between nodes within an event.
  • the abnormal event detection model includes a node pair comparison module, which is used to obtain the similarity of the node pairs, and the similarity is used to indicate the abnormality degree of the event;
  • Construction module 1202 is specifically used to: group multiple nodes in each event into at least one pair of node pairs; obtain the first similarity of each pair of node pairs in at least one pair of node pairs through the node pair comparison module; obtain the pairwise comparison loss value of each node in the multiple nodes according to the first similarity of each pair of node pairs; update the abnormal event detection model according to the pairwise comparison loss value of each node pair to obtain the updated abnormal event detection model.
  • the construction module 1202 is specifically used to: fuse the pairwise comparison loss values of multiple node pairs in each event to obtain a first loss value; and update the abnormal event detection model according to the first loss value to obtain an updated abnormal event detection model.
  • the construction module 1202 is specifically configured to: obtain a positive sample node set of the first node from multiple nodes.
  • the first similarity between the nodes in the positive sample node set and the first node is higher than the first similarity between the nodes in the negative sample node set and the first node, and the first node is any one of the multiple nodes in each event;
  • the pairwise comparison loss value corresponding to the first node is calculated by the first similarity between the first node and the nodes in the positive sample node set and the similarity between the first node and the nodes in the negative sample node set.
  • module 1202 is constructed to specifically: obtain a temperature coefficient, where the temperature coefficient is related to the similarity between the nodes in the negative sample node set and the first node; and calculate the pairwise comparison loss value corresponding to the first node in combination with the temperature coefficient by using the first similarity between the first node and the nodes in the positive sample node set and the similarity between the first node and the nodes in the negative sample node set.
  • the abnormal event detection model further includes a multivariate interaction module, which is used to cluster nodes in the event to obtain at least one category, and obtain the similarity between each node in the event and at least one category, where the similarity is used to indicate the abnormality degree of the corresponding event;
  • Construction module 1202 is also used to obtain the second similarity between at least one node among multiple nodes in each event and the identifier node through the multi-element interaction module, the identifier node includes the central node of each event or a node obtained by fusing multiple nodes; calculate the second loss value according to the second similarity between at least one node and the identifier node; update the abnormal event detection model according to the second loss value to obtain an updated abnormal event detection model.
  • the multivariate interaction module is further used to cluster multiple nodes in each event to obtain at least one category;
  • Construction module 1202 is specifically used to: replace the first node with the second node, the first node is one of the points in the first event, and the second node has the same attributes as the first node but a different category; obtain the third similarity between the second node and the identifier node; calculate the loss value based on the second similarity and the third similarity to obtain the second loss value.
  • the abnormal event detection model further includes an event comparison module, which is used to obtain similarities between events;
  • Construction module 1202 is specifically used to: filter out a positive sample set and a negative sample set corresponding to each event from multiple events; calculate a third loss value based on the fourth similarity between each event and the events in the positive sample set and the fifth similarity between each event and the events in the negative sample set; update the abnormal event detection model based on the third loss value to obtain an updated abnormal event detection model.
  • construction module 1202 is specifically used to: obtain the number of shared nodes between each pair of events through an event comparison module; obtain at least one event whose number of shared nodes with the second event is greater than a first threshold, and obtain a positive sample set, where the second event is any one of multiple events; obtain at least one event whose number of shared nodes with the second event is not greater than the first threshold, and obtain a negative sample set.
  • the construction module 1202 is specifically configured to: perform semantic recognition on each event through an event comparison module to obtain each event representation; and calculate the fourth similarity between events according to each event representation through the event comparison module.
  • construction module 1202 is also used to: map the data corresponding to each node in each event in the second attribute heterogeneity graph to the same space to obtain a first data representation of each event in the same space; and construct an abnormal event detection model based on the first data representation.
  • the multiple events in the second attribute heterogeneity graph are used to represent: a financial transaction behavior of a user, a comment-posting behavior of a user, or an item transaction behavior of a user.
  • a schematic diagram of the structure of an abnormal event detection device provided by the present application includes:
  • the acquisition module 1301 is used to acquire a first attribute heterogeneity graph, where the first attribute heterogeneity graph is used to represent at least one event, and the first attribute heterogeneity graph includes a plurality of nodes and association relationships between the plurality of nodes, each event is represented by at least two nodes among the plurality of nodes and the association relationship between the at least two nodes, and each node in each event includes information of event elements forming the event;
  • the detection module 1302 is used to use the first attribute heterogeneity graph as the input of the abnormal event detection model to obtain an output result, and the output result is used to indicate whether at least one event includes an abnormal event, and the abnormal event is determined based on the similarity between events or the similarity between nodes within an event.
  • the abnormal event detection model includes one or more of the following modules: a node pair comparison module, a multivariate interaction module, or an event comparison module.
  • the node comparison module is used to obtain the similarity between nodes in an event
  • the multivariate interaction module is used to obtain The similarity between nodes within an event and event categories
  • the event comparison module is used to obtain the similarity between events.
  • the detection module 1302 is specifically used to: output a first abnormality degree of each event according to the node pair comparison module, wherein the node pair comparison module is used to obtain the similarity between the node pairs in each event, and obtain the first abnormality degree according to the similarity between the node pairs in each event; and determine whether each event is an abnormal event according to the first abnormality degree of each event to obtain an output result.
  • the detection module 1302 is specifically used to: output the second abnormality degree of each event through the multivariate interaction module, wherein the multivariate interaction module is used to fuse multiple nodes in at least one event to obtain an identifier node, or use the center point of each event as the identifier node, and obtain the second abnormality degree of each event through the similarity between at least one node and the identifier node; based on the second abnormality degree of each event, determine whether each event is an abnormal event to obtain an output result.
  • the detection module 1302 is specifically used to: output the third abnormality degree of each event through the event comparison module, wherein the event comparison module is used to obtain the similarity between event pairs, and calculate the third abnormality degree of each event based on the similarity between the event pairs; based on the third abnormality degree of each event, determine whether each event is an abnormal event to obtain an output result.
  • the event comparison module is specifically used to: filter out a positive sample set corresponding to each event from multiple events; and obtain a third abnormality degree of each event based on the similarity between each event and an event in the corresponding positive sample set.
  • the event comparison module is specifically used to: perform semantic recognition on each event to obtain a representation of each event; and calculate the similarity between each event and an event in a corresponding positive sample set based on the representation of each event.
  • the detection module 1302 is specifically used to: use the first attribute heterogeneity graph as the input of the node pair comparison module, the multivariate interaction module and the event comparison module respectively; fuse the first abnormality degree of each event output by the node pair comparison module, the second abnormality degree of each event output by the multivariate interaction module and the third abnormality degree of each event output by the event comparison module to obtain the fourth abnormality degree of each event; determine whether each event is an abnormal event according to the fourth abnormality degree of each event to obtain an output result.
  • the detection module 1302 is specifically used to: map each node in each event in the first attribute heterogeneity graph to the same space to obtain a second data representation of each event in the same space; and use the second data representation as an input to the abnormal event detection model to obtain an output result.
  • At least one event in the first attribute heterogeneity graph is used to represent: a financial transaction behavior of a user, a comment-posting behavior of a user, or an item transaction behavior of a user.
  • FIG. 14 is a schematic diagram of the structure of another abnormal event detection model building device provided in the present application, as described below.
  • the abnormal event detection model building device may include a processor 1401 and a memory 1402.
  • the processor 1401 and the memory 1402 are interconnected via a line.
  • the memory 1402 stores program instructions and data.
  • the memory 1402 stores program instructions and data corresponding to the steps in the aforementioned FIGS. 4 to 11 .
  • the processor 1401 is used to execute the method steps performed by the abnormal event detection model building device shown in any of the embodiments in Figures 4 to 11 above.
  • the abnormal event detection model building device may further include a transceiver 1403 for receiving or sending data.
  • a computer-readable storage medium is also provided in an embodiment of the present application, in which a program for generating a vehicle driving speed is stored.
  • the program When the program is running on a computer, the computer executes the steps in the method described in the embodiments shown in the aforementioned Figures 4 to 11.
  • the abnormal event detection model building device shown in the aforementioned FIG. 14 is a chip.
  • FIG. 15 is a schematic diagram of the structure of another abnormal event detection device provided in the present application, as described below.
  • the abnormal event detection device may include a processor 1501 and a memory 1502.
  • the processor 1501 and the memory 1502 are interconnected via a line.
  • the memory 1502 stores program instructions and data.
  • the memory 1502 stores program instructions and data corresponding to the steps in the aforementioned FIGS. 4 to 11 .
  • the processor 1501 is used to execute the method steps performed by the abnormal event detection device shown in any of the embodiments in Figures 4 to 11 above.
  • the abnormal event detection device may further include a transceiver 1503 for receiving or sending data.
  • a computer-readable storage medium is also provided in an embodiment of the present application, in which a program for generating a vehicle driving speed is stored.
  • the program When the program is running on a computer, the computer executes the steps in the method described in the embodiments shown in the aforementioned Figures 4 to 11.
  • the abnormal event detection device shown in the aforementioned FIG. 15 is a chip.
  • An embodiment of the present application also provides an abnormal event detection model construction device, which can also be called a digital processing chip or chip.
  • the chip includes a processing unit and a communication interface.
  • the processing unit obtains program instructions through the communication interface, and the program instructions are executed by the processing unit.
  • the processing unit is used to execute the method steps performed by the abnormal event detection model construction device shown in any of the embodiments in Figures 4 to 11 above.
  • An embodiment of the present application also provides an abnormal event detection device, which can also be called a digital processing chip or chip.
  • the chip includes a processing unit and a communication interface.
  • the processing unit obtains program instructions through the communication interface, and the program instructions are executed by the processing unit.
  • the processing unit is used to execute the method steps performed by the abnormal event detection device shown in any of the embodiments in Figures 4 to 11 above.
  • the embodiment of the present application also provides a digital processing chip.
  • the digital processing chip integrates a circuit and one or more interfaces for implementing the above-mentioned processor 1401, or the functions of the processor 1401.
  • the digital processing chip can complete the method steps of any one or more of the above-mentioned embodiments.
  • the digital processing chip does not integrate a memory, it can be connected to an external memory through a communication interface.
  • the digital processing chip implements the actions performed by the abnormal event detection model construction device in the above-mentioned embodiment according to the program code stored in the external memory.
  • the abnormal event detection model building device can be a chip, and the chip includes: a processing unit and a communication unit, the processing unit can be, for example, a processor, and the communication unit can be, for example, an input/output interface, a pin or a circuit, etc.
  • the processing unit can execute the computer execution instructions stored in the storage unit, so that the chip in the server executes the abnormal event detection model building method described in the embodiments shown in Figures 4 to 11 above.
  • the storage unit is a storage unit in the chip, such as a register, a cache, etc.
  • the storage unit can also be a storage unit located outside the chip in the wireless access device end, such as a read-only memory (ROM) or other types of static storage devices that can store static information and instructions, a random access memory (RAM), etc.
  • ROM read-only memory
  • RAM random access memory
  • the embodiment of the present application also provides a digital processing chip.
  • the digital processing chip integrates a circuit and one or more interfaces for implementing the above-mentioned processor 1501, or the functions of the processor 1501.
  • the digital processing chip can complete the method steps of any one or more of the above-mentioned embodiments.
  • the digital processing chip does not integrate a memory, it can be connected to an external memory through a communication interface.
  • the digital processing chip implements the actions performed by the abnormal event detection device in the above-mentioned embodiment according to the program code stored in the external memory.
  • the data conversion device provided in the embodiment of the present application can be a chip, and the chip includes: a processing unit and a communication unit, the processing unit can be, for example, a processor, and the communication unit can be, for example, an input/output interface, a pin or a circuit, etc.
  • the processing unit can execute the computer execution instructions stored in the storage unit, so that the chip in the server executes the data conversion method described in the embodiments shown in Figures 4 to 11 above.
  • the storage unit is a storage unit in the chip, such as a register, a cache, etc.
  • the storage unit can also be a storage unit located outside the chip in the wireless access device end, such as a read-only memory (ROM) or other types of static storage devices that can store static information and instructions, a random access memory (RAM), etc.
  • ROM read-only memory
  • RAM random access memory
  • Also provided in an embodiment of the present application is a computer program product, which, when executed on a computer, enables the computer to execute the steps executed by the image decompression device or the image decompression device in the method described in the embodiments shown in the aforementioned FIGS. 4 to 11 .
  • the aforementioned processing unit or processor may be a central processing unit (CPU), a neural-network processing unit (NPU), a graphics processing unit (GPU), a digital signal processor (DSP), an application specific integrated circuit (ASIC) or a field programmable gate array (FPGA) or other programmable logic devices, discrete gate or transistor logic devices, discrete hardware components, etc.
  • CPU central processing unit
  • NPU neural-network processing unit
  • GPU graphics processing unit
  • DSP digital signal processor
  • ASIC application specific integrated circuit
  • FPGA field programmable gate array
  • a general-purpose processor may be a microprocessor or any conventional processor, etc.
  • FIG. 16 is a schematic diagram of a structure of a chip provided in an embodiment of the present application.
  • the chip can be a neural network processor NPU 160.
  • NPU 160 is mounted on the host CPU (Host CPU) as a coprocessor, and the host CPU assigns tasks.
  • the core part of the NPU is the operation circuit 1603, which is controlled by the controller 1604 to extract the matrix data in the memory and Perform multiplication.
  • the operation circuit 1603 includes multiple processing units (process engines, PEs) inside.
  • the operation circuit 1603 is a two-dimensional systolic array.
  • the operation circuit 1603 can also be a one-dimensional systolic array or other electronic circuits capable of performing mathematical operations such as multiplication and addition.
  • the operation circuit 1603 is a general-purpose matrix processor.
  • the operation circuit takes the corresponding data of matrix B from the weight memory 1602 and caches it on each PE in the operation circuit.
  • the operation circuit takes the matrix A data from the input memory 1601 and performs matrix operation with matrix B, and the partial result or final result of the matrix is stored in the accumulator 1608.
  • the unified memory 1606 is used to store input data and output data.
  • the weight data is directly transferred to the weight memory 1602 through the direct memory access controller (DMAC) 1605.
  • the input data is also transferred to the unified memory 1606 through the DMAC.
  • DMAC direct memory access controller
  • the bus interface unit (BIU) 1610 is used for the interaction between the AXI bus and the DMAC and instruction fetch buffer (IFB) 1609.
  • the bus interface unit 1610 (BIU) is used for the instruction fetch memory 1609 to obtain instructions from the external memory, and is also used for the storage unit access controller 1605 to obtain the original data of the input matrix A or the weight matrix B from the external memory.
  • DMAC is mainly used to transfer input data in the external memory DDR to the unified memory 1606 or to transfer weight data to the weight memory 1602 or to transfer input data to the input memory 1601.
  • the vector calculation unit 1607 includes multiple operation processing units, which further process the output of the operation circuit when necessary, such as vector multiplication, vector addition, exponential operation, logarithmic operation, size comparison, etc. It is mainly used for non-convolutional/fully connected layer network calculations in neural networks, such as batch normalization, pixel-level summation, upsampling of feature planes, etc.
  • the vector calculation unit 1607 can store the processed output vector to the unified memory 1606.
  • the vector calculation unit 1607 can apply a linear function and/or a nonlinear function to the output of the operation circuit 1603, such as linear interpolation of the feature plane extracted by the convolution layer, and then, for example, a vector of accumulated values to generate an activation value.
  • the vector calculation unit 1607 generates a normalized value, a pixel-level summed value, or both.
  • the processed output vector can be used as an activation input to the operation circuit 1603, for example, for use in a subsequent layer in a neural network.
  • An instruction fetch buffer 1609 connected to the controller 1604 is used to store instructions used by the controller 1604;
  • Unified memory 1606, input memory 1601, weight memory 1602 and instruction fetch memory 1609 are all on-chip memories. External memories are private to the NPU hardware architecture.
  • each layer in the recurrent neural network can be performed by the operation circuit 1603 or the vector calculation unit 1607.
  • the processor mentioned in any of the above places may be a general-purpose central processing unit, a microprocessor, an ASIC, or one or more integrated circuits for controlling the execution of the programs of the methods of FIG. 3-FIG 5 .
  • the device embodiments described above are merely schematic, wherein the units described as separate components may or may not be physically separated, and the components displayed as units may or may not be physical units, that is, they may be located in one place, or they may be distributed over multiple network units. Some or all of the modules may be selected according to actual needs to achieve the purpose of the scheme of this embodiment.
  • the connection relationship between the modules indicates that there is a communication connection between them, which may be specifically implemented as one or more communication buses or signal lines.
  • the technical solution of the present application is essentially or the part that contributes to the prior art can be embodied in the form of a software product, which is stored in a readable storage medium, such as a computer floppy disk, a U disk, a mobile hard disk, a read-only memory (ROM), a random access memory (RAM), a disk or an optical disk, etc., including a number of instructions to enable a computer device (which can be a personal computer, a server, or a network device, etc.) to execute the methods described in each embodiment of the present application.
  • a computer floppy disk such as a computer floppy disk, a U disk, a mobile hard disk, a read-only memory (ROM), a random access memory (RAM), a disk or an optical disk, etc.
  • ROM read-only memory
  • RAM random access memory
  • disk or an optical disk etc.
  • all or part of the embodiments may be implemented by software, hardware, firmware or any combination thereof.
  • all or part of the embodiments may be implemented in the form of a computer program product.
  • the computer program product includes one or more computer instructions.
  • the computer may be a general-purpose computer, a special-purpose computer, a computer network, or other programmable device.
  • the computer instructions may be stored in a computer-readable storage medium, or transmitted from one computer-readable storage medium to another computer-readable storage medium.
  • the computer instructions may be transmitted from one website, computer, server or data center to another website, computer, server or data center by wired (e.g., coaxial cable, optical fiber, digital subscriber line (DSL)) or wireless (e.g., infrared, wireless, microwave, etc.) means.
  • wired e.g., coaxial cable, optical fiber, digital subscriber line (DSL)
  • wireless e.g., infrared, wireless, microwave, etc.
  • the computer-readable storage medium may be any available medium that a computer can store or a data storage device such as a server or data center that includes one or more available media integrated.
  • the available medium may be a magnetic medium (e.g., a floppy disk, a hard disk, a tape), an optical medium (e.g., a DVD), or a semiconductor medium (e.g., a solid state drive (SSD)), etc.

Landscapes

  • Engineering & Computer Science (AREA)
  • Data Mining & Analysis (AREA)
  • Theoretical Computer Science (AREA)
  • Computer Vision & Pattern Recognition (AREA)
  • Bioinformatics & Cheminformatics (AREA)
  • Bioinformatics & Computational Biology (AREA)
  • Artificial Intelligence (AREA)
  • Evolutionary Biology (AREA)
  • Evolutionary Computation (AREA)
  • Physics & Mathematics (AREA)
  • General Engineering & Computer Science (AREA)
  • General Physics & Mathematics (AREA)
  • Life Sciences & Earth Sciences (AREA)
  • Information Retrieval, Db Structures And Fs Structures Therefor (AREA)

Abstract

A method for detecting an abnormal event, and a method and apparatus for constructing an abnormal-event detection model. The method for detecting an abnormal event comprises: acquiring a first attribute heterogeneity graph used for representing at least one event, wherein the first attribute heterogeneity graph comprises a plurality of nodes and an association relationship between the plurality of nodes, and each event is represented by means of at least two nodes among the plurality of nodes and an association relationship between the at least two nodes, each node in each event comprising information of event elements forming the event; and taking the first attribute heterogeneity graph as an input of an abnormal-event detection model, so as to obtain an output result, wherein the output result is used for representing whether the at least one event comprises an abnormal event, the abnormal event being determined according to the similarity between events or the similarity between the nodes in the event.

Description

异常事件检测方法、异常事件检测模型构建方法以及装置Abnormal event detection method, abnormal event detection model construction method and device
本申请要求于2022年12月02日提交国家知识产权局、申请号为202211536903.2、申请名称为“异常事件检测方法、异常事件检测模型构建方法以及装置”的中国专利申请的优先权,其全部内容通过引用结合在本申请中。This application claims priority to the Chinese patent application filed with the State Intellectual Property Office on December 2, 2022, with application number 202211536903.2 and application name “Abnormal event detection method, abnormal event detection model construction method and device”, the entire contents of which are incorporated by reference in this application.
技术领域Technical Field
本申请涉及人工智能领域,尤其涉及一种异常事件检测方法、异常事件模型构建练方法以及装置。The present application relates to the field of artificial intelligence, and in particular to an abnormal event detection method, an abnormal event model construction training method and a device.
背景技术Background technique
各个事件可能包含多类型的属性实体以及它们之间的复杂交互,从而形成属性异构信息网络。随着社交媒体的蓬勃发展,属性异构信息网络中的异常事件检测已经成为一项重要但很少被探索的任务。Each event may contain multiple types of attribute entities and complex interactions between them, thus forming an attribute heterogeneous information network. With the booming development of social media, abnormal event detection in attribute heterogeneous information networks has become an important but rarely explored task.
一些常用的针对异常事件的检测中,可以对两两事件进行交互,对所有得分进行按交互类别加权得到整个事件的异常得分。交互得分采用向量点乘的形式,得分越高说明此交互越正常。通过对得分进行加权求和,模型可以自动学到不同类型节点交互的重要性。通过最大化正常事件的得分来优化最终的损失函数,那么对于一个正常事件,它的得分比较高,而对于异常事件,得分比较低。然而,这种检测方式仅能对简单的类别事件进行异常检测,对于一些具有复杂交互的事件,其检测准确度远远不足。In some commonly used detections for abnormal events, two events can be interacted with each other, and all scores can be weighted by interaction category to obtain the abnormal score of the entire event. The interaction score is in the form of vector dot product, and the higher the score, the more normal the interaction. By weighted summing the scores, the model can automatically learn the importance of different types of node interactions. By maximizing the score of normal events to optimize the final loss function, a normal event will have a higher score, while an abnormal event will have a lower score. However, this detection method can only detect anomalies for simple category events, and its detection accuracy is far from enough for some events with complex interactions.
发明内容Summary of the invention
本申请提供人工智能领域的一种异常事件检测方法、异常事件模型构建练方法以及装置,用于基于属性异质性图构建异常事件检测模型,应用于多种针对用户产生的复杂事件数据进行异常检测。The present application provides an abnormal event detection method, an abnormal event model construction training method and a device in the field of artificial intelligence, which are used to construct an abnormal event detection model based on an attribute heterogeneity graph and are applied to perform anomaly detection on a variety of complex event data generated by users.
有鉴于此,第一方面,本申请提供一种异常事件检测方法,包括:获取第一属性异质性图,第一属性异质性图用于表示至少一个事件,该第一属性异质性图中包括多个节点以及多个节点之间的关联关系,每个事件通过该多个节点中的至少两个节点以及该至少两个节点之间的关联关系表示,每个事件中的每个节点包括形成该事件的事件元素的信息;将第一属性异质性图作为异常事件检测模型的输入,得到输出结果,输出结果用于表示至少一个事件中是否包括异常事件,异常事件为根据事件之间的相似度或者事件内的节点之间的相似度确定。In view of this, in a first aspect, the present application provides an abnormal event detection method, comprising: obtaining a first attribute heterogeneity graph, the first attribute heterogeneity graph is used to represent at least one event, the first attribute heterogeneity graph includes multiple nodes and association relationships between the multiple nodes, each event is represented by at least two nodes among the multiple nodes and the association relationship between the at least two nodes, and each node in each event includes information of event elements that form the event; using the first attribute heterogeneity graph as an input of an abnormal event detection model to obtain an output result, the output result is used to indicate whether at least one event includes an abnormal event, and the abnormal event is determined based on the similarity between events or the similarity between nodes within an event.
本申请实施方式中,异常事件检测模型可以对事件内节点之间的相似度或者事件之间的相似度来识别事件的异常程度,从而可以从多个维度更准确地识别出异常事件。In the implementation manner of the present application, the abnormal event detection model can identify the abnormality of an event based on the similarity between nodes within an event or the similarity between events, so that abnormal events can be more accurately identified from multiple dimensions.
在一种可能的实施方式中,异常事件检测模型包括以下一种或者多种模块:节点对对比模块、多元交互模块或事件对比模块,节点对比模块用于获取事件内的节点之间的相似度,多元交互模块用于获取事件内的节点和事件类别之间的相似度,事件对比模块用于获取事件之间的相似度。本申请实施方式中,异常事件检测模型中可以包括针对事件内节点之间异常程度的识别模块或者事件之间的异常程度的识别模块,可以从多个维度准确地识别出异常事件。In a possible implementation, the abnormal event detection model includes one or more of the following modules: a node pair comparison module, a multivariate interaction module, or an event comparison module, the node comparison module is used to obtain the similarity between nodes within an event, the multivariate interaction module is used to obtain the similarity between nodes within an event and event categories, and the event comparison module is used to obtain the similarity between events. In the implementation of the present application, the abnormal event detection model may include an identification module for the degree of abnormality between nodes within an event or an identification module for the degree of abnormality between events, which can accurately identify abnormal events from multiple dimensions.
在一种可能的实施方式中,若异常事件检测模型包括节点对对比模块,将第一属性异质性图作为异常事件检测模型的输入,得到输出结果,可以包括:根据节点对对比模块输出每个事件的第一异常程度,其中,节点对对比模块用于获取每个事件中的节点对之间的相似度,并根据每个事件中的节点对之间的相似度得到第一异常程度;根据每个事件的第一异常程度,判断每个事件是否为异常事件,以得到输出结果。In a possible implementation, if the abnormal event detection model includes a node pair comparison module, taking the first attribute heterogeneity graph as the input of the abnormal event detection model to obtain an output result may include: outputting a first degree of abnormality for each event according to the node pair comparison module, wherein the node pair comparison module is used to obtain the similarity between the node pairs in each event, and obtaining the first degree of abnormality according to the similarity between the node pairs in each event; judging whether each event is an abnormal event according to the first degree of abnormality of each event to obtain an output result.
本申请实施方式中,可以通过节点对对比模块来计算得到事件内部的节点之间的相似度,从而使异常事件检测模型可以基于事件内的节点之间的相似度来识别事件的异常程度,准确地识别出异常事件。In the implementation manner of the present application, the similarity between nodes within an event can be calculated through a node pair comparison module, so that the abnormal event detection model can identify the abnormality of the event based on the similarity between nodes within the event and accurately identify the abnormal event.
在一种可能的实施方式中,若异常事件检测模型包括多元交互模块,则将第一属性异质性图作为异常事件检测模型的输入,得到输出结果,还可以包括:通过多元交互模块输出每个事件的第二异常程度,其中,多元交互模块用于对至少一个事件中的多个节点进行融合,得到标识符节点,或者将每个事件的中心点作为标识符节点,并通过至少一个节点与标识符节点之间的相似度获取每个事件的第二异常程度;根据每个事件的第二异常程度,判断每个事件是否为异常事件,以得到输出结果。In a possible implementation, if the abnormal event detection model includes a multivariate interaction module, the first attribute heterogeneity graph is used as the input of the abnormal event detection model to obtain an output result, and may also include: outputting the second abnormality degree of each event through the multivariate interaction module, wherein the multivariate interaction module is used to fuse multiple nodes in at least one event to obtain an identifier node, or to use the center point of each event as the identifier node, and to obtain the second abnormality degree of each event through the similarity between at least one node and the identifier node; based on the second abnormality degree of each event, judging whether each event is an abnormal event to obtain an output result.
通常,事件内可能存在多种节点之间的交互,可以通过构建多元交互模块来识别事件内的节点与事 件整体之间的交互异常程度,从而可以准确地识别出事件异常程度。Usually, there may be multiple interactions between nodes in an event. We can identify the interactions between nodes and events by building a multi-interaction module. The abnormal degree of interaction between the whole components can be accurately identified.
在一种可能的实施方式中,若异常事件检测模型包括事件对比模块,则将第一属性异质性图作为异常事件检测模型的输入,得到输出结果,还可以包括:通过事件对比模块输出每个事件的第三异常程度,其中,事件对比模块用于获取事件对之间的相似度,根据事件对之间的相似度计算每个事件的第三异常程度;根据每个事件的第三异常程度,判断每个事件是否为异常事件,以得到输出结果。本申请实施方式中,异常事件检测模型中还可以设置事件对比模块,对事件之间的异常程度进行识别,从而以事件为单位识别出异常事件。In a possible implementation, if the abnormal event detection model includes an event comparison module, the first attribute heterogeneity graph is used as the input of the abnormal event detection model to obtain an output result, and it may also include: outputting the third abnormality degree of each event through the event comparison module, wherein the event comparison module is used to obtain the similarity between event pairs, and calculate the third abnormality degree of each event according to the similarity between the event pairs; according to the third abnormality degree of each event, determine whether each event is an abnormal event to obtain an output result. In the implementation of the present application, an event comparison module may also be set in the abnormal event detection model to identify the abnormality degree between events, so as to identify abnormal events in units of events.
在一种可能的实施方式中,事件对比模块,具体可以用于:从多个事件中筛选出每个事件分别对应的正样本集合;根据每个事件和对应的正样本集合中的事件之间的相似度,得到每个事件的第三异常程度。In a possible implementation, the event comparison module can be specifically used to: filter out a positive sample set corresponding to each event from multiple events; and obtain a third abnormality degree of each event based on the similarity between each event and the events in the corresponding positive sample set.
本申请实施方式中,可以确定每个事件的正样本集合,可以基于相邻时间之间的相似度来识别事件是否异常。In the implementation manner of the present application, a positive sample set for each event may be determined, and whether an event is abnormal may be identified based on the similarity between adjacent times.
在一种可能的实施方式中,事件对比模块,具体用于:对每个事件进行语义识别,得到每个事件的表征;根据每个事件的表征计算每个事件与对应的正样本集合中的事件之间的相似度。因此,本申请实施例可以基于提取到的特征,准确地计算出事件之间的相似性。In a possible implementation, the event comparison module is specifically used to: perform semantic recognition on each event to obtain a representation of each event; and calculate the similarity between each event and the events in the corresponding positive sample set based on the representation of each event. Therefore, the embodiment of the present application can accurately calculate the similarity between events based on the extracted features.
在一种可能的实施方式中,若异常事件检测模型包括节点对对比模块、多元交互模块和事件对比模块,则将第一属性异质性图作为异常事件检测模型的输入,得到输出结果,还包括:将第一属性异质性图分别作为节点对对比模块、多元交互模块和事件对比模块的输入;对节点对对比模块输出的每个事件的第一异常程度、多元交互模块输出的每个事件的第二异常程度和事件对比模块输出的每个事件的第三异常程度进行融合,得到每个事件的第四异常程度;根据每个事件的第四异常程度判断每个事件是否为异常事件,以得到输出结果。In a possible implementation, if the abnormal event detection model includes a node pair comparison module, a multivariate interaction module and an event comparison module, the first attribute heterogeneity graph is used as the input of the abnormal event detection model to obtain an output result, and also includes: using the first attribute heterogeneity graph as the input of the node pair comparison module, the multivariate interaction module and the event comparison module respectively; fusing the first abnormality degree of each event output by the node pair comparison module, the second abnormality degree of each event output by the multivariate interaction module and the third abnormality degree of each event output by the event comparison module to obtain a fourth abnormality degree of each event; judging whether each event is an abnormal event according to the fourth abnormality degree of each event to obtain an output result.
本申请实施方式中,当异常事件检测模型中设置了多个模块时,可以对多个模块输出的结果进行融合,从而从多种粒度来识别异常事件,得到准确的识别结果。In the implementation manner of the present application, when multiple modules are set in the abnormal event detection model, the results output by the multiple modules can be fused to identify abnormal events from multiple granularities and obtain accurate identification results.
在一种可能的实施方式中,前述的将第一属性异质性图作为异常事件检测模型的输入,包括:将第一属性异质性图中每个事件中的各个节点映射至同一空间,得到每个事件在同一空间的第二数据表示;将第二数据表示作为异常事件检测模型的输入,以得到输出结果。In a possible implementation, the aforementioned use of the first attribute heterogeneity graph as input to the abnormal event detection model includes: mapping each node in each event in the first attribute heterogeneity graph to the same space to obtain a second data representation of each event in the same space; and using the second data representation as input to the abnormal event detection model to obtain an output result.
通常,属性异质性图中的节点可能是不同维度的节点,可以将各个节点映射至同一空间中,即可得到各个节点在相同维度中的表征,以便于基于各个节点在相同维度中的表征来进行识别。Usually, the nodes in the attribute heterogeneity graph may be nodes of different dimensions. Each node can be mapped to the same space to obtain the representation of each node in the same dimension, so as to facilitate identification based on the representation of each node in the same dimension.
在一种可能的实施方式中,第一属性异质性图中的至少一个事件用于表示:用户的一次金融交易行为、用户发表评论的行为或者用户的物品交易行为。因此,本申请提供的方法构建得到的异常事件检测模型可以应用于多种场景,泛化能力非常强。In a possible implementation, at least one event in the first attribute heterogeneity graph is used to represent: a financial transaction behavior of a user, a comment behavior of a user, or an item transaction behavior of a user. Therefore, the abnormal event detection model constructed by the method provided in this application can be applied to a variety of scenarios, and has a very strong generalization ability.
第二方面,本申请提供一种异常事件检测模型构建方法,包括:In a second aspect, the present application provides a method for constructing an abnormal event detection model, comprising:
首先,获取第二属性异质性图,该第二属性异质性图表示多个事件,该第二属性异质性图中包括多个节点以及多个节点之间的关联关系,每个事件通过该多个节点中的至少两个节点以及该至少两个节点之间的关联关系表示,每个事件中的节点包括形成该事件的事件元素的信息;随后,根据该第二属性异质性图构建异常事件检测模型,异常事件检测模型用于检测多个事件中的异常事件,异常事件为根据事件之间的相似度或者事件内的节点之间的相似度确定。First, a second attribute heterogeneity graph is obtained, the second attribute heterogeneity graph represents multiple events, the second attribute heterogeneity graph includes multiple nodes and association relationships between the multiple nodes, each event is represented by at least two nodes among the multiple nodes and the association relationship between the at least two nodes, and the nodes in each event include information of event elements that form the event; then, an abnormal event detection model is constructed according to the second attribute heterogeneity graph, the abnormal event detection model is used to detect abnormal events among multiple events, and the abnormal events are determined according to the similarity between events or the similarity between nodes within an event.
属性异质性图中可以设置多个节点,该多个节点之间可以互相关联,从而可以对复杂事件进行表示。因此,本申请可以基于可以表示复杂案件的属性异质性图进行建模,得到可以用于检测异常事件的模型,即异常事件检测模型,从而可以实现对更复杂的事件进行异常检测。Multiple nodes can be set in the attribute heterogeneity graph, and the multiple nodes can be related to each other, so that complex events can be represented. Therefore, the present application can model based on the attribute heterogeneity graph that can represent complex cases, and obtain a model that can be used to detect abnormal events, that is, an abnormal event detection model, so as to realize abnormal detection of more complex events.
在一种可能的实施方式中,异常事件检测模型包括节点对对比模块,该节点对对比模块可以用于获取节点对的相似度,即节点之间的相似度,每至少两个节点组成一对节点对;前述的根据第二属性异质性图构建异常事件检测模型,可以包括:首先,将每个事件中的多个节点组成至少一对节点对,每对节点对可以包括至少两个节点;随后通过节点对对比模块,获取至少一对节点对中每对节点对的第一相似度,即每至少两个节点之间的相似度;随后根据每对节点对的第一相似度获取多个节点中每个节点的成 对对比损失值,并根据每个节点对的成对对比损失值更新异常事件检测模型,得到更新后的异常事件检测模型。In a possible implementation, the abnormal event detection model includes a node pair comparison module, which can be used to obtain the similarity of node pairs, that is, the similarity between nodes, and every at least two nodes form a node pair; the aforementioned construction of the abnormal event detection model based on the second attribute heterogeneity graph may include: first, multiple nodes in each event are grouped into at least one pair of node pairs, and each pair of node pairs may include at least two nodes; then, through the node pair comparison module, the first similarity of each pair of node pairs in at least one pair of node pairs is obtained, that is, the similarity between every at least two nodes; then, according to the first similarity of each pair of node pairs, the composition of each node in the multiple nodes is obtained. The pairwise contrast loss values are calculated, and the abnormal event detection model is updated according to the pairwise contrast loss values of each node pair to obtain an updated abnormal event detection model.
本申请实施方式中,可以通过节点对对比模块来计算得到事件内部的节点之间的相似度,并基于节点之间的相似度来进行对比学习,从而使异常事件检测模型可以基于事件内的节点之间的相似度来识别事件的异常程度,准确地识别出异常事件。In the implementation manner of the present application, the similarity between nodes within an event can be calculated through a node pair comparison module, and comparative learning can be performed based on the similarity between the nodes, so that the abnormal event detection model can identify the degree of abnormality of the event based on the similarity between the nodes within the event, and accurately identify the abnormal event.
在一种可能的实施方式中,前述的根据每个节点对的成对对比损失值更新异常事件检测模型,得到更新后的异常事件检测模型,可以包括:对每个事件中的多个节点对的成对对比损失值进行融合,得到第一损失值;根据第一损失值更新异常事件检测模型,得到更新后的异常事件检测模型。In a possible implementation, the aforementioned updating of the abnormal event detection model according to the pairwise contrast loss value of each node pair to obtain an updated abnormal event detection model may include: fusing the pairwise contrast loss values of multiple node pairs in each event to obtain a first loss value; updating the abnormal event detection model according to the first loss value to obtain an updated abnormal event detection model.
本申请实施方式中,在更新异常事件检测模型中,可以结合每个节点对的对比损失来计算事件整体的节点对对比损失,从而基于整个事件进行学习,学习到可以基于节点之间的相似度来识别异常事件的异常事件检测模型。In the implementation manner of the present application, in updating the abnormal event detection model, the contrast loss of each node pair can be combined to calculate the node pair contrast loss of the event as a whole, so as to learn based on the entire event and learn an abnormal event detection model that can identify abnormal events based on the similarity between nodes.
在一种可能的实施方式中,前述的根据每对节点对的第一相似度获取每个节点的成对对比损失值,可以包括:可以从多个节点中获取第一节点的正样本节点集合,并构造负样本节点集合,正样本节点集合中的节点和第一节点之间的第一相似度高于负样本节点集合中的节点与第一节点之间的第一相似度,第一节点是每个事件中的多个节点中的任意一个;随后通过第一节点与正样本节点集合中的节点之间的第一相似度,与第一节点与负样本节点集合中的节点之间的相似度,计算得到第一节点对应的成对对比损失值。In a possible implementation, the aforementioned obtaining of the pairwise contrast loss value of each node based on the first similarity of each pair of node pairs may include: obtaining a positive sample node set of the first node from multiple nodes, and constructing a negative sample node set, the first similarity between the nodes in the positive sample node set and the first node is higher than the first similarity between the nodes in the negative sample node set and the first node, and the first node is any one of the multiple nodes in each event; then calculating the pairwise contrast loss value corresponding to the first node through the first similarity between the first node and the nodes in the positive sample node set, and the similarity between the first node and the nodes in the negative sample node set.
本申请实施方式中,在采集数据集合时,可以无需单独采集负样本,可以从事件内的节点中采集正样本节点集合,并基于事件内的节点来构造负样本节点集合,从而基于正样本节点集合和负样本节点集合来进行对比学习,从而使学习到的节点对对比模块可以识别出事件中的异常节点。In the implementation manner of the present application, when collecting data sets, there is no need to collect negative samples separately. A positive sample node set can be collected from the nodes within the event, and a negative sample node set can be constructed based on the nodes within the event, so as to perform comparative learning based on the positive sample node set and the negative sample node set, so that the learned node pair comparison module can identify abnormal nodes in the event.
在一种可能的实施方式中,前述的通过第一节点与正样本节点集合中的节点之间的第一相似度,与第一节点与负样本节点集合中的节点之间的相似度,计算得到第一节点对应的成对对比损失值,可以包括:获取温度系数,温度系数与负样本节点集合中的节点与第一节点之间的相似度相关;结合温度系数,通过第一节点与正样本节点集合中的节点之间的第一相似度,与第一节点与负样本节点集合中的节点之间的相似度,计算得到第一节点对应的成对对比损失值。In a possible implementation, the aforementioned calculation of the pairwise contrast loss value corresponding to the first node through the first similarity between the first node and the nodes in the positive sample node set, and the similarity between the first node and the nodes in the negative sample node set, may include: obtaining a temperature coefficient, where the temperature coefficient is related to the similarity between the nodes in the negative sample node set and the first node; and combining the temperature coefficient, calculating the pairwise contrast loss value corresponding to the first node through the first similarity between the first node and the nodes in the positive sample node set, and the similarity between the first node and the nodes in the negative sample node set.
本申请实施方式中,在计算成对对比损失时,可以设置温度系数,从而通过温度系数来调整对于困难样本的关注度,可以降低困难样本对训练结果的影响程度,提高训练效果。In the implementation manner of the present application, a temperature coefficient can be set when calculating the paired contrast loss, so as to adjust the focus on difficult samples through the temperature coefficient, thereby reducing the influence of difficult samples on the training results and improving the training effect.
在一种可能的实施方式中,异常事件检测模型还包括多元交互模块,多元交互模块用于对事件中的节点进行聚类得到至少一种类别,并获取事件中的各个节点与至少一种类别之间的相似度,相似度用于表示对应的事件的异常程度;In a possible implementation, the abnormal event detection model further includes a multivariate interaction module, which is used to cluster nodes in the event to obtain at least one category, and obtain the similarity between each node in the event and at least one category, where the similarity is used to indicate the abnormality degree of the corresponding event;
前述的根据第二属性异质性图构建异常事件检测模型,还可以包括:首先,通过多元交互模块获取每个事件中的多个节点中的至少一个节点与标识符节点之间的第二相似度,该标识符节点可以包括每个事件的中心节点或者对多个节点进行融合后得到的节点;随后根据至少一个节点与标识符节点之间的第二相似度计算第二损失值;随后根据第二损失值更新异常事件检测模型,得到更新后的异常事件检测模型。The aforementioned construction of an abnormal event detection model based on the second attribute heterogeneity graph may also include: first, obtaining a second similarity between at least one node among multiple nodes in each event and an identifier node through a multivariate interaction module, and the identifier node may include a central node of each event or a node obtained by fusing multiple nodes; then calculating a second loss value based on the second similarity between at least one node and the identifier node; then updating the abnormal event detection model based on the second loss value to obtain an updated abnormal event detection model.
通常,事件内可能存在多种节点之间的交互,可以通过构建多元交互模块来识别事件内的节点与事件整体之间的交互异常程度,从而可以准确地识别出事件异常程度。Usually, there may be multiple interactions between nodes within an event. By constructing a multivariate interaction module to identify the degree of abnormal interaction between the nodes within the event and the event as a whole, the degree of abnormality of the event can be accurately identified.
在一种可能的实施方式中,多元交互模块还可以用于对每个事件中的多个节点进行聚类,得到至少一种类别;在计算第二损失值时,即可将第一节点替换为第二节点,第一节点为第一事件中的其中一个点,第二节点为与第一节点的属性相同且类别不同;获取第二节点与标识符节点之间的第三相似度;根据第二相似度和第三相似度计算损失值,得到第二损失值。In a possible implementation, the multivariate interaction module can also be used to cluster multiple nodes in each event to obtain at least one category; when calculating the second loss value, the first node can be replaced by the second node, the first node is one of the points in the first event, and the second node has the same attributes as the first node but a different category; obtain the third similarity between the second node and the identifier node; calculate the loss value based on the second similarity and the third similarity to obtain the second loss value.
本申请实施方式中,可以通过将事件中的节点替换为属性相同单类别不同的节点,从而构造得到负样本,实现无监督对比学习。In the implementation manner of the present application, the nodes in the event can be replaced with nodes with the same attributes but different categories, thereby constructing negative samples and realizing unsupervised contrastive learning.
在一种可能的实施方式中,异常事件检测模型还包括事件对比模块,事件对比模块用于获取事件之间的相似度;前述的根据第二属性异质性图构建异常事件检测模型,还可以包括:首先,从多个事件中 筛选出每个事件对应的正样本集合和负样本集合;随后根据每个事件与正样本集合中的事件之间的第四相似度和每个事件与负样本集合中的事件之间的第五相似度,计算得到第三损失值;随后即可根据第三损失值更新异常事件检测模型,得到更新后的异常事件检测模型。In a possible implementation, the abnormal event detection model further includes an event comparison module, which is used to obtain the similarity between events; the aforementioned construction of the abnormal event detection model based on the second attribute heterogeneity graph may also include: first, from multiple events The positive sample set and the negative sample set corresponding to each event are screened out; then, the third loss value is calculated according to the fourth similarity between each event and the events in the positive sample set and the fifth similarity between each event and the events in the negative sample set; then, the abnormal event detection model can be updated according to the third loss value to obtain an updated abnormal event detection model.
本申请实施方式中,还可以构建事件对比模块来对事件之间的相似度进行识别,并通过筛选事件的正样本集合和负样本集合的方式来实现对比学习,从而实现无监督学习。In the implementation manner of the present application, an event comparison module can also be constructed to identify the similarities between events, and comparative learning can be achieved by screening the positive sample set and the negative sample set of the event, thereby achieving unsupervised learning.
在一种可能的实施方式中,前述的从多个事件中筛选出每个事件对应的正样本集合和负样本集合,可以包括:通过事件对比模块获取每对事件之间的共享节点的数量;获取与第二事件之间共享节点的数量大于第一阈值的至少一个事件,得到正样本集合,第二事件为多个事件中的任意一个事件;获取与第二事件之间共享节点的数量不大于第一阈值的至少一个事件,得到负样本集合。In a possible implementation, the aforementioned screening out of positive sample sets and negative sample sets corresponding to each event from multiple events may include: obtaining the number of shared nodes between each pair of events through an event comparison module; obtaining at least one event whose number of shared nodes with a second event is greater than a first threshold, and obtaining a positive sample set, wherein the second event is any one of the multiple events; obtaining at least one event whose number of shared nodes with the second event is not greater than the first threshold, and obtaining a negative sample set.
本申请实施方式中,可以通过事件之间共享的节点数来确定每个事件的正样本集合和负样本集合,从而可以筛选出相似度较高的样本作为当前样本的正样本,将相似度较低的样本作为当前样本的负样本,以便于后续进行对比学习。In the implementation manner of the present application, the positive sample set and the negative sample set of each event can be determined by the number of nodes shared between events, so that samples with higher similarity can be screened out as positive samples of the current sample, and samples with lower similarity can be screened out as negative samples of the current sample, so as to facilitate subsequent comparative learning.
在一种可能的实施方式中,前述的通过事件对比模块获取多个事件中每对事件之间的第四相似度,可以包括:通过事件对比模块对每个事件进行语义识别,得到每个事件表征;事件对比模块即可根据每个事件表征计算事件之间的第四相似度。In a possible implementation, the aforementioned obtaining of the fourth similarity between each pair of events in a plurality of events through an event comparison module may include: performing semantic recognition on each event through the event comparison module to obtain a representation of each event; and the event comparison module may calculate the fourth similarity between the events based on each event representation.
本申请实施方式中,可以通过语义识别得到每个事件的表征,从而通过表征来准确地计算相似度。In the implementation manner of the present application, the representation of each event can be obtained through semantic recognition, so that the similarity can be accurately calculated through the representation.
在一种可能的实施方式中,前述的根据第二属性异质性图构建异常事件检测模型,还可以包括:首先,将第二属性异质性图中每个事件中的各个节点对应的数据映射至同一空间,得到每个事件在同一空间的第一数据表示;根据第一数据表示构建异常事件检测模型。In a possible implementation, the aforementioned construction of an abnormal event detection model based on the second attribute heterogeneity graph may also include: first, mapping the data corresponding to each node in each event in the second attribute heterogeneity graph to the same space to obtain a first data representation of each event in the same space; and constructing an abnormal event detection model based on the first data representation.
通常,属性异质性图中的节点可能是不同维度的节点,可以将各个节点映射至同一空间中,即可得到各个节点在相同维度中的表征,以便于基于各个节点在相同维度中的表征来进行对比学习,得到异常事件检测模型。Usually, the nodes in the attribute heterogeneity graph may be nodes of different dimensions. By mapping each node to the same space, the representation of each node in the same dimension can be obtained, so as to facilitate comparative learning based on the representation of each node in the same dimension and obtain an abnormal event detection model.
相同维度中的表征第二属性异质性图中的多个事件用于表示:用户的一次金融交易行为、用户发表评论的行为或者用户的物品交易行为。因此,本申请提供的方法构建得到的异常事件检测模型可以应用于多种场景,泛化能力非常强。Multiple events in the second attribute heterogeneity graph in the same dimension are used to represent: a financial transaction behavior of a user, a comment behavior of a user, or an item transaction behavior of a user. Therefore, the abnormal event detection model constructed by the method provided in this application can be applied to a variety of scenarios, and has a very strong generalization ability.
第三方面,本申请提供一种异常事件检测装置,包括:In a third aspect, the present application provides an abnormal event detection device, comprising:
获取模块,用于获取第一属性异质性图,第一属性异质性图中包括至少一个事件,该第一属性异质性图中包括多个节点以及多个节点之间的关联关系,每个事件通过该多个节点中的至少两个节点以及该至少两个节点之间的关联关系表示,每个事件中的每个节点包括形成该事件的事件元素的信息;An acquisition module is used to acquire a first attribute heterogeneity graph, wherein the first attribute heterogeneity graph includes at least one event, the first attribute heterogeneity graph includes a plurality of nodes and association relationships between the plurality of nodes, each event is represented by at least two nodes among the plurality of nodes and the association relationship between the at least two nodes, and each node in each event includes information of event elements forming the event;
检测模块,用于将第一属性异质性图作为异常事件检测模型的输入,得到输出结果,输出结果用于表示至少一个事件中是否包括异常事件,异常事件为根据事件之间的相似度或者事件内的节点之间的相似度确定。The detection module is used to use the first attribute heterogeneity graph as the input of the abnormal event detection model to obtain an output result, and the output result is used to indicate whether at least one event includes an abnormal event, and the abnormal event is determined based on the similarity between events or the similarity between nodes within an event.
需要说明的是,第四方面以及第四方面任一可选实施方式中所实现的效果可以参阅前述第一方面或第一方面任一可选实施方式所实现的效果,此处不再赘述。It should be noted that the effects achieved in the fourth aspect and any optional implementation manner of the fourth aspect can refer to the effects achieved in the aforementioned first aspect or any optional implementation manner of the first aspect, and will not be repeated here.
在一种可能的实施方式中,异常事件检测模型包括以下一种或者多种模块:节点对对比模块、多元交互模块或事件对比模块,节点对比模块用于获取事件内的节点之间的相似度,多元交互模块用于获取事件内的节点和事件类别之间的相似度,事件对比模块用于获取事件之间的相似度。In one possible implementation, the abnormal event detection model includes one or more of the following modules: a node pair comparison module, a multivariate interaction module or an event comparison module. The node comparison module is used to obtain the similarity between nodes within an event. The multivariate interaction module is used to obtain the similarity between nodes within an event and event categories. The event comparison module is used to obtain the similarity between events.
在一种可能的实施方式中,若异常事件检测模型包括节点对对比模块,检测模块,具体用于:根据节点对对比模块输出每个事件的第一异常程度,其中,节点对对比模块用于获取每个事件中的节点对之间的相似度,并根据每个事件中的节点对之间的相似度得到第一异常程度;根据每个事件的第一异常程度,判断每个事件是否为异常事件,以得到输出结果。In a possible implementation, if the abnormal event detection model includes a node pair comparison module, the detection module is specifically used to: output a first abnormality degree of each event according to the node pair comparison module, wherein the node pair comparison module is used to obtain the similarity between the node pairs in each event, and obtain the first abnormality degree according to the similarity between the node pairs in each event; according to the first abnormality degree of each event, determine whether each event is an abnormal event to obtain an output result.
在一种可能的实施方式中,若异常事件检测模型包括多元交互模块,则检测模块,具体用于:通过多元交互模块输出每个事件的第二异常程度,其中,多元交互模块用于对至少一个事件中的多个节点进行融合,得到标识符节点,或者将每个事件的中心点作为标识符节点,并通过至少一个节点与标识符节点之间的相似度获取每个事件的第二异常程度;根据每个事件的第二异常程度,判断每个事件是否为异 常事件,以得到输出结果。In a possible implementation, if the abnormal event detection model includes a multivariate interaction module, the detection module is specifically used to: output the second abnormality degree of each event through the multivariate interaction module, wherein the multivariate interaction module is used to fuse multiple nodes in at least one event to obtain an identifier node, or use the center point of each event as the identifier node, and obtain the second abnormality degree of each event through the similarity between at least one node and the identifier node; determine whether each event is abnormal according to the second abnormality degree of each event; Normal events to get output results.
在一种可能的实施方式中,若异常事件检测模型包括事件对比模块,则检测模块,具体用于:通过事件对比模块输出每个事件的第三异常程度,其中,事件对比模块用于获取事件对之间的相似度,根据事件对之间的相似度计算每个事件的第三异常程度;根据每个事件的第三异常程度,判断每个事件是否为异常事件,以得到输出结果。In a possible implementation, if the abnormal event detection model includes an event comparison module, the detection module is specifically used to: output the third abnormality degree of each event through the event comparison module, wherein the event comparison module is used to obtain the similarity between event pairs, and calculate the third abnormality degree of each event based on the similarity between the event pairs; based on the third abnormality degree of each event, determine whether each event is an abnormal event to obtain an output result.
在一种可能的实施方式中,事件对比模块,具体用于:从多个事件中筛选出每个事件分别对应的正样本集合;根据每个事件和对应的正样本集合中的事件之间的相似度,得到每个事件的第三异常程度。In a possible implementation, the event comparison module is specifically used to: filter out a positive sample set corresponding to each event from multiple events; and obtain a third abnormality degree of each event based on the similarity between each event and an event in the corresponding positive sample set.
在一种可能的实施方式中,事件对比模块,具体用于:对每个事件进行语义识别,得到每个事件的表征;根据每个事件的表征计算每个事件与对应的正样本集合中的事件之间的相似度。In a possible implementation, the event comparison module is specifically used to: perform semantic recognition on each event to obtain a representation of each event; and calculate the similarity between each event and an event in a corresponding positive sample set based on the representation of each event.
在一种可能的实施方式中,若异常事件检测模型包括节点对对比模块、多元交互模块和事件对比模块,则检测模块,具体用于:将第一属性异质性图分别作为节点对对比模块、多元交互模块和事件对比模块的输入;对节点对对比模块输出的每个事件的第一异常程度、多元交互模块输出的每个事件的第二异常程度和事件对比模块输出的每个事件的第三异常程度进行融合,得到每个事件的第四异常程度;根据每个事件的第四异常程度判断每个事件是否为异常事件,以得到输出结果。In a possible implementation, if the abnormal event detection model includes a node pair comparison module, a multivariate interaction module and an event comparison module, the detection module is specifically used to: use the first attribute heterogeneity graph as the input of the node pair comparison module, the multivariate interaction module and the event comparison module respectively; fuse the first abnormality degree of each event output by the node pair comparison module, the second abnormality degree of each event output by the multivariate interaction module and the third abnormality degree of each event output by the event comparison module to obtain the fourth abnormality degree of each event; judge whether each event is an abnormal event according to the fourth abnormality degree of each event to obtain an output result.
在一种可能的实施方式中,检测模块,具体用于:将第一属性异质性图中每个事件中的各个节点映射至同一空间,得到每个事件在同一空间的第二数据表示;将第二数据表示作为异常事件检测模型的输入,以得到输出结果。In a possible implementation, the detection module is specifically used to: map each node in each event in the first attribute heterogeneity graph to the same space to obtain a second data representation of each event in the same space; and use the second data representation as an input to an abnormal event detection model to obtain an output result.
在一种可能的实施方式中,第一属性异质性图中的至少一个事件用于表示:用户的一次金融交易行为、用户发表评论的行为或者用户的物品交易行为。In a possible implementation, at least one event in the first attribute heterogeneity graph is used to represent: a financial transaction behavior of a user, a comment-posting behavior of a user, or an item transaction behavior of a user.
第四方面,本申请提供一种异常事件检测模型构建装置,包括:In a fourth aspect, the present application provides a device for constructing an abnormal event detection model, comprising:
获取模块,用于获取第二属性异质性图,第二属性异质性图表示多个事件,该第二属性异质性图中包括多个节点以及多个节点之间的关联关系,每个事件通过该多个节点中的至少两个节点以及该至少两个节点之间的关联关系表示,每个事件中的节点包括形成该事件的事件元素的信息;an acquisition module, configured to acquire a second attribute heterogeneity graph, wherein the second attribute heterogeneity graph represents a plurality of events, the second attribute heterogeneity graph includes a plurality of nodes and association relationships between the plurality of nodes, each event is represented by at least two nodes among the plurality of nodes and the association relationship between the at least two nodes, and the node in each event includes information of event elements forming the event;
构建模块,用于根据第二属性异质性图构建异常事件检测模型,异常事件检测模型用于检测多个事件中的异常事件,异常事件为根据事件之间的相似度或者事件内的节点之间的相似度确定。A construction module is used to construct an abnormal event detection model according to the second attribute heterogeneity graph. The abnormal event detection model is used to detect abnormal events among multiple events. The abnormal events are determined based on the similarity between events or the similarity between nodes within an event.
需要说明的是,第四方面以及第四方面任一可选实施方式中所实现的效果可以参阅前述第二方面或第二方面任一可选实施方式所实现的效果,此处不再赘述。It should be noted that the effects achieved in the fourth aspect and any optional implementation of the fourth aspect can refer to the effects achieved in the aforementioned second aspect or any optional implementation of the second aspect, and will not be repeated here.
在一种可能的实施方式中,异常事件检测模型包括节点对对比模块,节点对对比模块用于获取节点对的相似度,相似度用于表示事件的异常程度;In a possible implementation, the abnormal event detection model includes a node pair comparison module, which is used to obtain the similarity of the node pairs, and the similarity is used to indicate the abnormality degree of the event;
构建模块,具体用于:将每个事件中的多个节点组成至少一对节点对;通过节点对对比模块,获取至少一对节点对中每对节点对的第一相似度;根据每对节点对的第一相似度获取多个节点中每个节点的成对对比损失值;根据每个节点对的成对对比损失值更新异常事件检测模型,得到更新后的异常事件检测模型。The construction module is specifically used to: group multiple nodes in each event into at least one pair of node pairs; obtain the first similarity of each pair of node pairs in at least one pair of node pairs through the node pair comparison module; obtain the pairwise comparison loss value of each node in the multiple nodes according to the first similarity of each pair of node pairs; update the abnormal event detection model according to the pairwise comparison loss value of each node pair to obtain the updated abnormal event detection model.
在一种可能的实施方式中,构建模块,具体用于:对每个事件中的多个节点对的成对对比损失值进行融合,得到第一损失值;根据第一损失值更新异常事件检测模型,得到更新后的异常事件检测模型。In a possible implementation, the construction module is specifically used to: fuse the pairwise comparison loss values of multiple node pairs in each event to obtain a first loss value; and update the abnormal event detection model according to the first loss value to obtain an updated abnormal event detection model.
在一种可能的实施方式中,构建模块,具体用于:从多个节点中获取第一节点的正样本节点集合,并构造负样本节点集合,正样本节点集合中的节点和第一节点之间的第一相似度高于负样本节点集合中的节点与第一节点之间的第一相似度,第一节点是每个事件中的多个节点中的任意一个;通过第一节点与正样本节点集合中的节点之间的第一相似度,与第一节点与负样本节点集合中的节点之间的相似度,计算得到第一节点对应的成对对比损失值。In a possible implementation, a construction module is specifically used to: obtain a positive sample node set of a first node from multiple nodes, and construct a negative sample node set, the first similarity between the nodes in the positive sample node set and the first node is higher than the first similarity between the nodes in the negative sample node set and the first node, and the first node is any one of the multiple nodes in each event; calculate the pairwise comparison loss value corresponding to the first node through the first similarity between the first node and the nodes in the positive sample node set, and the similarity between the first node and the nodes in the negative sample node set.
在一种可能的实施方式中,构建模块,具体用于:获取温度系数,温度系数与负样本节点集合中的节点与第一节点之间的相似度相关;结合温度系数,通过第一节点与正样本节点集合中的节点之间的第一相似度,与第一节点与负样本节点集合中的节点之间的相似度,计算得到第一节点对应的成对对比损失值。In one possible implementation, a construction module is specifically used to: obtain a temperature coefficient, where the temperature coefficient is related to the similarity between the nodes in the negative sample node set and the first node; and calculate the pairwise comparison loss value corresponding to the first node in combination with the temperature coefficient through the first similarity between the first node and the nodes in the positive sample node set, and the similarity between the first node and the nodes in the negative sample node set.
在一种可能的实施方式中,异常事件检测模型还包括多元交互模块,多元交互模块用于对事件中的 节点进行聚类得到至少一种类别,并获取事件中的各个节点与至少一种类别之间的相似度,相似度用于表示对应的事件的异常程度;In a possible implementation, the abnormal event detection model further includes a multivariate interaction module, which is used to Nodes are clustered to obtain at least one category, and the similarity between each node in the event and at least one category is obtained. The similarity is used to indicate the abnormality degree of the corresponding event;
构建模块,还用于通过多元交互模块获取每个事件中的多个节点中的至少一个节点与标识符节点之间的第二相似度,标识符节点包括每个事件的中心节点或者对多个节点进行融合后得到的节点;根据至少一个节点与标识符节点之间的第二相似度计算第二损失值;根据第二损失值更新异常事件检测模型,得到更新后的异常事件检测模型。The construction module is also used to obtain the second similarity between at least one node among multiple nodes in each event and the identifier node through the multivariate interaction module, the identifier node includes the central node of each event or a node obtained by fusing multiple nodes; calculate the second loss value according to the second similarity between at least one node and the identifier node; update the abnormal event detection model according to the second loss value to obtain the updated abnormal event detection model.
在一种可能的实施方式中,多元交互模块还用于对每个事件中的多个节点进行聚类,得到至少一种类别;In a possible implementation, the multivariate interaction module is further used to cluster multiple nodes in each event to obtain at least one category;
构建模块,具体用于:将第一节点替换为第二节点,第一节点为第一事件中的其中一个点,第二节点为与第一节点的属性相同且类别不同;获取第二节点与标识符节点之间的第三相似度;根据第二相似度和第三相似度计算损失值,得到第二损失值。The construction module is specifically used to: replace the first node with the second node, the first node is one of the points in the first event, and the second node has the same attributes as the first node but a different category; obtain the third similarity between the second node and the identifier node; calculate the loss value according to the second similarity and the third similarity to obtain the second loss value.
在一种可能的实施方式中,异常事件检测模型还包括事件对比模块,事件对比模块用于获取事件之间的相似度;In a possible implementation, the abnormal event detection model further includes an event comparison module, which is used to obtain similarities between events;
构建模块,具体用于:从多个事件中筛选出每个事件对应的正样本集合和负样本集合;根据每个事件与正样本集合中的事件之间的第四相似度和每个事件与负样本集合中的事件之间的第五相似度,计算得到第三损失值;根据第三损失值更新异常事件检测模型,得到更新后的异常事件检测模型。The construction module is specifically used to: filter out a positive sample set and a negative sample set corresponding to each event from multiple events; calculate a third loss value based on a fourth similarity between each event and the events in the positive sample set and a fifth similarity between each event and the events in the negative sample set; update the abnormal event detection model based on the third loss value to obtain an updated abnormal event detection model.
在一种可能的实施方式中,构建模块,具体用于:通过事件对比模块获取每对事件之间的共享节点的数量;获取与第二事件之间共享节点的数量大于第一阈值的至少一个事件,得到正样本集合,第二事件为多个事件中的任意一个事件;获取与第二事件之间共享节点的数量不大于第一阈值的至少一个事件,得到负样本集合。In one possible implementation, a construction module is specifically used to: obtain the number of shared nodes between each pair of events through an event comparison module; obtain at least one event whose number of shared nodes with a second event is greater than a first threshold, and obtain a positive sample set, where the second event is any one of multiple events; obtain at least one event whose number of shared nodes with the second event is not greater than the first threshold, and obtain a negative sample set.
在一种可能的实施方式中,构建模块,具体用于:通过事件对比模块对每个事件进行语义识别,得到每个事件表征;通过事件对比模块根据每个事件表征计算事件之间的第四相似度。In a possible implementation, the construction module is specifically used to: perform semantic recognition on each event through an event comparison module to obtain each event representation; and calculate the fourth similarity between events according to each event representation through the event comparison module.
在一种可能的实施方式中,构建模块,还用于:第二属性异质性图中每个事件中的各个节点对应的数据映射至同一空间,得到每个事件在同一空间的第一数据表示;根据第一数据表示构建异常事件检测模型。In a possible implementation, the construction module is also used to: map the data corresponding to each node in each event in the second attribute heterogeneity graph to the same space to obtain a first data representation of each event in the same space; and construct an abnormal event detection model based on the first data representation.
在一种可能的实施方式中,第二属性异质性图中的多个事件用于表示:用户的一次金融交易行为、用户发表评论的行为或者用户的物品交易行为。In a possible implementation, the multiple events in the second attribute heterogeneity graph are used to represent: a financial transaction behavior of a user, a comment-posting behavior of a user, or an item transaction behavior of a user.
第五方面,本申请提供一种异常事件检测模型,包括:节点对对比模块、多元交互模块或事件对比模块中的至少一种,节点对比模块用于获取事件内的节点之间的相似度,多元交互模块用于获取事件内的节点和事件类别之间的相似度,事件对比模块用于获取事件之间的相似度。In a fifth aspect, the present application provides an abnormal event detection model, comprising: at least one of a node pair comparison module, a multivariate interaction module or an event comparison module, the node comparison module is used to obtain the similarity between nodes within an event, the multivariate interaction module is used to obtain the similarity between nodes within an event and event categories, and the event comparison module is used to obtain the similarity between events.
该异常事件检测模型可以用于执行前述第一方面或第一方面中任一可选实施方式中的步骤,此处不再赘述。The abnormal event detection model can be used to execute the steps in the aforementioned first aspect or any optional implementation manner of the first aspect, which will not be repeated here.
第六方面,本申请实施例提供一种异常事件检测模型构建装置,包括:处理器和存储器,其中,处理器和存储器通过线路互联,处理器调用存储器中的程序代码用于执行上述第二方面任一项所示的用于异常事件检测模型构建方法中与处理相关的功能。可选地,该异常事件检测模型构建装置可以是芯片。In a sixth aspect, an embodiment of the present application provides an abnormal event detection model construction device, comprising: a processor and a memory, wherein the processor and the memory are interconnected via a line, and the processor calls the program code in the memory to execute the processing-related functions in the abnormal event detection model construction method shown in any one of the second aspects above. Optionally, the abnormal event detection model construction device can be a chip.
第七方面,本申请实施例提供一种异常事件检测装置,包括:处理器和存储器,其中,处理器和存储器通过线路互联,处理器调用存储器中的程序代码用于执行上述第一方面任一项所示的用于异常事件检测方法中与处理相关的功能。可选地,该异常事件检测装置可以是芯片。In a seventh aspect, an embodiment of the present application provides an abnormal event detection device, comprising: a processor and a memory, wherein the processor and the memory are interconnected via a line, and the processor calls a program code in the memory to execute the processing-related functions in the abnormal event detection method shown in any one of the first aspects above. Optionally, the abnormal event detection device can be a chip.
第八方面,本申请实施例提供了一种异常事件检测模型构建装置,该异常事件检测模型构建装置也可以称为数字处理芯片或者芯片,芯片包括处理单元和通信接口,处理单元通过通信接口获取程序指令,程序指令被处理单元执行,处理单元用于执行如上述第二方面或第二方面任一可选实施方式中与处理相关的功能。In the eighth aspect, an embodiment of the present application provides an abnormal event detection model construction device, which can also be called a digital processing chip or chip. The chip includes a processing unit and a communication interface. The processing unit obtains program instructions through the communication interface, and the program instructions are executed by the processing unit. The processing unit is used to perform functions related to processing as described in the second aspect or any optional embodiment of the second aspect.
第九方面,本申请实施例提供了一种异常事件检测装置,该异常事件检测装置也可以称为数字处理芯片或者芯片,芯片包括处理单元和通信接口,处理单元通过通信接口获取程序指令,程序指令被处理单元执行,处理单元用于执行如上述第一方面或第一方面任一可选实施方式中与处理相关的功能。 In the ninth aspect, an embodiment of the present application provides an abnormal event detection device, which may also be referred to as a digital processing chip or chip. The chip includes a processing unit and a communication interface. The processing unit obtains program instructions through the communication interface, and the program instructions are executed by the processing unit. The processing unit is used to perform functions related to processing in the above-mentioned first aspect or any optional embodiment of the first aspect.
第十方面,本申请实施例提供了一种计算机可读存储介质,包括指令,当其在计算机上运行时,使得计算机执行上述第一方面或第二方面中任一可选实施方式中的方法。In the tenth aspect, an embodiment of the present application provides a computer-readable storage medium, including instructions, which, when executed on a computer, enables the computer to execute a method in any optional implementation of the first aspect or the second aspect above.
第十一方面,本申请实施例提供了一种包含指令的计算机程序产品,当其在计算机上运行时,使得计算机执行上述第一方面或第二方面中任一可选实施方式中的方法。In the eleventh aspect, an embodiment of the present application provides a computer program product comprising instructions, which, when executed on a computer, enables the computer to execute a method in any optional implementation of the first aspect or the second aspect.
附图说明BRIEF DESCRIPTION OF THE DRAWINGS
图1为本申请提供的一种系统架构示意图;FIG1 is a schematic diagram of a system architecture provided by the present application;
图2为本申请提供的另一种系统架构示意图;FIG2 is a schematic diagram of another system architecture provided by the present application;
图3为本申请提供的另一种系统架构示意图;FIG3 is a schematic diagram of another system architecture provided by the present application;
图4为本申请提供的一种异常事件检测模型构建方法的流程示意图;FIG4 is a flow chart of a method for constructing an abnormal event detection model provided by the present application;
图5为本申请提供的一种属性异质性图的结构示意图;FIG5 is a schematic diagram of the structure of an attribute heterogeneity graph provided by the present application;
图6为本申请提供的另一种属性异质性图的结构示意图;FIG6 is a schematic diagram of the structure of another attribute heterogeneity graph provided by the present application;
图7为本申请提供的一种星型结构数据的结构示意图;FIG7 is a schematic diagram of a structure of star-structured data provided by the present application;
图8为本申请提供的一种异常事件检测方法的流程示意图;FIG8 is a flow chart of an abnormal event detection method provided by the present application;
图9为本申请提供的另一种系统架构示意图;FIG9 is a schematic diagram of another system architecture provided by the present application;
图10为本申请提供的另一种异常事件检测模型构建方法的流程示意图;FIG10 is a flow chart of another abnormal event detection model construction method provided by the present application;
图11为本申请提供的另一种异常事件检测方法的流程示意图;FIG11 is a flow chart of another abnormal event detection method provided by the present application;
图12为本申请提供的一种常事件检测模型构建装置的结构示意图;FIG12 is a schematic diagram of the structure of a common event detection model building device provided by the present application;
图13为本申请提供的一种异常事件检测装置的结构示意图;FIG13 is a schematic diagram of the structure of an abnormal event detection device provided by the present application;
图14为本申请提供的另一种常事件检测模型构建装置的结构示意图;FIG14 is a schematic diagram of the structure of another common event detection model building device provided by the present application;
图15为本申请提供的另一种异常事件检测装置的结构示意图;FIG15 is a schematic diagram of the structure of another abnormal event detection device provided by the present application;
图16为本申请提供的一种芯片的结构示意图。FIG16 is a schematic diagram of the structure of a chip provided in the present application.
具体实施方式Detailed ways
下面将结合本申请实施例中的附图,对本申请实施例中的技术方案进行描述,显然,所描述的实施例仅仅是本申请一部分实施例,而不是全部的实施例。基于本申请中的实施例,本领域技术人员在没有作出创造性劳动前提下所获得的所有其他实施例,都属于本申请保护的范围。The following will describe the technical solutions in the embodiments of the present application in conjunction with the drawings in the embodiments of the present application. Obviously, the described embodiments are only part of the embodiments of the present application, not all of the embodiments. Based on the embodiments in the present application, all other embodiments obtained by those skilled in the art without creative work are within the scope of protection of the present application.
在用户的工作或者生活等多种场景中,用户的每次行为将与一些实体关联或者产生一些数据,可以以用户的一次行为或者该行为产生的数据作为一个事件。通常事件可能包括多种属性的事件元素节点,节点之间可能存在复杂交互,从而形成属性异构信息网络(attributed heterogeneous information network,AHIN)。且随着信息技术的发展,如社交媒体的蓬勃发展,属性异构信息网络中的异常事件检测已经成为一项重要任务。In various scenarios such as work or life, each user's behavior will be associated with some entities or generate some data. A user's behavior or the data generated by the behavior can be regarded as an event. Usually, an event may include event element nodes with multiple attributes, and there may be complex interactions between nodes, thus forming an attributed heterogeneous information network (AHIN). And with the development of information technology, such as the booming development of social media, abnormal event detection in attributed heterogeneous information networks has become an important task.
然而,在用户的日常交互行为中,将可能产生不利于用户安全的行为或者数据。如金融欺诈、社交平台水军或者违禁物品交易等。为了提高用户的安全性,可以对异常事件进行检测,识别出异常事件。However, in the daily interaction of users, behaviors or data that are not conducive to user safety may be generated, such as financial fraud, social platform trolls, or prohibited goods transactions. In order to improve user safety, abnormal events can be detected and identified.
如一些场景中,以APE为例,可以通过神经网络来进行异常事件检测,通过建模事件中事件元素之间的两两交互模式,来得到事件整体的异常程度。其输入数据包括事件集合,每个时间由类别属性组成。模型首先将输入通过表征查询层(embedding lookup)得到每个类别属性的表示,然后建模属性间的两两交互得分,最后对所有得分进行按交互类别加权得到整个事件的异常得分。交互得分采用向量点乘的形式,得分越高说明此交互越正常。通过对得分进行加权求和,模型可以自动学到不同类型节点交互的重要性。由于需要对所有可能事件的得分进行求和,计算复杂度太大,利用了噪声对比估计(noise-contrastive estimation),即并不计算所有可能的事件得分,而是通过采样噪声事件来近似。对于噪声事件,提出了一种上下文依赖(context dependent)的噪声事件构造方法,即对于每一个事件,通过替换掉一个同类型的其他实体来得到噪声事件。通过最大化正常事件的得分来优化最终的损失函数,那么对于一个正常事件,它的得分比较高,而对于异常事件,得分比较低。然而,这种检测方式仅适用于简单的类别事件异常检测(即每个事件元素的表示只是一个数值等简单属性),并且只建模了 实体间的两两交互,对于建模属性异质图中不同种类实体的丰富属性和大量的复杂交互,是远远不够的。In some scenarios, such as APE, neural networks can be used to detect abnormal events. By modeling the interaction patterns between event elements in an event, the overall abnormality of the event can be obtained. The input data includes a set of events, each of which is composed of category attributes. The model first passes the input through the embedding lookup layer to obtain the representation of each category attribute, then models the pairwise interaction scores between attributes, and finally weights all scores according to the interaction category to obtain the abnormality score of the entire event. The interaction score is in the form of vector dot product, and the higher the score, the more normal the interaction. By weighted summing the scores, the model can automatically learn the importance of different types of node interactions. Since the scores of all possible events need to be summed, the computational complexity is too large, so noise-contrastive estimation is used, that is, not all possible event scores are calculated, but approximated by sampling noise events. For noise events, a context-dependent noise event construction method is proposed, that is, for each event, a noise event is obtained by replacing another entity of the same type. By maximizing the score of normal events to optimize the final loss function, a normal event will have a higher score, while an abnormal event will have a lower score. However, this detection method is only suitable for simple category event anomaly detection (i.e., the representation of each event element is just a simple attribute such as a value), and only models The pairwise interactions between entities are far from sufficient to model the rich attributes and large number of complex interactions of different types of entities in attribute heterogeneous graphs.
又例如,以AEHE为例,一些场景中,可以在建模事件实体间的两两交互模式的基础上,融入了实体在异质图中基于元路径(meta path)的二阶邻居信息。联合了属性和结构上的异常来检测异常事件。其输入是事件集合,每个事件由异质图中的元路径代表。模型首先将实体的属性特征进行线性变换,得到每个实体的表示,然后利用自编码器(autoencoder)重构了每个实体的二阶邻居矩阵,得到自编码器的中间表示,将此中间表示和实体表示进行拼接得到实体的最终表示。自编码器建模结构上的异常,于异常结构和正常结构,自编码器的中间表示是不同的。得到实体最终表示之后,通过向量点乘建模实体间的两两交互,最后对两两交互得分进行加权求和,得到最终的异常事件得分。模型采用替换事件中一个实体的方法来得到异常事件,损失函数包括自编码器重构损失,事件得分损失和正则化损失。通过最小化损失函数来最大化正常事件的得分,那么对于一个正常事件,它的得分比较高,而对于异常事件,得分比较低。然而,这种检测方式定义异常事件为异质图中的元路径实例,但是异质图中包含更加复杂的事件(比如网络模式实例),这种事件在用户的生活中可能更普遍。只检测基于元路径的异常事件无法扩展到检测更加丰富的事件。并且此方案只建模了实体间的两两交互异常,这对于异质图中复杂交互建模是远远不够的,同时重构全局高阶邻居的方法很难扩展到稠密大规模图上,也无法充分利用异质图的局部结构信息。For another example, taking AEHE as an example, in some scenarios, the second-order neighbor information of entities based on meta-path in heterogeneous graphs can be integrated on the basis of modeling the pairwise interaction patterns between event entities. Abnormal events are detected by combining attribute and structural anomalies. Its input is a set of events, each of which is represented by a meta-path in a heterogeneous graph. The model first linearly transforms the attribute features of the entity to obtain the representation of each entity, and then reconstructs the second-order neighbor matrix of each entity using an autoencoder to obtain the intermediate representation of the autoencoder, and then concatenates this intermediate representation with the entity representation to obtain the final representation of the entity. The autoencoder models structural anomalies, and the intermediate representation of the autoencoder is different for abnormal structures and normal structures. After obtaining the final representation of the entity, the pairwise interaction between entities is modeled by vector dot multiplication, and finally the pairwise interaction scores are weighted summed to obtain the final abnormal event score. The model uses the method of replacing one entity in the event to obtain abnormal events, and the loss function includes autoencoder reconstruction loss, event score loss and regularization loss. By minimizing the loss function to maximize the score of normal events, a normal event will have a higher score, while an abnormal event will have a lower score. However, this detection method defines abnormal events as meta-path instances in heterogeneous graphs, but heterogeneous graphs contain more complex events (such as network pattern instances), which may be more common in users' lives. Detecting only abnormal events based on meta-paths cannot be extended to detecting richer events. Moreover, this scheme only models the pairwise interaction anomalies between entities, which is far from enough for modeling complex interactions in heterogeneous graphs. At the same time, the method of reconstructing global high-order neighbors is difficult to extend to dense large-scale graphs, and cannot fully utilize the local structural information of heterogeneous graphs.
尽管异常事件的检测已经引起了用户的广泛关注,但已有的异常事件检测方式主要关注于对单个事件中实体之间的简单交互进行建模。然而,常见场景中的事件可能包含具有丰富属性的多种类型的实体,以及这些实体之间的复杂交互,从而形成一个属性异构信息网络(attributed heterogeneous information network,AHIN)。检测属性异质图中的异常事件是一个更加普遍的问题。Although the detection of abnormal events has attracted widespread attention from users, existing abnormal event detection methods mainly focus on modeling simple interactions between entities in a single event. However, events in common scenarios may contain multiple types of entities with rich attributes, as well as complex interactions between these entities, forming an attributed heterogeneous information network (AHIN). Detecting abnormal events in attribute heterogeneous graphs is a more general problem.
因此,急需解决以下问题:Therefore, the following problems need to be solved urgently:
如何对AHIN中复杂的事件模式进行建模。AHIN中的事件包含不同类型的丰富属性节点,这些节点构成一个完整的语义单元。这些节点之间的交互更加复杂。如发表论文的事件与许多类型的属性节点相关联,使得节点之间的交互不限于结构交互(例如,作者撰写论文),而是有意义的语义交互(例如,专门从事数据挖掘的作者与放射科医生合作撰写文本处理论文),因此,除了简单的成对交互异常模式外,AHIN中还存在更复杂、多样的异常模式。在这方面,本申请提出一个通用框架来模拟AHIN中的事件,并充分考虑各种异常模式。How to model complex event patterns in AHIN. Events in AHIN contain different types of rich attribute nodes, which constitute a complete semantic unit. The interactions between these nodes are more complex. For example, the event of publishing a paper is associated with many types of attribute nodes, so that the interactions between nodes are not limited to structural interactions (e.g., authors write papers), but meaningful semantic interactions (e.g., authors specializing in data mining collaborate with radiologists to write text processing papers). Therefore, in addition to simple pairwise interaction anomaly patterns, there are more complex and diverse anomaly patterns in AHIN. In this regard, the present application proposes a general framework to model events in AHIN and fully consider various anomaly patterns.
如何在无监督的情况下检测AHIN中的异常事件。由于异常的稀缺性和标记过程的高昂成本,因此本申请提供的方法以无监督的方式进行异常事件检测,即本申请对异常事件没有先验知识。此外,与大多数只需要收集正常事件进行训练的异常事件检测方法不同,本申请设置的训练集包括了异常事件。也即,异常事件检测模型必须在没有任何监督的情况下,从包含了异常事件的AHIN中得出正常模式。因此,AHIN中异常事件检测的关键是充分利用现有样本中有价值的信息。受之前同质图异常节点检测的启发,一些已有的方式可以直接建模节点及其上下文节点之间的正常模式。然而,这种方式不足以充分捕捉AHIN中复杂的事件交互模式,也不足以在无监督的情况下测量异常程度,需要一个适当的异常事件评分函数,该函数应能真实反映事件的异常程度。How to detect abnormal events in AHIN without supervision. Due to the scarcity of anomalies and the high cost of the labeling process, the method provided in this application performs abnormal event detection in an unsupervised manner, that is, this application has no prior knowledge of abnormal events. In addition, unlike most abnormal event detection methods that only need to collect normal events for training, the training set set in this application includes abnormal events. That is, the abnormal event detection model must derive normal patterns from AHIN containing abnormal events without any supervision. Therefore, the key to abnormal event detection in AHIN is to make full use of valuable information in existing samples. Inspired by the previous detection of abnormal nodes in homogeneous graphs, some existing methods can directly model the normal patterns between nodes and their context nodes. However, this method is not enough to fully capture the complex event interaction patterns in AHIN, nor is it enough to measure the degree of abnormality in an unsupervised manner. An appropriate abnormal event scoring function is required, which should be able to truly reflect the degree of abnormality of the event.
因此,本申请提供一种基于对比学习的异常事件模型的构建方法以及异常事件检测方法,可以基于AHIN以及对比学习构建异常事件检测模型,可以对更复杂的事件进行检测,准确地识别出异常事件,可以应用于多种场景,泛化能力非常强。Therefore, the present application provides a method for constructing an abnormal event model based on contrastive learning and an abnormal event detection method. The abnormal event detection model can be constructed based on AHIN and contrastive learning, more complex events can be detected, abnormal events can be accurately identified, and it can be applied to a variety of scenarios with very strong generalization ability.
本申请提供的方法可以应用于人工智能(artificial intelligence,AI)场景中。AI是利用数字计算机或者数字计算机控制的机器模拟、延伸和扩展人的智能,感知环境、获取知识并使用知识获得最佳结果的理论、方法、技术及应用系统。换句话说,人工智能是计算机科学的一个分支,它企图了解智能的实质,并生产出一种新的能以人类智能相似的方式作出反应的智能机器。人工智能也就是研究各种智能机器的设计原理与实现方法,使机器具有感知、推理与决策的功能。人工智能领域的研究包括机器人,自然语言处理,计算机视觉,决策与推理,人机交互,推荐与搜索,AI基础理论等。The method provided in this application can be applied to artificial intelligence (AI) scenarios. AI is a theory, method, technology and application system that uses digital computers or machines controlled by digital computers to simulate, extend and expand human intelligence, perceive the environment, acquire knowledge and use knowledge to obtain the best results. In other words, artificial intelligence is a branch of computer science that attempts to understand the essence of intelligence and produce a new intelligent machine that can respond in a similar way to human intelligence. Artificial intelligence is to study the design principles and implementation methods of various intelligent machines so that the machines have the functions of perception, reasoning and decision-making. Research in the field of artificial intelligence includes robotics, natural language processing, computer vision, decision-making and reasoning, human-computer interaction, recommendation and search, basic AI theory, etc.
首先对人工智能系统总体工作流程进行描述,下面从“智能信息链”(水平轴)和“IT价值链”(垂直轴)两个维度对上述人工智能主题框架进行阐述。其中,“智能信息链”反映从数据的获取到处理的 一列过程。举例来说,可以是智能信息感知、智能信息表示与形成、智能推理、智能决策、智能执行与输出的一般过程。在这个过程中,数据经历了“数据—信息—知识—智慧”的凝练过程。“IT价值链”从人智能的底层基础设施、信息(提供和处理技术实现)到系统的产业生态过程,反映人工智能为信息技术产业带来的价值。First, the overall workflow of the artificial intelligence system is described. Next, the above artificial intelligence theme framework is explained from two dimensions: "intelligent information chain" (horizontal axis) and "IT value chain" (vertical axis). Among them, the "intelligent information chain" reflects the process from data acquisition to processing. A series of processes. For example, it can be a general process of intelligent information perception, intelligent information representation and formation, intelligent reasoning, intelligent decision-making, intelligent execution and output. In this process, data undergoes the condensation process of "data-information-knowledge-wisdom". The "IT value chain" reflects the value that artificial intelligence brings to the information technology industry from the underlying infrastructure of human intelligence, information (providing and processing technology implementation) to the industrial ecological process of the system.
(1)基础设施(1) Infrastructure
基础设施为人工智能系统提供计算能力支持,实现与外部世界的沟通,并通过基础平台实现支撑。通过传感器与外部沟通;计算能力由智能芯片(CPU、NPU、GPU、ASIC、FPGA等硬件加速芯片)提供;基础平台包括分布式计算框架及网络等相关的平台保障和支持,可以包括云存储和计算、互联互通网络等。举例来说,传感器和外部沟通获取数据,这些数据提供给基础平台提供的分布式计算系统中的智能芯片进行计算。The infrastructure provides computing power support for the artificial intelligence system, enables communication with the outside world, and is supported by the basic platform. It communicates with the outside world through sensors; computing power is provided by smart chips (CPU, NPU, GPU, ASIC, FPGA and other hardware acceleration chips); the basic platform includes distributed computing frameworks and networks and other related platform guarantees and support, which can include cloud storage and computing, interconnected networks, etc. For example, sensors communicate with the outside world to obtain data, and these data are provided to the smart chips in the distributed computing system provided by the basic platform for calculation.
(2)数据(2) Data
基础设施的上一层的数据用于表示人工智能领域的数据来源。数据涉及到图形、图像、语音、文本,还涉及到传统设备的物联网数据,包括已有系统的业务数据以及力、位移、液位、温度、湿度等感知数据。The data on the upper layer of the infrastructure is used to represent the data sources in the field of artificial intelligence. The data involves graphics, images, voice, text, and IoT data of traditional devices, including business data of existing systems and perception data such as force, displacement, liquid level, temperature, and humidity.
(3)数据处理(3) Data processing
数据处理通常包括数据训练,机器学习,深度学习,搜索,推理,决策等方式。Data processing usually includes data training, machine learning, deep learning, search, reasoning, decision-making and other methods.
其中,机器学习和深度学习可以对数据进行符号化和形式化的智能信息建模、抽取、预处理、训练等。Among them, machine learning and deep learning can symbolize and formalize data for intelligent information modeling, extraction, preprocessing, and training.
推理是指在计算机或智能系统中,模拟人类的智能推理方式,依据推理控制策略,利用形式化的信息进行机器思维和求解问题的过程,典型的功能是搜索与匹配。Reasoning refers to the process of simulating human intelligent reasoning in computers or intelligent systems, using formalized information to perform machine thinking and solve problems based on reasoning control strategies. Typical functions are search and matching.
决策是指智能信息经过推理后进行决策的过程,通常提供分类、排序、预测等功能。Decision-making refers to the process of making decisions after intelligent information is reasoned, usually providing functions such as classification, sorting, and prediction.
(4)通用能力(4) General capabilities
对数据经过上面提到的数据处理后,进一步基于数据处理的结果可以形成一些通用的能力,比如可以是算法或者一个通用系统,例如,翻译,文本的分析,计算机视觉的处理,语音识别,图像的识别等等。After the data has undergone the data processing mentioned above, some general capabilities can be further formed based on the results of the data processing, such as an algorithm or a general system, for example, translation, text analysis, computer vision processing, speech recognition, image recognition, etc.
(5)智能产品及行业应用(5) Smart products and industry applications
智能产品及行业应用指人工智能系统在各领域的产品和应用,是对人工智能整体解决方案的封装,将智能信息决策产品化、实现落地应用,其应用领域主要包括:智能终端、智能交通、智能医疗、自动驾驶、智慧城市等。Smart products and industry applications refer to the products and applications of artificial intelligence systems in various fields. They are the encapsulation of the overall artificial intelligence solution, which productizes intelligent information decision-making and realizes practical applications. Its application areas mainly include: smart terminals, smart transportation, smart medical care, autonomous driving, smart cities, etc.
首先,本申请提供的方法涉及了机器学习相关概念,为便于理解,首先对涉及到的一些概念进行解释。First of all, the method provided in this application involves concepts related to machine learning. To facilitate understanding, some of the concepts involved are first explained.
(1)机器学习:构建统计模型,在样本数据上用优化方法拟合模型参数,在新样本数据上进行预测。(1) Machine learning: Build a statistical model, use optimization methods to fit model parameters on sample data, and make predictions on new sample data.
一个机器学习任务通常包括训练部分和预测部分,在预测部分中,可以用统计模型的参数在训练样本数据上进行预测,根据预测的误差计算统计模型的参数的更新方向,重复次过程,直到参数收敛。在预测部分中,可以使用训练好的模型对新的样本进行预测。A machine learning task usually includes a training part and a prediction part. In the prediction part, the parameters of the statistical model can be used to predict the training sample data, and the update direction of the parameters of the statistical model is calculated based on the prediction error. The process is repeated until the parameters converge. In the prediction part, the trained model can be used to predict new samples.
(2)对比学习(contrastive learning)(2) Contrastive learning
对比学习是自监督学习的一种。可以将正例样本和负例样本在特征空间进行对比,来学习样本的特征。利用这种方法,可以训练机器学习模型来区分相似和不同的数据样本图像。对比学习的内部工作可以表述为一个分数函数,它是衡量两个特征之间相似度的一个尺度。Contrastive learning is a type of self-supervised learning. Positive and negative samples can be compared in feature space to learn the features of the samples. Using this method, machine learning models can be trained to distinguish between similar and different data sample images. The internal workings of contrastive learning can be expressed as a score function, which is a measure of the similarity between two features.
(3)损失函数(3) Loss Function
也可以称为代价函数(cost function),一种比较模型分别对正样本和负样本之间的插值的度量,即用于衡量模型对正样本的预测输出和负样本的预测输出之间的区别。该损失函数通常可以包括误差平方均方、交叉熵、对数、指数等损失函数。例如,可以使用误差均方作为损失函数,定义为mse=具体可以根据实际应用场景选择具体的损失函数。 It can also be called cost function, a measure of the interpolation between positive and negative samples, that is, it is used to measure the difference between the model's prediction output for positive samples and the prediction output for negative samples. The loss function can usually include mean square error, cross entropy, logarithm, exponential loss functions, etc. For example, the mean square error can be used as the loss function, defined as mse = The specific loss function can be selected according to the actual application scenario.
(4)反向传播(back propagation,BP):(4) Back propagation (BP):
一种计算根据损失函数计算模型参数梯度、更新模型参数的算法。可以采用误差反向传播算法在训练过程中修正初始的网络模型中的参数的大小,使得模型的重建误差损失越来越小。具体地,前向传递输入信号直至输出会产生误差损失,通过反向传播误差损失信息来更新初始的模型中的参数,从而使误差损失收敛。反向传播算法是以误差损失为主导的反向传播运动,旨在得到最优的模型参数,例如,权重矩阵。An algorithm that calculates the gradient of model parameters based on the loss function and updates the model parameters. The error back propagation algorithm can be used to correct the size of the parameters in the initial network model during the training process, so that the reconstruction error loss of the model becomes smaller and smaller. Specifically, the forward transmission of the input signal to the output will generate error loss, and the error loss information is back-propagated to update the parameters in the initial model, so that the error loss converges. The back propagation algorithm is a back propagation movement dominated by error loss, aiming to obtain the optimal model parameters, such as the weight matrix.
(5)梯度:损失函数关于参数的导数向量。(5) Gradient: The derivative vector of the loss function with respect to the parameters.
本申请提供的方法可以应用于多种异常事件检测场景。本申请提供的异常事件模型构建方法可以部署于服务器其中,如云服务器或者本地服务器中,构建得到的异常事件检测模型可以部署于客户端,也可以部署于云端。当异常事件检测模型部署于客户端时,用户可以直接在客户端请求进行异常事件检测,客户端可以获取用户行为产生的数据来进行异常事件检测。当异常事件检测模型部署于云端时,用户可以通过客户端向云端请求进行异常事件检测,由云端获取用户行为产生的数据来进行异常事件检测。The method provided in the present application can be applied to a variety of abnormal event detection scenarios. The abnormal event model construction method provided in the present application can be deployed on a server, such as a cloud server or a local server, and the constructed abnormal event detection model can be deployed on the client or on the cloud. When the abnormal event detection model is deployed on the client, the user can directly request abnormal event detection on the client, and the client can obtain the data generated by the user behavior to perform abnormal event detection. When the abnormal event detection model is deployed on the cloud, the user can request the cloud to perform abnormal event detection through the client, and the cloud obtains the data generated by the user behavior to perform abnormal event detection.
本申请实施例提供的推荐方法可以在服务器上被执行,还可以在终端设备上被执行。其中该终端设备可以是具有图像处理功能的移动电话、平板个人电脑(tablet personal computer,TPC)、媒体播放器、智能电视、笔记本电脑(laptop computer,LC)、个人数字助理(personal digital assistant,PDA)、个人计算机(personal computer,PC)、照相机、摄像机、智能手表、可穿戴式设备(wearable device,WD)或者自动驾驶的车辆等,本申请实施例对此不作限定。The recommendation method provided in the embodiment of the present application can be executed on a server or on a terminal device. The terminal device can be a mobile phone with image processing function, a tablet personal computer (TPC), a media player, a smart TV, a laptop computer (LC), a personal digital assistant (PDA), a personal computer (PC), a camera, a video camera, a smart watch, a wearable device (WD) or an autonomous driving vehicle, etc., and the embodiment of the present application does not limit this.
下面介绍本申请实施例提供的系统架构。The following introduces the system architecture provided by the embodiments of the present application.
参见图1,本申请实施例提供了一种系统架构200。如系统架构200所示,数据采集设备260可以用于采集训练数据。在数据采集设备260采集到训练数据之后,将这些训练数据存入数据库230,训练设备220基于数据库230中维护的训练数据训练得到异常事件检测模型201。Referring to FIG. 1 , an embodiment of the present application provides a system architecture 200 . As shown in the system architecture 200 , a data acquisition device 260 can be used to collect training data. After the data acquisition device 260 collects the training data, the training data is stored in a database 230 , and the training device 220 trains the abnormal event detection model 201 based on the training data maintained in the database 230 .
下面对训练设备220基于训练数据得到异常事件检测模型201进行描述。示例性地,训练设备220基于属性异质性图构建异常事件检测模型,并通过对比学习来更新异常事件检测模型的参数,从而完成异常事件检测模型201的训练。具体描述详见后文中的训练方法。The following describes how the training device 220 obtains the abnormal event detection model 201 based on the training data. Exemplarily, the training device 220 constructs the abnormal event detection model based on the attribute heterogeneity graph, and updates the parameters of the abnormal event detection model through comparative learning, thereby completing the training of the abnormal event detection model 201. For a detailed description, see the training method below.
本申请实施例中的异常事件检测模型201具体可以为神经网络。需要说明的是,在实际的应用中,数据库230中维护的训练数据不一定都来自于数据采集设备260的采集,也有可能是从其他设备接收得到的。另外需要说明的是,训练设备220也不一定完全基于数据库230维护的训练数据进行异常事件检测模型201的训练,也有可能从云端或其他地方获取训练数据进行模型训练,上述描述不应该作为对本申请实施例的限定。The abnormal event detection model 201 in the embodiment of the present application can specifically be a neural network. It should be noted that in actual applications, the training data maintained in the database 230 does not necessarily all come from the collection of the data acquisition device 260, and may also be received from other devices. It should also be noted that the training device 220 does not necessarily train the abnormal event detection model 201 based entirely on the training data maintained by the database 230, and may also obtain training data from the cloud or other places for model training. The above description should not be used as a limitation on the embodiments of the present application.
根据训练设备220训练得到的异常事件检测模型201可以应用于不同的系统或设备中,如应用于图1所示的执行设备210,所述执行设备210可以是终端,如手机终端,平板电脑,笔记本电脑,增强现实(augmented reality,AR)/虚拟现实(virtual reality,VR),车载终端,电视等,还可以是服务器或者云端等。在图1中,执行设备210配置有收发器212,该收发器可以包括输入/输出(input/output,I/O)接口或者其他无线或者有线的通信接口等,用于与外部设备进行数据交互,以I/O接口为例,用户可以通过客户设备240向I/O接口输入数据。The abnormal event detection model 201 obtained by training the training device 220 can be applied to different systems or devices, such as the execution device 210 shown in FIG1 . The execution device 210 can be a terminal, such as a mobile phone terminal, a tablet computer, a laptop computer, augmented reality (AR)/virtual reality (VR), a vehicle terminal, a television, etc., and can also be a server or a cloud. In FIG1 , the execution device 210 is configured with a transceiver 212, which can include an input/output (I/O) interface or other wireless or wired communication interfaces, etc., for data interaction with external devices. Taking the I/O interface as an example, a user can input data to the I/O interface through the client device 240.
在执行设备210对输入数据进行预处理,或者在执行设备210的计算模块211执行计算等相关的处理过程中,执行设备210可以调用数据存储系统250中的数据、代码等以用于相应的处理,也可以将相应处理得到的数据、指令等存入数据存储系统250中。When the execution device 210 preprocesses the input data, or when the computing module 211 of the execution device 210 performs calculations and other related processing, the execution device 210 can call the data, code, etc. in the data storage system 250 for corresponding processing, and can also store the data, instructions, etc. obtained from the corresponding processing into the data storage system 250.
最后,I/O接口将处理结果返回给客户设备240,从而提供给用户。Finally, the I/O interface returns the processing result to the client device 240 for providing to the user.
值得说明的是,训练设备220可以针对不同的目标或称不同的任务,基于不同的训练数据生成相应的异常事件检测模型201,该相应的异常事件检测模型201即可以用于实现上述目标或完成上述任务,从而为用户提供所需的结果。It is worth noting that the training device 220 can generate a corresponding abnormal event detection model 201 based on different training data for different goals or different tasks. The corresponding abnormal event detection model 201 can be used to achieve the above goals or complete the above tasks, thereby providing the user with the desired results.
在附图1中所示情况下,用户可以手动给定输入数据,该手动给定可以通过收发器212提供的界面进行操作。另一种情况下,客户设备240可以自动地向收发器212发送输入数据,如果要求客户设备240自动发送输入数据需要获得用户的授权,则用户可以在客户设备240中设置相应权限。用户可以在客户 设备240查看执行设备210输出的结果,具体的呈现形式可以是显示、声音、动作等具体方式。客户设备240也可以作为数据采集端,采集如图所示输入收发器212的输入数据及输出收发器212的输出结果作为新的样本数据,并存入数据库230。当然,也可以不经过客户设备240进行采集,而是由收发器212直接将如图所示输入收发器212的输入数据及输出收发器212的输出结果,作为新的样本数据存入数据库230。In the case shown in FIG. 1 , the user can manually input the data, which can be operated through the interface provided by the transceiver 212. In another case, the client device 240 can automatically send the input data to the transceiver 212. If the client device 240 is required to automatically send the input data, the user can set the corresponding permissions in the client device 240. The user can The device 240 checks the result output by the execution device 210, and the specific presentation form can be a specific method such as display, sound, action, etc. The client device 240 can also be used as a data collection terminal to collect the input data of the input transceiver 212 and the output result of the output transceiver 212 as shown in the figure as new sample data, and store them in the database 230. Of course, it is also possible to collect without going through the client device 240, and the transceiver 212 directly stores the input data of the input transceiver 212 and the output result of the output transceiver 212 as new sample data in the database 230.
值得注意的是,附图1仅是本申请实施例提供的一种系统架构的示意图,图中所示设备、器件、模块等之间的位置关系不构成任何限制,例如,在图1中,数据存储系统250相对执行设备210是外部存储器,在其它情况下,也可以将数据存储系统250置于执行设备210中。It is worth noting that FIG1 is only a schematic diagram of a system architecture provided in an embodiment of the present application. The positional relationship between the devices, components, modules, etc. shown in the figure does not constitute any limitation. For example, in FIG1, the data storage system 250 is an external memory relative to the execution device 210. In other cases, the data storage system 250 can also be placed in the execution device 210.
示例性地,本申请提供的异常事件检测模型构建方法的应用的系统架构可以如图2所示。在该系统架构300中,服务器集群310由一个或多个服务器实现,可选的,与其它计算设备配合,例如:数据存储、路由器、负载均衡器等设备。服务器集群310可以使用数据存储系统250中的数据,或者调用数据存储系统250中的程序代码实现本申请提供的异常事件检测模型构建方法的步骤。Exemplarily, the system architecture of the application of the abnormal event detection model construction method provided by the present application can be shown in Figure 2. In the system architecture 300, the server cluster 310 is implemented by one or more servers, and optionally, cooperates with other computing devices, such as data storage, routers, load balancers and other devices. The server cluster 310 can use the data in the data storage system 250, or call the program code in the data storage system 250 to implement the steps of the abnormal event detection model construction method provided by the present application.
用户可以操作各自的用户设备(例如本地设备301和本地设备302)与服务器集群310进行交互。每个本地设备可以表示任何计算设备,例如个人计算机、计算机工作站、智能手机、平板电脑、智能摄像头、智能汽车或其他类型蜂窝电话、媒体消费设备、可穿戴设备、机顶盒、游戏机等。Users can operate their respective user devices (e.g., local device 301 and local device 302) to interact with server cluster 310. Each local device can represent any computing device, such as a personal computer, a computer workstation, a smart phone, a tablet computer, a smart camera, a smart car or other type of cellular phone, a media consumption device, a wearable device, a set-top box, a game console, etc.
每个用户的本地设备可以通过任何通信机制/通信标准的通信网络与服务器集群310进行交互,通信网络可以是广域网、局域网、点对点连接等方式,或它们的任意组合。具体地,该通信网络可以包括无线网络、有线网络或者无线网络与有线网络的组合等。该无线网络包括但不限于:第五代移动通信技术(5th-Generation,5G)系统,长期演进(long term evolution,LTE)系统、全球移动通信系统(global system for mobile communication,GSM)或码分多址(code division multiple access,CDMA)网络、宽带码分多址(wideband code division multiple access,WCDMA)网络、无线保真(wireless fidelity,WiFi)、蓝牙(bluetooth)、紫蜂协议(Zigbee)、射频识别技术(radio frequency identification,RFID)、远程(Long Range,Lora)无线通信、近距离无线通信(near field communication,NFC)中的任意一种或多种的组合。该有线网络可以包括光纤通信网络或同轴电缆组成的网络等。The local device of each user can interact with the server cluster 310 through a communication network of any communication mechanism/communication standard, and the communication network can be a wide area network, a local area network, a point-to-point connection, or any combination thereof. Specifically, the communication network may include a wireless network, a wired network, or a combination of a wireless network and a wired network. The wireless network includes, but is not limited to: a fifth-generation mobile communication technology (5th-Generation, 5G) system, a long-term evolution (long term evolution, LTE) system, a global system for mobile communication (global system for mobile communication, GSM) or a code division multiple access (code division multiple access, CDMA) network, a wideband code division multiple access (wideband code division multiple access, WCDMA) network, wireless fidelity (wireless fidelity, WiFi), Bluetooth (bluetooth), Zigbee protocol (Zigbee), radio frequency identification technology (radio frequency identification, RFID), long-range (Lora) wireless communication, and near-field wireless communication (NFC) Any one or more combinations. The wired network may include an optical fiber communication network or a network composed of coaxial cables, etc.
在另一种实现中,执行设备210的一个方面或多个方面可以由每个本地设备实现,例如,本地设备301可以为执行设备210提供本地数据或反馈计算结果。In another implementation, one or more aspects of the execution device 210 may be implemented by each local device. For example, the local device 301 may provide local data or feedback calculation results to the execution device 210 .
需要注意的,执行设备210的所有功能也可以由本地设备实现。例如,本地设备301实现执行设备210的功能并为自己的用户提供服务,或者为本地设备302的用户提供服务。It should be noted that all functions of the execution device 210 can also be implemented by the local device. For example, the local device 301 implements the functions of the execution device 210 and provides services to its own user, or provides services to the user of the local device 302.
示例性地,本申请提供的方法的应用场景可以参阅图3。For example, the application scenario of the method provided in this application can be seen in FIG3 .
可以在服务器中构建并训练异常事件检测模型,并将训练后的异常事件检测模型发送并部署于客户端。用户可以通过在客户端中输入异常事件检测请求,即请求客户端针对用户行为产生的数据进行检测,识别是否存在异常事件。客户端可以读取与用户行为相关的数据,如读取用户终端上传的用户行为产生的数据,读取服务器中保存的用户的日志数据或者读取自身保存的用户行为产生的数据等,针对读取到的数据构建属性异质性图,从而通过属性异质性图来表示用户行为涉及的实体以及实体之间的关联关系,其中用户涉及实体或者产生的事件中的其他关联的信息,均可作为事件元素,将属性异质性图作为异常事件检测模型的输入来进行异常事件检测,并输出检测到的异常事件。如可以在金融欺诈检测任务中,检测用户套现这一异常事件;在社交平台水军检测任务中,检测水军的恶意评论这一事件;在违禁品检测任务中,检测卖家销售违禁品这一恶意事件等。An abnormal event detection model can be built and trained in the server, and the trained abnormal event detection model can be sent and deployed on the client. The user can enter an abnormal event detection request in the client, that is, request the client to detect the data generated by the user behavior to identify whether there is an abnormal event. The client can read data related to user behavior, such as reading data generated by user behavior uploaded by the user terminal, reading user log data stored in the server, or reading data generated by user behavior stored by itself, etc., and construct an attribute heterogeneity graph for the read data, so as to represent the entities involved in the user behavior and the association relationship between entities through the attribute heterogeneity graph, wherein the user-related entities or other associated information in the generated events can be used as event elements, and the attribute heterogeneity graph is used as the input of the abnormal event detection model to detect abnormal events, and output the detected abnormal events. For example, in the task of financial fraud detection, the abnormal event of user cashing out can be detected; in the task of detecting the water army on the social platform, the event of malicious comments by the water army can be detected; in the task of detecting contraband, the malicious event of sellers selling contraband can be detected, etc.
例如,针对金融欺诈检测任务,事件可以用于描述用户和用户相关的操作(如转账,登陆设备等等),表示用户的一次金融交易行为。给定一系列交易事件,可以利用本申请提供的方法来建模这种异常的事件模式,即构建异常事件检测模型,比如某个用户登陆了一台用户不经常登录的识别,或者进行了一次不同寻常的大额交易,都有可能是异常事件。通过本申请提供的异常事件检测模型进行检测,这类事件的异常得分比较高。For example, for financial fraud detection tasks, events can be used to describe users and user-related operations (such as transferring money, logging into devices, etc.), indicating a user's financial transaction behavior. Given a series of transaction events, the method provided by this application can be used to model this abnormal event pattern, that is, to build an abnormal event detection model. For example, a user logs in to a computer that the user does not log in frequently, or makes an unusual large transaction, which may be an abnormal event. Through the abnormal event detection model provided by this application, the abnormality score of such events is relatively high.
又例如,针对社交平台水军检测任务,通常社交平台充斥着大量水军,即通过发表恶意的评论误导买家,进而获得利润的用户。在这类任务中事件可以定义为用户发表评论,关联的元素包括用户、评论、 社交平台等。给定一系列事件,本申请提供的方法可以利用社交网络中的关系构造属性异质图,从而深度挖掘在属性异质图中的异常模式,更好的帮助检测水军。Another example is the task of detecting water army on social platforms. Usually, social platforms are full of water army, that is, users who make profits by posting malicious comments to mislead buyers. In this type of task, an event can be defined as a user posting a comment. The associated elements include user, comment, Social platforms, etc. Given a series of events, the method provided by the present application can construct an attribute heterogeneous graph using the relationships in the social network, thereby deeply mining abnormal patterns in the attribute heterogeneous graph and better helping to detect water army.
还例如,针对违禁品检测任务,通常在电商平台中,商家为了利润会违法销售一些违禁品,比如销售野生保护动物或违禁药品等。可以定义商家上架商品事件,其他元素还可以包括用户等,构成一张属性异质图。利用本申请提供的方法,可以捕捉复杂的异常买卖模式,从而检测出异常的买卖事件,提高违禁品检测的准确率。For example, for the contraband detection task, usually in e-commerce platforms, merchants will illegally sell some contraband for profit, such as selling wild protected animals or banned drugs. Merchants can define product listing events, and other elements can also include users, etc., to form an attribute heterogeneous graph. Using the method provided by this application, complex abnormal buying and selling patterns can be captured, thereby detecting abnormal buying and selling events and improving the accuracy of contraband detection.
下面结合前述的应用场景,对本申请提供的方法进行介绍。The method provided in this application is introduced below in conjunction with the aforementioned application scenarios.
本申请提供的方法的步骤可以分为训练部分以及推理部分,其中,训练部分即构建以及训练异常事件检测模型,在推理部分,即可通过训练部分得到的异常事件检测模型来检测异常事件。The steps of the method provided in the present application can be divided into a training part and a reasoning part, wherein the training part is to construct and train an abnormal event detection model, and in the reasoning part, abnormal events can be detected by the abnormal event detection model obtained in the training part.
下面为便于理解,对训练部分和推理部分分别进行介绍。其中,训练部分即本申请提供的异常事件检测模型构建方法,推理部分即本申请提供的异常事件检测方法。For ease of understanding, the training part and the reasoning part are introduced separately below. The training part is the abnormal event detection model construction method provided by the present application, and the reasoning part is the abnormal event detection method provided by the present application.
一、训练部分1. Training
首先,参阅图4,本申请提供的一种异常事件检测模型构建方法的流程示意图。First, refer to FIG4 , which is a flowchart of a method for building an abnormal event detection model provided in the present application.
401、获取属性异质性图。401. Obtain an attribute heterogeneity graph.
该属性异质性图可以包括多个事件对应的数据,即可以用于表示多个事件,该属性异质性图中可以包括多个节点以及该多个节点之间的关联关系,每个事件包括至少两个节点以及该至少两个节点之间的关联关系,每个事件中的每个节点可以包括形成事件的一个事件元素的信息。为便于区分,将训练部分是所使用的属性异质性图称为第二属性异质性图。The attribute heterogeneity graph may include data corresponding to multiple events, that is, it can be used to represent multiple events. The attribute heterogeneity graph may include multiple nodes and associations between the multiple nodes. Each event includes at least two nodes and associations between the at least two nodes. Each node in each event may include information of an event element that forms the event. For ease of distinction, the attribute heterogeneity graph used in the training part is called the second attribute heterogeneity graph.
该多个事件的数据可以包括用户行为产生的数据,每种行为产生的数据可以称为一个事件的数据。如用户进行金融交易产生的数据,一次操作,如转账、登录或者交易等产生的数据可以称为一次事件,该事件中的节点可以包括用户、转账操作、金额等;如用户进行评论产生的数据,如一次事件可以定义为用户进行一次发表评论,该事件中的节点可以包括用户、评论内容、评论平台等信息;如用户购买物品产生的数据等,如进行一次购买或者加购可以定义为一次事件,该事件中的节点可以包括用户、购买或者加购的物品、加购或者购买时间、数量等。The data of multiple events may include data generated by user behavior, and the data generated by each behavior can be called the data of an event. For example, the data generated by a user's financial transaction, an operation such as transfer, login or transaction can be called an event, and the nodes in the event can include the user, transfer operation, amount, etc.; for example, the data generated by a user's comment, an event can be defined as a user posting a comment, and the nodes in the event can include information such as the user, comment content, comment platform, etc.; for example, the data generated by a user's purchase of items, such as a purchase or additional purchase can be defined as an event, and the nodes in the event can include the user, the purchased or additional items, the additional purchase or purchase time, quantity, etc.
可选地,为了便于后续的模型构建,可以将第二属性异质性图中的每个事件的各个节点映射至同一个空间中,得到每个事件的节点在同一个空间的数据表示,为便于区分将训练部分的数据表示称为第一数据表示。因此,本申请实施方式中,在进行建模之前,可以将输入数据映射至同一个空间中,从而统一数据维度,以便于后续可以基于相同维度的数据进行建模,提高建模效率。Optionally, in order to facilitate subsequent model construction, each node of each event in the second attribute heterogeneity graph can be mapped to the same space to obtain a data representation of the node of each event in the same space. For the sake of distinction, the data representation of the training part is referred to as the first data representation. Therefore, in the implementation of the present application, before modeling, the input data can be mapped to the same space to unify the data dimension so that subsequent modeling can be performed based on data of the same dimension, thereby improving modeling efficiency.
例如,一个属性异质图定义为包括节点集合和边集合ε,边集合中的每条边可以用于表示节点之间的关联关系。属性异质图还可以包括一个属性矩阵X∈R|V|×k。一个属性异质图也与一个节点类型映射函数φ:和一个边类型映射函数关联,分别代表预定义的节点和边类型集合,满足图5展示了引文网络的AHIN示例。由三种类型的属性节点(即作者、论文和会议)及其丰富的交互(例如作者撰写论文)组成。如图5中所示,以用户发表论文作为一个事件为例,该属性异质性图中可以包括多个事件,每种事件可以包括多种属性类型的节点,即作者、论文和会议以及节点之间的交互,如作者撰写论文即可作为一条边。网络模式(如图6))指定了节点集及其关系的类型约束。通常,星型模式网络是常用的网络结构。在星型网络模式的指导下,可以从AHIN中提取模式实例。即本申请提供的方法中,所需输入的数据的数据结构可以参阅图6中所示出的数据结构,即每个事件可以确定一个中心节点,其余节点可以表示为上下文语义对应的节点。图7中展示了一个事件的示例,展示了星型模式实例形成了一个完整的语义单元(即,发表论文)。因此,本申请可以使用星型模式实例来表示AHIN中的事件。For example, an attribute heterogeneous graph is defined as Include node collection and an edge set ε, each edge in the edge set can be used to represent the association relationship between nodes. The attribute heterogeneous graph can also include an attribute matrix X∈R |V|×k . An attribute heterogeneous graph is also associated with a node type mapping function φ: and an edge type mapping function association, and Represents a predefined set of node and edge types, satisfying FIG5 shows an example of an AHIN of a citation network. It consists of three types of attribute nodes (i.e., author, paper, and conference) and their rich interactions (e.g., author writes a paper). As shown in FIG5, taking the publication of a paper by a user as an example, the attribute heterogeneity graph may include multiple events, and each event may include nodes of multiple attribute types, i.e., author, paper, and conference, as well as interactions between nodes, such as an author writing a paper as an edge. The network model (as shown in FIG6) specifies the type constraints of a set of nodes and their relationships. Generally, a star-shaped model network is a commonly used network structure. Under the guidance of the star network model, a model instance can be extracted from AHIN. That is, in the method provided by the present application, the data structure of the data required for input can refer to the data structure shown in FIG6, that is, each event can determine a central node, and the remaining nodes can be represented as nodes corresponding to the contextual semantics. FIG7 shows an example of an event, showing that a star-shaped model instance forms a complete semantic unit (i.e., publishing a paper). Therefore, the present application can use a star-shaped model instance to represent events in AHIN.
402、根据属性异质性图构建异常事件检测模型。402. Construct an abnormal event detection model based on attribute heterogeneity graph.
在得到第二属性异质性图之后,可以基于该第二属性异质性图中包括的各个事件的节点以及关联关系等信息进行对比学习,构建得到用于进行异常事件检测的异常事件检测模型。该异常事件检测模型可以基于事件内的节点之间的相似度或者事件之间的相似度来识别异常事件。 After obtaining the second attribute heterogeneity graph, comparative learning can be performed based on the nodes and associations of each event included in the second attribute heterogeneity graph to construct an abnormal event detection model for abnormal event detection. The abnormal event detection model can identify abnormal events based on the similarity between nodes within an event or the similarity between events.
本申请实施方式中,可以基于属性异质性图来构建异常事件检测模型。属性异质性图可以表示复杂的事件,因此本申请提供的方法可以对更复杂的事件进行建模,对于复杂的事件也可以进行异常识别,准确识别出异常事件,可以适应多种应用场景,泛化能力强。In the implementation of the present application, an abnormal event detection model can be constructed based on the attribute heterogeneity graph. The attribute heterogeneity graph can represent complex events, so the method provided by the present application can model more complex events, and can also perform abnormal identification for complex events, accurately identify abnormal events, and can adapt to a variety of application scenarios with strong generalization ability.
具体地,可以首先构建初始模型,随后使用第二属性异质性图进行对比学习,得到训练后的异常事件检测模型。Specifically, an initial model may be constructed first, and then the second attribute heterogeneity graph may be used for comparative learning to obtain a trained abnormal event detection model.
可选地,异常事件检测模型包括以下一种或者多种模块:节点对对比模块、多元交互模块或事件对比模块等,节点对比模块可以用于获取事件内的节点之间的相似度,多元交互模块可以用于对事件中的节点进行聚类,并获取事件内的节点和事件类别之间的相似度,事件对比模块可以用于获取事件之间的相似度。Optionally, the abnormal event detection model includes one or more of the following modules: a node pair comparison module, a multivariate interaction module or an event comparison module, etc. The node comparison module can be used to obtain the similarity between nodes within an event, the multivariate interaction module can be used to cluster the nodes in the event and obtain the similarity between the nodes within the event and the event category, and the event comparison module can be used to obtain the similarity between events.
下面分别对各个模块的训练过程分别进行介绍。The training process of each module is introduced below.
1、节点对对比模块1. Node comparison module
若异常事件检测中包括节点对对比模块,则可以将每个事件中的多个节点组成至少一对节点对,如将每两个节点组合为一对节点对。可以通过该节点对对比模块获取每对节点对之间的相似度,为便于区分称为第一相似度,该第一相似度可以用于衡量事件的异常程度,如通常相似度越高,事件的异常程度越低,相似度越低,事件的异常程度越高。随后根据每对节点对的相似度来获取每对节点对的成对对比损失值,并基于每对节点对的成对对比损失值对异常事件检测模型进行更新,得到更新后的异常事件检测模型。If the abnormal event detection includes a node pair comparison module, the multiple nodes in each event can be combined into at least one node pair, such as combining every two nodes into a node pair. The similarity between each pair of node pairs can be obtained through the node pair comparison module, which is called the first similarity for the convenience of distinction. The first similarity can be used to measure the degree of abnormality of the event. For example, the higher the similarity, the lower the degree of abnormality of the event, and the lower the similarity, the higher the degree of abnormality of the event. Subsequently, the pairwise comparison loss value of each pair of node pairs is obtained according to the similarity of each pair of node pairs, and the abnormal event detection model is updated based on the pairwise comparison loss value of each pair of node pairs to obtain an updated abnormal event detection model.
可选地,计算每个节点对应的成对对比损失值的方式可以包括:以任意一个节点的计算方式为例,为便于区分称为第一节点,从多个节点中选取第一节点的正样本节点集合,并构造负样本节点集合,如选择其他事件中的节点加入负样本节点集合。正样本节点集合中的节点和第一节点之间的第一相似度高于负样本节点集合中的节点与第一节点之间的第一相似度;通过第一节点与正样本节点集合中的节点之间的第一相似度,与第一节点与负样本节点集合中的节点之间的相似度,计算得到第一节点的成对对比损失值。本申请实施方式中,可以来构建每个节点的正样本节点集合和负样本节点集合,如将与每个节点相似度高的节点作为正样本节点,与每个节点相似度低的节点作为每个节点的负样本,从而通过每个节点的正样本节点和负样本节点来实现对比学习,实现无监督学习。Optionally, the method of calculating the pairwise contrast loss value corresponding to each node may include: taking the calculation method of any node as an example, in order to facilitate the distinction of the first node, a positive sample node set of the first node is selected from multiple nodes, and a negative sample node set is constructed, such as selecting nodes in other events to join the negative sample node set. The first similarity between the nodes in the positive sample node set and the first node is higher than the first similarity between the nodes in the negative sample node set and the first node; the pairwise contrast loss value of the first node is calculated by the first similarity between the first node and the nodes in the positive sample node set, and the similarity between the first node and the nodes in the negative sample node set. In the implementation manner of the present application, a positive sample node set and a negative sample node set can be constructed for each node, such as taking a node with high similarity to each node as a positive sample node, and a node with low similarity to each node as a negative sample of each node, thereby realizing contrast learning through the positive sample node and the negative sample node of each node, and realizing unsupervised learning.
可选地,可以对多个事件中的多个节点对的成对对比损失进行融合,得到针对模型输出整体的损失值,为便于区分称为第一损失值,并使用第一损失值对异常事件检测模型进行反向更新,得到更新后的异常事件检测模型。Optionally, the pairwise contrast losses of multiple node pairs in multiple events can be fused to obtain a loss value for the overall model output, which is called the first loss value for easy distinction. The first loss value is used to reversely update the abnormal event detection model to obtain an updated abnormal event detection model.
在一些场景中,可能存在节点的负样本与节点之间的相似度过高的情况,通常将此种负样本称为困难样本,困难样本将较大程度提高异常事件的识别难度,如可能存在将负样本节点归类为正样本节点集合中的情况。本申请可以设置温度系数来调整对于困难样本关注度。即在计算成对对比损失时,可以结合温度系数来计算,从而可以更降低困难样本对于损失值的影响程度。如在计算成对对比损失值时,可以将相似度除该温度系数,通常越小的温度系数越关注于将当前样本与相似的负样本进行区分,从而提高对于异常事件的识别准确度。In some scenarios, there may be a situation where the similarity between the negative sample of the node and the node is too high. This kind of negative sample is usually called a difficult sample. Difficult samples will greatly increase the difficulty of identifying abnormal events, such as the situation where the negative sample node may be classified as a positive sample node set. The present application can set a temperature coefficient to adjust the attention paid to difficult samples. That is, when calculating the paired contrast loss, the temperature coefficient can be combined for calculation, so as to further reduce the influence of difficult samples on the loss value. For example, when calculating the paired contrast loss value, the similarity can be divided by the temperature coefficient. Generally, the smaller the temperature coefficient, the more attention is paid to distinguishing the current sample from similar negative samples, thereby improving the accuracy of identifying abnormal events.
因此,本申请实施方式中,异常事件检测模型中可以包括用于对事件内节点之间的异常情况进行判定的模块。在训练过程中,可以基于节点对对比模块的输出结果来计算损失值,从而学习事件内异常节点对,使模型可以对事件内各个节点之间的异常情况进行识别,从而可以准确识别出异常事件。Therefore, in the implementation mode of the present application, the abnormal event detection model may include a module for determining abnormal conditions between nodes in an event. During the training process, the loss value may be calculated based on the output result of the node pair comparison module, thereby learning abnormal node pairs in the event, so that the model can identify abnormal conditions between nodes in the event, thereby accurately identifying abnormal events.
2、多元交互模块2. Multiple interactive modules
若异常事件检测模型中包括多元交互模块,则对应的训练过程可以包括:If the abnormal event detection model includes a multivariate interaction module, the corresponding training process may include:
可以通过该多元交互模块获取标识符节点,获取事件内的一个或者多个节点与标识符之间的相似度,为便于区分称为第二相似度。随后可以根据该第二相似度计算对应的损失值,为便于区分称为第二损失值。随后根据该第二损失值对异常事件检测模型进行反向更新,得到更新后的异常事件检测模型。The identifier node can be obtained through the multivariate interaction module, and the similarity between one or more nodes in the event and the identifier can be obtained, which is called the second similarity for easy distinction. Then, the corresponding loss value can be calculated based on the second similarity, which is called the second loss value for easy distinction. Then, the abnormal event detection model is reversely updated based on the second loss value to obtain an updated abnormal event detection model.
具体地,可以将每个事件的中心节点作为标识符节点,或者对每个事件的多个节点进行融合后得到标识符节点,如对每个事件中的节点进行聚类得到至少一个分类,并选择其中一个分类中的节点作为标 识符节点,如将聚类中心或者与中心最接近的节点等作为标识符节点;随后计算事件中的各个节点和标识符节点之间的相似度,可以通过该相似度来表示各个节点的异常程度,如该相似度越高,表示事件的异常程度也就越低,若该相似度越低,则表示事件的异常程度也就预越高。随后可以根据该相似度来计算各个节点对应的损失值,并根据该损失值对事件检测模型进行反向更新,得到更新后的异常事件检测模型。Specifically, the central node of each event can be used as the identifier node, or multiple nodes of each event can be fused to obtain an identifier node, such as clustering the nodes in each event to obtain at least one category, and selecting a node in one of the categories as the identifier node. Identifier nodes, such as the cluster center or the node closest to the center, are used as identifier nodes; then the similarity between each node in the event and the identifier node is calculated, and the similarity can be used to indicate the abnormality of each node. The higher the similarity, the lower the abnormality of the event. If the similarity is lower, the abnormality of the event is higher. Then the loss value corresponding to each node can be calculated based on the similarity, and the event detection model is reversely updated based on the loss value to obtain an updated abnormal event detection model.
可选地,为了实现对比学习,本申请可以构建负样本,从而基于正样本和构建得到的负样本进行对比学习。具体地计算第二损失值的方式可以包括,以任意一个事件(为便于理解称为第一事件)为例,将第一事件中的第一节点替换为第二节点,该第二节点与第一节点的属性相同但不同簇(或者称为所属类别不相同),从而形成负样本;计算第二节点与标识符之间的相似度,为便于区分称为第三相似度,基于该第二相似度和第三相似度计算损失值,得到第二损失值。Optionally, in order to achieve contrastive learning, the present application can construct negative samples, so as to perform contrastive learning based on positive samples and constructed negative samples. Specifically, the method of calculating the second loss value can include, taking any event (referred to as the first event for ease of understanding) as an example, replacing the first node in the first event with a second node, the second node has the same attributes as the first node but is in a different cluster (or is called a different category), thereby forming a negative sample; calculating the similarity between the second node and the identifier, which is referred to as the third similarity for ease of distinction, and calculating the loss value based on the second similarity and the third similarity to obtain a second loss value.
本申请实施方式中,可以通过替换同类型但不同簇的方式构建负样本,来计算正样本和负样本之间的损失值,并根据该损失值更新异常事件检测模型,从而实现对比学习。相当于可以通过构建负样本的方式来实现对比学习,得到更新后的异常事件检测模型,从而实现无监督学习。In the implementation mode of the present application, negative samples can be constructed by replacing the same type but different clusters to calculate the loss value between positive samples and negative samples, and the abnormal event detection model can be updated according to the loss value, thereby realizing contrastive learning. This is equivalent to realizing contrastive learning by constructing negative samples to obtain an updated abnormal event detection model, thereby realizing unsupervised learning.
此外,多元交互模块在计算第三相似度时,可以采用评分函数来计算。如可以采用双线性评分函数来构建基于标识符节点和上下文节点之间的相似度的模型,其中设置了第一线性变换层。在对异常事件检测模型进行反向更新时,也需对该第一线性变换层的参数进行更新,从而使多元交互模块输出的相似度的值更准确。In addition, the multivariate interaction module can use a scoring function to calculate the third similarity. For example, a bilinear scoring function can be used to construct a model based on the similarity between the identifier node and the context node, in which a first linear transformation layer is set. When the abnormal event detection model is reversely updated, the parameters of the first linear transformation layer also need to be updated, so that the similarity value output by the multivariate interaction module is more accurate.
3、事件对比模块3. Event comparison module
若异常事件检测模型中设置了事件对比模块,该事件对比模块可以用于输出事件之间的相似度。具体地,本申请实施方式中,该事件对比模块可以用于筛选各个事件对应的正样本集合,输出各个事件已经与之对应的正样本之间的相似度。If an event comparison module is provided in the abnormal event detection model, the event comparison module can be used to output the similarity between events. Specifically, in the embodiment of the present application, the event comparison module can be used to screen the positive sample set corresponding to each event and output the similarity between the positive samples corresponding to each event.
该事件对比模块的训练过程具体可以包括:The training process of the event comparison module may specifically include:
筛选出每个事件对应的正样本集合和负样本集合,随后根据每个事件与对应的正样本集合中的事件的第四相似度以及该事件与对应的负样本集合中的事件之间的第五相似度来计算损失值,为便于区分称为第三损失值;随后根据该第三损失值来对异常事件检测模型进行反向更新,得到更新后的事件检测模型。因此,本申请实施方式中,通过构建每个事件的正样本集合和负样本集合来进行对比学习,可以实现无监督学习。The positive sample set and negative sample set corresponding to each event are screened out, and then the loss value is calculated according to the fourth similarity between each event and the events in the corresponding positive sample set and the fifth similarity between the event and the events in the corresponding negative sample set, which is called the third loss value for easy distinction; then the abnormal event detection model is reversely updated according to the third loss value to obtain an updated event detection model. Therefore, in the implementation of the present application, unsupervised learning can be achieved by constructing a positive sample set and a negative sample set for each event for comparative learning.
可选地,筛选正样本集合和负样本集合的方式具体可以包括:计算事件之间共享节点的数量,根据共享节点的数量来从多个事件中筛选出每个事件对应的正样本集合以及负样本集合。以任意一个事件为例,为便于区分称为第二事件,获取与第二事件之间共享节点的数量大于第一阈值的至少一个事件,得到正样本集合,第二事件为多个事件中的任意一个事件;获取与第二事件之间共享节点的数量不大于第一阈值的至少一个事件,得到负样本集合。Optionally, the method of screening the positive sample set and the negative sample set may specifically include: calculating the number of shared nodes between events, and screening the positive sample set and the negative sample set corresponding to each event from multiple events according to the number of shared nodes. Taking any event as an example, in order to facilitate the distinction of the second event, at least one event whose number of shared nodes with the second event is greater than a first threshold is obtained to obtain a positive sample set, and the second event is any event among the multiple events; at least one event whose number of shared nodes with the second event is not greater than the first threshold is obtained to obtain a negative sample set.
可选地,计算事件之间的相似度可以包括多种,如可以提取事件的特征,计算特征之间的相似度,即可作为事件之间的相似度。Optionally, calculating the similarity between events may include multiple methods, such as extracting features of the events, calculating the similarity between the features, and using the similarity between the features as the similarity between the events.
此外,筛选正样本和负样本也可以通过事件之间的相似度来筛选,如将与第二事件的相似度高于第二阈值的事件作为正样本,得到正样本集合,将与第二事件的相似度不高于第二阈值的事件作为负样本集合等。In addition, positive samples and negative samples can also be screened by the similarity between events, such as taking events whose similarity with the second event is higher than a second threshold as positive samples to obtain a positive sample set, and taking events whose similarity with the second event is not higher than the second threshold as a negative sample set, etc.
当然,也可以通过事件之间共享节点的数量来衡量事件之间的相似度,如第四相似度可以与共享节点的数量成正相关关系,即共享节点的数量越多,即表示事件之间的相似度也就越高。Of course, the similarity between events can also be measured by the number of shared nodes between events. For example, the fourth similarity can be positively correlated with the number of shared nodes, that is, the more shared nodes there are, the higher the similarity between events.
进一步地,计算第三损失值的具体方式可以表示为,其中,以第二事件为例,可以通过事件对比模块输出第二事件与正样本集合中的样本之间的相似度,为便于区分称为第四相似度。如可以在事件对比模块中设置第二线性变换层,通过该第二线性变换层输出第二事件与正样本集合中的样本之间的相似度。还可以结合前述多元对比模块中设置的第一线性变换层来输出第二事件与负样本集合中的样本之间的相似度,为便于区分称为第五相似度。随后基于该第四相似度和第五相似度来计算损失值,得到第三损 失值。在更新事件检测模型的过程中,可以更新该第一线性变换层与第二线性变换层。Furthermore, the specific method of calculating the third loss value can be expressed as follows: taking the second event as an example, the similarity between the second event and the samples in the positive sample set can be output through the event comparison module, which is called the fourth similarity for easy distinction. For example, a second linear transformation layer can be set in the event comparison module, and the similarity between the second event and the samples in the positive sample set is output through the second linear transformation layer. It is also possible to combine the first linear transformation layer set in the aforementioned multivariate comparison module to output the similarity between the second event and the samples in the negative sample set, which is called the fifth similarity for easy distinction. The loss value is then calculated based on the fourth similarity and the fifth similarity to obtain the third loss value. In the process of updating the event detection model, the first linear transformation layer and the second linear transformation layer may be updated.
此外,若事件检测模型中未设置多元对比模块,则可以单独设置并训练第一线性变换层,或者通过第二线性变换层来输出第二事件与负样本集合中的样本之间的相似度,具体可以根据实际应用场景进行调整。In addition, if the multivariate comparison module is not set in the event detection model, the first linear transformation layer can be set and trained separately, or the second linear transformation layer can be used to output the similarity between the second event and the samples in the negative sample set. The specific adjustment can be made according to the actual application scenario.
因此,本申请提供的异常事件检测模型的构建过程中,可以构建每个事件对应的正样本集合和负样本集合,从而通过每个事件对应的正样本集合和负样本集合来进行对比学习,实现无监督学习,从而使异常事件检测模型可以结合事件之间的相似度来准确识别事件是否异常。Therefore, in the process of constructing the abnormal event detection model provided by the present application, a positive sample set and a negative sample set corresponding to each event can be constructed, so as to perform comparative learning through the positive sample set and the negative sample set corresponding to each event to achieve unsupervised learning, so that the abnormal event detection model can combine the similarity between events to accurately identify whether an event is abnormal.
二、推理部分2. Reasoning
其中,本申请提供的推理部分可以部署于云端、本地服务器或者本地客户端中,即本申请提供的异常事件检测方法可以由云端、本地服务器或者本地客户端来还行,当部署于云端时,用户可以通过本地客户端与云端进行交互。本申请以下实施方式中,以用户与客户端进行交互为例进行示例性介绍。Among them, the reasoning part provided by this application can be deployed in the cloud, local server or local client, that is, the abnormal event detection method provided by this application can be implemented by the cloud, local server or local client. When deployed in the cloud, the user can interact with the cloud through the local client. In the following implementation of this application, the user interacts with the client as an example for exemplary introduction.
参阅图8,本申请提供的一种异常事件检测方法的流程示意图,如下所述。Referring to FIG8 , a flow chart of an abnormal event detection method provided by the present application is as follows.
801、获取属性异质性图。801. Obtain an attribute heterogeneity graph.
该属性异质性图中可以包括多个节点以及该多个节点之间的关联关系,该属性异质性图可以用于表示至少一个事件,每个事件可以包括至少两个节点以及该至少两个节点之间的关联关系。每个事件中的每个节点可以包括形成该事件的一个事件元素的信息。为便于区分称为第一属性异质性图,与前述的第二属性异质性图可以相同也可以不相同。The attribute heterogeneity graph may include multiple nodes and associations between the multiple nodes. The attribute heterogeneity graph may be used to represent at least one event, and each event may include at least two nodes and associations between the at least two nodes. Each node in each event may include information forming an event element of the event. For ease of distinction, it is called the first attribute heterogeneity graph, which may be the same as or different from the aforementioned second attribute heterogeneity graph.
通常,在推理部分,用户可以通过客户端请求进行异常事件检测,以本申请提供的方法部署于云端为例,该云端可以通过客户端为用户提供服务器。当用户在客户端请求进行异常事件检测后,客户端将请求发送至云端。云端在接收到用户请求后,可以基于用户请求从本地读取用户的相关数据,或者向保存了用户数据的服务器、终端或者其他设备请求用户相关数据。云端可以基于接收到的数据生成属性异质性图,为便于区分可以称为第一属性异质性图。Typically, in the reasoning part, the user can request abnormal event detection through the client. Taking the method provided in this application deployed in the cloud as an example, the cloud can provide a server for the user through the client. After the user requests abnormal event detection on the client, the client sends the request to the cloud. After receiving the user request, the cloud can read the user's relevant data from the local based on the user request, or request the user's relevant data from the server, terminal or other device that stores the user data. The cloud can generate an attribute heterogeneity graph based on the received data, which can be called the first attribute heterogeneity graph for ease of distinction.
例如,用户相关的数据可以包括用户进行金融操作的相关数据,云端接收到用户或者商家发起的异常事件检测请求后,可以向保存了用户数据的设备请求数据。在云端接收到其他设备发送的数据后,可以基于接收到的数据生成属性异质性图以及对应的事件集合。该属性异质性图中可以包括多种类型的节点,如用户、操作类型、交易金额、操作时间、登录设备或者登录时间等节点,事件集合中即包括了具体的用户信息、作类型、交易金额、操作时间、登录设备或者登录时间等信息。事件集合与属性异质性图中的节点之间具有映射关系,从而通过该属性异质性图、事件集合以及映射关系来表示用户的金融操作行为产生的数据。For example, user-related data may include data related to the user's financial operations. After the cloud receives an abnormal event detection request initiated by the user or merchant, it can request data from the device that stores the user data. After the cloud receives data sent by other devices, an attribute heterogeneity graph and a corresponding event set can be generated based on the received data. The attribute heterogeneity graph may include multiple types of nodes, such as user, operation type, transaction amount, operation time, login device or login time nodes, and the event set includes specific user information, operation type, transaction amount, operation time, login device or login time information. There is a mapping relationship between the event set and the nodes in the attribute heterogeneity graph, so that the data generated by the user's financial operation behavior is represented by the attribute heterogeneity graph, the event set and the mapping relationship.
此外,也可以由云端自动生成针对一个或者多个用户的异常事件检测的请求,并向保存了该一个或者多个用户的数据的设备请求数据。云端可以根据接收到的数据来生成属性异质性图以及对应的事件集合,该属性异质性图中包括多种类型的节点,属性异质性图与事件集合中的事件具有映射关系。In addition, the cloud can also automatically generate a request for abnormal event detection for one or more users, and request data from a device that stores the data of the one or more users. The cloud can generate an attribute heterogeneity graph and a corresponding event set based on the received data. The attribute heterogeneity graph includes multiple types of nodes, and the attribute heterogeneity graph has a mapping relationship with the events in the event set.
例如,可以针对社交平台进行水军检测任务。通常,社交平台充斥着大量水军,通过发表恶意的评论误导用户。因此,可以由社交平台发起异常事件检测请求,云端在接收到该请求后,可以采集社交平台中的多个用户发表的评论,并生成属性异质性图,该属性异质性图中可以包括多个节点,如用户、发表时间、登录设备或者评论内容等分别作为节点;相应地采集一个或多个用户的信息、发表评论时间、登录设备的信息或者评论内容等得到事件集合。For example, a water army detection task can be performed on social platforms. Usually, social platforms are full of water armies, which mislead users by posting malicious comments. Therefore, a social platform can initiate an abnormal event detection request. After receiving the request, the cloud can collect comments posted by multiple users on the social platform and generate an attribute heterogeneity graph. The attribute heterogeneity graph can include multiple nodes, such as users, posting time, login devices, or comment content, etc. as nodes; accordingly, the information of one or more users, the time of posting comments, the information of login devices, or the content of comments, etc. are collected to obtain an event set.
在一种可选的实施方式中,在得到属性异质性图以及对应的事件集合后,可以将事件集合中的事件数据与属性异质性图进行映射,从而将事件的具体信息映射至各个节点中。相当于将各个事件的具体数据映射至同一空间中,对各个事件的维度进行了统一,得到各个事件在同一分布中的数据表示,以便于后续可以基于同一空间中的数据来进行异常事件识别。In an optional implementation, after obtaining the attribute heterogeneity graph and the corresponding event set, the event data in the event set can be mapped to the attribute heterogeneity graph, thereby mapping the specific information of the event to each node. This is equivalent to mapping the specific data of each event to the same space, unifying the dimensions of each event, and obtaining the data representation of each event in the same distribution, so that abnormal events can be identified based on the data in the same space in the future.
802、将属性异质性图作为异常事件检测模型的输入,得到输出结果。802. Using the attribute heterogeneity graph as an input of an abnormal event detection model to obtain an output result.
其中,在得到第一属性异质性图后,可以将该属性异质性图以及对应的所表示的各个事件的具体数据作为异常事件检测模型的输入,得到输出结果,该输出结果可以用于表示输入数据中各个事件中是否 包括异常事件,异常事件可以是通过该异常事件检测模型计算得到的事件之间的相似度或者事件内的节点之间的相似度确定。After obtaining the first attribute heterogeneity graph, the attribute heterogeneity graph and the corresponding specific data of each event represented can be used as the input of the abnormal event detection model to obtain the output result, which can be used to indicate whether each event in the input data is abnormal. Including abnormal events, abnormal events can be determined by the similarity between events calculated by the abnormal event detection model or the similarity between nodes in the event.
该异常事件检测模型具体可以包括通过前述图4对应的步骤学习得到的异常事件检测模型,对于训练过程此处不再赘述。The abnormal event detection model may specifically include the abnormal event detection model learned through the steps corresponding to the aforementioned FIG. 4 , and the training process will not be described in detail herein.
因此,本申请提供的异常事件检测模型,可以通过事件之间的相似度或者事件内的节点之间的相似度来检测事件是否异常,从而可以准确地识别出异常事件。即使在事件复杂,如节点较多或者事件较多等情况下,也可以准确识别出异常事件,泛化能力强。Therefore, the abnormal event detection model provided by the present application can detect whether an event is abnormal by the similarity between events or the similarity between nodes within an event, so as to accurately identify abnormal events. Even in the case of complex events, such as a large number of nodes or a large number of events, abnormal events can be accurately identified, and the generalization ability is strong.
具体地,该异常事件检测模型中可以包括:节点对对比模块、多元交互模块或事件对比模块中的至少一种。该节点对比模块可以用于获取事件内的节点之间的相似度,该多元交互模块用于获取事件内的节点和事件类别之间的相似度,该事件对比模块用于获取事件之间的相似度。Specifically, the abnormal event detection model may include: at least one of a node pair comparison module, a multivariate interaction module, or an event comparison module. The node comparison module may be used to obtain the similarity between nodes in an event, the multivariate interaction module is used to obtain the similarity between nodes in an event and event categories, and the event comparison module is used to obtain the similarity between events.
下面分别对各个模块的推理过程进行介绍。The reasoning process of each module is introduced below.
1.节点对对比模块1. Node pair comparison module
若异常事件检测模型中包括节点对对比模块,则可以通过节点对对比模块输出每个事件的异常程度,为便于区分将节点对对比模块输出的异常程度称为第一异常程度。其中,该节点对对比模块可以用于计算每个事件中的节点对之间的相似度,并根据节点对之间的相似度计算得到该第一异常程度。If the abnormal event detection model includes a node pair comparison module, the abnormality degree of each event can be output by the node pair comparison module. For the convenience of distinction, the abnormality degree output by the node pair comparison module is called the first abnormality degree. The node pair comparison module can be used to calculate the similarity between the node pairs in each event, and the first abnormality degree is calculated based on the similarity between the node pairs.
具体地,可以基于事件中一个或者多个相似度最低的节点对之间相似度来计算该第一异常程度,如可以直接将值最低的相似度作为第一异常程度的值,或者对事件中的多个相似度最低的节点进行加权融合后得到该第一异常程度。Specifically, the first abnormality degree can be calculated based on the similarity between one or more pairs of nodes with the lowest similarity in the event. For example, the similarity with the lowest value can be directly used as the value of the first abnormality degree, or the first abnormality degree can be obtained by weighted fusion of multiple nodes with the lowest similarity in the event.
本申请实施方式中,可以通过节点之间的相似度来表示事件的异常程度。因此可以从事件内部的节点之间的相似度来识别事件是否异常。In the implementation manner of the present application, the degree of abnormality of an event can be represented by the similarity between nodes. Therefore, whether an event is abnormal can be identified from the similarity between nodes within the event.
2.多元交互模块2. Multiple interactive modules
若异常事件检测模型中包括多元交互模块,则可以通过多元交互模块输出每个事件的异常程度,为便于区分将多元交互模块输出的异常程度称为第二异常程度。其中,多元交互模块可以用于对每个事件中的多个节点进行融合,得到标识符节点,事件中的其他节点可以称为上下文节点,并通过每个节点与标识符节点之间的相似度来衡量事件的异常程度,得到第一异常程度,如相似度越高,异常程度也就越低,相似度越低,异常程度也就越高。If the abnormal event detection model includes a multivariate interaction module, the abnormality degree of each event can be output through the multivariate interaction module. For the convenience of distinction, the abnormality degree output by the multivariate interaction module is called the second abnormality degree. Among them, the multivariate interaction module can be used to fuse multiple nodes in each event to obtain an identifier node, and other nodes in the event can be called context nodes. The abnormality degree of the event is measured by the similarity between each node and the identifier node to obtain the first abnormality degree. For example, the higher the similarity, the lower the abnormality degree, and the lower the similarity, the higher the abnormality degree.
具体地,多元交互模块可以对每个事件中的多个节点进行聚类,将该多个节点分为一种或者多种类别,随后可以从该一种或多种类别中确定一个聚类中心作为标识符节点。Specifically, the multivariate interaction module may cluster multiple nodes in each event, classify the multiple nodes into one or more categories, and then determine a cluster center from the one or more categories as an identifier node.
进一步地,多元交互模块计算事件异常程度的方式可以包括,可以使用评分函数来计算标识符节点和上下文节点之间的相似度或者说兼容性。如可以采用双线性评分函数来构建基于标识符节点和上下文节点计算异常程度的模型。Furthermore, the multivariate interaction module can calculate the degree of abnormality of an event by using a scoring function to calculate the similarity or compatibility between the identifier node and the context node. For example, a bilinear scoring function can be used to construct a model for calculating the degree of abnormality based on the identifier node and the context node.
本申请实施方式中,多元交互模块可以通过识别上下文节点和标识节点之间的相似度来计算异常程度,从而可以从节点与类别之间的相似度的维度来衡量事件是否异常,可以准确地识别出异常事件。In the implementation manner of the present application, the multivariate interaction module can calculate the degree of abnormality by identifying the similarity between the context node and the identification node, so that whether the event is abnormal can be measured from the dimension of the similarity between the node and the category, and abnormal events can be accurately identified.
3、事件对比模块3. Event comparison module
若异常事件检测模型中包括事件对比模块,该事件对比模块可以通过比较事件之间的相似度来输出事件的异常程度,为便于区分称为第三异常程度。If the abnormal event detection model includes an event comparison module, the event comparison module can output the abnormality degree of the event by comparing the similarities between events, which is called the third abnormality degree for easy distinction.
具体地,事件对比模块可以用于从多个事件中筛选出每个事件分别对应的正样本集合,根据每个事件和对应的正样本集合中的事件之间的相似度,输出每个事件对应的第三异常程度。Specifically, the event comparison module can be used to filter out the positive sample sets corresponding to each event from multiple events, and output the third abnormality degree corresponding to each event according to the similarity between each event and the events in the corresponding positive sample set.
其中,从多个事件中筛选出每个事件分别对应的正样本集合的方式具体可以包括:可以从该多个事件中筛选出与当前事件的共享节点的数量大于第一阈值的事件作为与当前事件的正样本,得到正样本集合。Among them, the method of filtering out the positive sample set corresponding to each event from multiple events can specifically include: filtering out the events whose number of shared nodes with the current event is greater than a first threshold from the multiple events as positive samples with the current event, to obtain the positive sample set.
事件对比模块计算异常程度的方式可以包括:对每个事件进行语义识别,得到每个事件的表征,随后即可根据每个事件的表征计算每个事件与正样本集合中的事件之间的相似度,并根据该相似度计算。The event comparison module may calculate the degree of abnormality by performing semantic recognition on each event to obtain a representation of each event, and then calculating the similarity between each event and the events in the positive sample set based on the representation of each event, and calculating based on the similarity.
具体地,可以采用评分函数来计算第三异常程度,如可以处采用双线性评分函数来计算每个事件的 第三异常程度。如事件对比模块中可以设置第二线性变换层,用于基于双线性函数计算异常程度。在对异常事件检测模型进行反向更新时,也需对该第二线性变换层的参数进行更新,从而使多元交互模块输出的相似度的值更准确。Specifically, a scoring function can be used to calculate the third abnormality degree, such as a bilinear scoring function can be used to calculate the third abnormality degree of each event. The third abnormality level. For example, a second linear transformation layer can be set in the event comparison module to calculate the abnormality level based on a bilinear function. When the abnormal event detection model is reversely updated, the parameters of the second linear transformation layer also need to be updated to make the similarity value output by the multivariate interaction module more accurate.
应理解,若异常事件检测模型中设置了节点对对比模块、多元交互模块或事件对比模块中的其中一个模块,则可以将设置的模块输出的事件的异常程度作为输出结果。若异常事件检测模型中设置了对对比模块、多元交互模块或事件对比模块中的至少两个模块,则可以对设置的至少两个模块输出的异常程度进行融合,从而得到融合后的每个事件的异常程度,为便于区分称为第四异常程度,并根据每个事件的第四异常程度来判断每个事件是否为异常事件,得到最终的输出结果。异常事件检测模型中所设置的模块的类型和数量具体可以根据实际应用场景来进行选择,本申请对此并不作限定。例如,若异常事件检测模型中设置了节点对对比模块、多元交互模块或事件对比模块,则可以对每个事件的第一异常程度、第二异常程度以及第三异常程度机械能加权融合,得到第四异常程度,并根据每个事件的第四异常程度判断每个事件是否为异常事件,如将第四异常程度高于预设值的事件识别为异常事件,以得到输出结果。It should be understood that if one of the modules in the node pair comparison module, the multivariate interaction module or the event comparison module is set in the abnormal event detection model, the abnormal degree of the event output by the set module can be used as the output result. If at least two modules in the pair comparison module, the multivariate interaction module or the event comparison module are set in the abnormal event detection model, the abnormal degree output by the at least two modules can be fused to obtain the abnormal degree of each event after fusion, which is called the fourth abnormal degree for the convenience of distinction, and each event is judged to be an abnormal event according to the fourth abnormal degree of each event to obtain the final output result. The type and number of modules set in the abnormal event detection model can be selected according to the actual application scenario, and this application does not limit this. For example, if the node pair comparison module, the multivariate interaction module or the event comparison module is set in the abnormal event detection model, the first abnormal degree, the second abnormal degree and the third abnormal degree of each event can be mechanically weighted and fused to obtain the fourth abnormal degree, and each event can be judged to be an abnormal event according to the fourth abnormal degree of each event, such as identifying an event with a fourth abnormal degree higher than a preset value as an abnormal event, to obtain the output result.
因此,本申请实施方式中,可以结合事件内节点之间的相似度、事件内节点和标识符节点之间的相似度或者事件之间的相似度等识别事件是否异常。因此即使事件复杂,如每个事件具有多个节点或者节点具有多种属性等,也可以通过本申请提供的异常事件检测模型准确地识别出异常事件,具有非常强的泛化能力。Therefore, in the implementation of the present application, whether an event is abnormal can be identified by combining the similarity between nodes within the event, the similarity between nodes within the event and the identifier node, or the similarity between events. Therefore, even if the event is complex, such as each event has multiple nodes or nodes have multiple attributes, the abnormal event detection model provided by the present application can accurately identify the abnormal event, which has a very strong generalization ability.
前述对本申请提供的异常事件检测模型构建方法以及异常事件检测方法的流程进行了介绍。为便于理解,结合具体的应用场景,进一步对本申请提供的异常事件检测模型构建方法以及异常事件检测方法的流程进行更详细地介绍。The above describes the abnormal event detection model construction method and the abnormal event detection method process provided by the present application. For ease of understanding, in combination with specific application scenarios, the abnormal event detection model construction method and the abnormal event detection method process provided by the present application are further described in more detail.
本申请提供了一种新的异常事件检测框架(如可以称为AEHCL),即基于超图对比学习的异常事件检测模型。The present application provides a new abnormal event detection framework (such as can be called AEHCL), that is, an abnormal event detection model based on hypergraph contrastive learning.
具体来说,AHIN中的事件被定义为星型模式实例,本申请可以进一步使用超图中的超边概念来模拟事件中的复杂交互。本申请提出了一种新的超图对比学习方法,以充分捕捉复杂多样的异常模式。具体从事件内和事件间两个层面提供了两种对比策略。事件内对比模块侧重于挖掘事件中的异常模式,该模块由两个子模块组成。成对对比模块捕获成对交互异常模式,而多元对比模块捕获多元高阶交互异常模式。还提供了事件对比模块来建模事件之间的异常模式,即异常事件与其上下文事件不一致的情况。这些模块都以端到端的方式同时优化,并相互促进。在训练阶段,提供了一种基于对比的异常事件评分函数来度量异常程度,该函数综合了上述模块的检测结果。Specifically, events in AHIN are defined as star pattern instances, and the present application can further use the concept of hyperedges in the hypergraph to simulate complex interactions in events. The present application proposes a new hypergraph contrast learning method to fully capture complex and diverse abnormal patterns. Specifically, two contrast strategies are provided from the intra-event and inter-event levels. The intra-event contrast module focuses on mining abnormal patterns in events, and the module consists of two sub-modules. The pairwise contrast module captures pairwise interaction abnormal patterns, while the multivariate contrast module captures multivariate high-order interaction abnormal patterns. An event contrast module is also provided to model abnormal patterns between events, that is, situations where abnormal events are inconsistent with their contextual events. These modules are optimized simultaneously in an end-to-end manner and promote each other. In the training phase, a contrast-based abnormal event scoring function is provided to measure the degree of abnormality, which integrates the detection results of the above modules.
因此,本申请将属性异质图中的事件定义为网络模式实例,并用超图进行进一步建模,从而可以挖掘属性异质图中更加复杂的异常元素交互。Therefore, this application defines events in attribute heterogeneous graphs as network pattern instances and further models them with hypergraphs, so that more complex interactions of abnormal elements in attribute heterogeneous graphs can be mined.
示例性地,本申请提供的方法的应用架构可以参阅图9。Exemplarily, the application architecture of the method provided in this application can be found in FIG9 .
首先获取属性异质性图以及对应的事件集合,属性异质性图可以表示多个事件,每个事件包括的节点以及节点之间的关联关系可以保存于事件集合中。事件集合中的每个事件可以表示为星型拓扑图。属性异质性图可以定义为超图(Hypergraph),超图是一种广义上的图,其中的一条边可以连接任意数量的顶点。每个事件由集合中的中心节点唯一确定,集合中其他节点为事件的上下文节点。比如在电商欺诈检测中,一个事件可以看作一次交易,中心节点为交易设备,上下文节点为本次交易涉及到的事件元素,如用户和商品等。First, obtain the attribute heterogeneity graph and the corresponding event set. The attribute heterogeneity graph can represent multiple events. The nodes included in each event and the association relationship between the nodes can be saved in the event set. Each event in the event set can be represented as a star topology graph. The attribute heterogeneity graph can be defined as a hypergraph. A hypergraph is a generalized graph in which an edge can connect any number of vertices. Each event is uniquely determined by the central node in the set, and the other nodes in the set are the context nodes of the event. For example, in e-commerce fraud detection, an event can be regarded as a transaction, the central node is the transaction device, and the context node is the event element involved in this transaction, such as users and products.
随后将不同类型的节点属性通过线性变换映射到同一空间并且统一维度,作为训练异常事件检测模型的训练集,并使用训练集训练异常事件检测模型,得到训练后的异常事件检测模型。Subsequently, different types of node attributes are mapped to the same space and unified in dimension through linear transformation, which is used as the training set for training the abnormal event detection model. The training set is used to train the abnormal event detection model to obtain the trained abnormal event detection model.
训练后的异常事件检测模型即可部署于云端、服务器或者客户端中,以部署于客户端为例,以使客户端可以计算异常事件得分,用于表示事件异常程度。The trained abnormal event detection model can be deployed in the cloud, server or client. For example, the model can be deployed in the client so that the client can calculate the abnormal event score to indicate the degree of abnormality of the event.
本申请构建的异常事件检测模型,可以充分捕捉事件中的异常模式,包括事件内和事件间异常。其中,事件内对比模块可以包括:The abnormal event detection model constructed in this application can fully capture abnormal patterns in events, including intra-event and inter-event anomalies. Among them, the intra-event comparison module can include:
成对对比,即对于每个节点,正样本为事件内的其他节点,负样本为其他事件中的节点。Paired comparison, that is, for each node, the positive samples are other nodes in the event, and the negative samples are nodes in other events.
多元对比,即对于每个事件的中心节点,正样本为此事件内的上下文节点的聚合表示,构造负样本 时,首先对节点进行聚类,然后挑选一个或多个节点进行替换,替换成其他簇的节点,这样得到的上下文集合为负样本。Multivariate comparison, that is, for the central node of each event, the positive sample is the aggregated representation of the context nodes in this event, and the negative sample is constructed When , the nodes are first clustered, and then one or more nodes are selected for replacement with nodes from other clusters. The resulting context set is a negative sample.
事件间对比模块首先定义事件的邻居事件,即链接两个事件中节点的元路径条数最多的事件。然后邻居事件集合做为正样本集合,元路径条数比较少的事件为负样本。The event comparison module first defines the neighbor events of an event, that is, the event with the largest number of meta-paths linking the nodes in two events. Then the set of neighbor events is used as the positive sample set, and the events with fewer meta-paths are negative samples.
不同于已有的针对同质图中的异常节点得分函数,本申请提供的异常事件得分函数需要考虑更复杂的异常模式,需要综合考虑各种异常,所以设计也更加复杂。本申请提供的异常事件检测模型的计算复杂度较低,具有很高的普适性,可以应用于多种现实的属性异质图场景。Different from the existing scoring functions for abnormal nodes in homogeneous graphs, the abnormal event scoring function provided by this application needs to consider more complex abnormal patterns and various abnormalities, so the design is more complex. The abnormal event detection model provided by this application has low computational complexity and high universality, and can be applied to a variety of real-world attribute heterogeneous graph scenarios.
下面结合具体的应用场景分别对训练部分和推理部分进行介绍。The following introduces the training part and the reasoning part respectively in combination with specific application scenarios.
一、训练部分1. Training
训练部分可以分为多个步骤,如图10所示。The training part can be divided into multiple steps, as shown in Figure 10.
1、输入1. Input
首先,对训练部分的输入数据进行介绍。First, the input data for the training part is introduced.
示例性地,一个事件定义为E=(e,C,X),可以被表示成属性异质图中的一个星型模式实例,是中心节点,可看成这个事件的一个索引,是上下文节点,同时连接中心节点,X∈R(1+|C|)×k是属性矩阵。前述图7展示了引用网络中的事件示例。在这个例子中,中心节点是论文节点,唯一标识了某个发表论文的事件,上下文节点是会议和作者。为了对事件的高阶语义进行建模(例如,一篇论文中有多个作者合著),进一步使用超图对事件进行建模,将所有涉及的节点作为一个整体进行研究。如前述图5所示,发表论文事件由超图建模,从而与多种类型的节点(即论文、作者和会议)关联。如果事件表现出罕见的交互模式,则该事件是异常的。前述图5展示了引文网络中的异常合作事件。该事件包含数据挖掘专家与放射科医生合作发表论文的语义,这种情况很少发生,所以被视为异常。For example, an event is defined as E = (e, C, X), which can be represented as a star schema instance in an attribute heterogeneous graph. It is the central node, which can be seen as an index of this event. is a context node, connected to the central node, and X∈R (1+|C|)×k is an attribute matrix. Figure 7 above shows an example of an event in a citation network. In this example, the central node is the paper node, which uniquely identifies a certain event of publishing a paper, and the context nodes are conferences and authors. In order to model the higher-order semantics of the event (for example, multiple authors co-authored a paper), the event is further modeled using a hypergraph, and all the nodes involved are studied as a whole. As shown in Figure 5 above, the event of publishing a paper is modeled by a hypergraph, and is thus associated with multiple types of nodes (i.e., papers, authors, and conferences). An event is abnormal if it exhibits a rare interaction pattern. Figure 5 above shows an abnormal collaboration event in a citation network. The event contains the semantics of a data mining expert collaborating with a radiologist to publish a paper, which rarely occurs, so it is considered an anomaly.
2、实体属性映射2. Entity attribute mapping
由于事件包含多种类型的节点(图5至图7中所使出的节点类型即为论文、作者和会议),通常直接将原始节点表示用于下游任务会降低性能。通常,若采用异构图卷积,其中的聚合操作可能会损害原始特征交互模式,导致检测结果下降。因此本申请通过一个简单的特定类型转换层将每个节点表示直接转换到共享的潜在空间:
Z(t)=σ(X(t)·W(t)+b(t))
Since events contain multiple types of nodes (the node types used in Figures 5 to 7 are papers, authors, and conferences), directly using the original node representation for downstream tasks will usually degrade performance. Usually, if heterogeneous graph convolution is used, the aggregation operation may damage the original feature interaction pattern, resulting in a decrease in detection results. Therefore, this application directly converts each node representation to a shared latent space through a simple specific type conversion layer:
Z ( t ) = σ ( X ( t ) · W ( t ) + b ( t ) )
这里X(t)∈R|V|×d是原始节点特征,W(t)∈Rd×h和b(t)∈R1×h是t类型节点的转换参数。σ(·)代表激活函数。经过转换,每个节点的h维表示在同一空间内,z即表示节点的表征集合。Here X (t) ∈R |V|×d is the original node feature, W (t) ∈Rd ×h and b (t) ∈R1 ×h are the transformation parameters of the t-type node. σ(·) represents the activation function. After the transformation, the h-dimensional representation of each node is in the same space, and z represents the representation set of the node.
3、建模。3. Modeling.
其中,异常事件检测模型中包括用于对事件内异常进行识别的模块以及对事件间异常进行识别,下面分别进行介绍。Among them, the abnormal event detection model includes modules for identifying anomalies within events and identifying anomalies between events, which are introduced below.
(1)成对对比模块(1) Paired comparison module
作为捕获事件内节点对匹配关系的基本模块,成对相似性也用于许多超图表示学习方法中。其背后的基本基础是,事件中的成对节点匹配度应该高于其他节点,因此可以基于节点对之间相似度发现具有不兼容的异常节点对,即相似度低于一定值的节点对。首先可以对节点对的正常匹配模式进行建模,然后认为不符合该模式的节点对是异常的。若直接融合事件中的所有成对交互,以获得事件异常分数,则作可能会削弱异常节点对异常程度。As a basic module for capturing the matching relationship of node pairs within an event, pairwise similarity is also used in many hypergraph representation learning methods. The basic basis behind it is that the matching degree of paired nodes in an event should be higher than that of other nodes, so incompatible abnormal node pairs can be found based on the similarity between node pairs, that is, node pairs with similarity below a certain value. First, the normal matching pattern of node pairs can be modeled, and then the node pairs that do not conform to the pattern are considered abnormal. If all pairwise interactions in the event are directly fused to obtain the event anomaly score, the degree of abnormality of the abnormal node pairs may be weakened.
此外,在成对对比模块中,关注节点对异常,而不是整个事件。将每个节点的匹配模式与其他节点分别建模。具体而言,对于事件中的单个节点vi,优化如下对比损失:
In addition, in the pairwise contrast module, we focus on node pair anomalies rather than the entire event. We model the matching pattern of each node separately from other nodes. Specifically, for a single node v i in the event, we optimize the following contrast loss:
其中,sim(·)是余弦相似度匹配函数,也可以替换为其他相似度函数,即表示节点和节点之间的相似度,exp(·)是以自然常数e为底的指数函数。zi即节点vi的表征。Pi和Ni分别是节点i的正样本集合和 负样本集合。温度系数τ的作用是调节对困难样本的关注程度:越小的温度系数越关注于将本样本和最相似的其他样本分开。困难样本可以理解为与当前样本相似度高的负样本。Among them, sim(·) is the cosine similarity matching function, which can also be replaced by other similarity functions, that is, it represents the similarity between nodes, and exp(·) is an exponential function with the natural constant e as the base. z i is the representation of node vi . P i and N i are the positive sample set and Negative sample set. The role of the temperature coefficient τ is to adjust the degree of attention to difficult samples: the smaller the temperature coefficient, the more attention is paid to separating the current sample from the most similar other samples. Difficult samples can be understood as negative samples with high similarity to the current sample.
对于事件e中的一个节点vi,正样本节点集合Pi={vj∣vj∈e\vi}。可以随机采样n个不属于e的节点作为负样本节点。这种简单的负样本采样方法已经达到了很好的效果。同样在后续实验中展示了一些更加复杂的采样策略。最后,可以将一个事件中所有节点的对比损失和所有事件中的平均损失相加,得到最终的成对对比损失,即第一损失值:
For a node vi in event e, the positive sample node set Pi = { vj | vj ∈e\ vi }. We can randomly sample n nodes that do not belong to e as negative sample nodes. This simple negative sample sampling method has achieved good results. Some more complex sampling strategies are also demonstrated in subsequent experiments. Finally, we can add the contrast loss of all nodes in an event and the average loss of all events to get the final pairwise contrast loss, that is, the first loss value:
随后即可基于最终的成对对比损失对成对对比模块进行反向更新,得到更新后的成对对比模块。若异常事件检测模型中包括多个模块,则可以使用多个模块分别输出的结果来计算整体的损失值,并对异常事件检测模型整体进行反向更新,得到更新后的异常事件检测模型。Then, the paired comparison module can be reversely updated based on the final paired comparison loss to obtain an updated paired comparison module. If the abnormal event detection model includes multiple modules, the results output by the multiple modules can be used to calculate the overall loss value, and the abnormal event detection model as a whole can be reversely updated to obtain an updated abnormal event detection model.
(2)多元交互模块(2) Multiple Interaction Modules
对于事件中更复杂的异常交互,可以通过本申请提供的多元交互模块来进行识别。More complex abnormal interactions in events can be identified through the multi-element interaction module provided in this application.
即使在事件中的成对交互通常都是正常交互的情况下,当考虑与两个以上节点的交互时,事件也可能是异常的。本申请可以用多元对比模块对这类异常事件进行建模。该模块通过建模标识符节点和上下文节点(即事件中的非标识符节点)之间的兼容性来捕获事件中的多元交互模式。标识符节点可以包括事件中的多个节点融合后的节点、事件的中心节点或者聚类中心等,上下文节点即事件中除标识符节点以外的节点。通常,在正常的节点交互中,标识符节点和上下文节点的兼容性很高,即相似度很高。例如,一篇论文的内容与发表会议的类型和作者的兴趣高度相关。Even when paired interactions in an event are usually normal interactions, an event may be abnormal when interactions with more than two nodes are considered. The present application can use a multivariate comparison module to model such abnormal events. The module captures multivariate interaction patterns in events by modeling the compatibility between identifier nodes and context nodes (i.e., non-identifier nodes in events). Identifier nodes may include nodes fused from multiple nodes in an event, central nodes or clustering centers of an event, etc., and context nodes are nodes other than identifier nodes in an event. Typically, in normal node interactions, the compatibility of identifier nodes and context nodes is high, i.e., the similarity is high. For example, the content of a paper is highly correlated with the type of conference in which it is published and the interests of the author.
具体来说,对于事件e中的每个节点vi,可以首先添加一个类型嵌入ti,即标识符节点,以获得类型感知的节点表示hi
hi=zi+ti
Specifically, for each node vi in event e, we can first add a type embedding ti , i.e., an identifier node, to obtain a type-aware node representation h i :
hi = z i + ti
类型嵌入可以使模型捕获到异质节点间的交互,从而捕获更有意义的交互模式。然后对于事件ei中的上下文节点集可以使用上式得到它们的表示为了对标识符节点和上下文节点之间的多变量交互进行建模,并获得最终的上下文表示ci,本申请可以使用自注意机制selfatt(·),然后接一个最大池化层:
Type embedding enables the model to capture the interactions between heterogeneous nodes, thereby capturing more meaningful interaction patterns. Then for the context node set in event e i The above formula can be used to get their expression In order to model the multivariate interactions between the identifier node and the context node and obtain the final context representation c i , this application can use the self-attention mechanism selfatt(·) followed by a maximum pooling layer:
得到与标识符相关的上下文节点的表示。Gets a representation of the context node associated with the identifier.
随后,可以使用双线性评分函数来建模标识符节点和上下文节点之间的兼容性,即第二相似度:
Subsequently, a bilinear scoring function can be used to model the compatibility between the identifier node and the context node, i.e., the second similarity:
其中,hi是事件ei的标识符节点表示,σ(·)是sigmoid激活函数,Wm为线性转换层,即前述的第一线性转换层,在进行反向更新时需进行更新。通常正常事件的分数si应接近于1,而异常事件的分数si应接近于0。Among them, hi is the identifier node representation of event e i , σ(·) is the sigmoid activation function, and Wm is the linear transformation layer, that is, the first linear transformation layer mentioned above, which needs to be updated when performing reverse update. Usually, the score si of normal events should be close to 1, while the score si of abnormal events should be close to 0.
本申请可以使用无监督学习,即无需采集异常事件作为先验知识。但可以构造负样本来实现对比学习。如可以将当前事件中的节点替换为其他节点,但嵌入的节点需与原节点相似度不能过高,如不能高于预设相似度,以避免形成困难样本。This application can use unsupervised learning, that is, there is no need to collect abnormal events as prior knowledge. However, negative samples can be constructed to achieve comparative learning. For example, the nodes in the current event can be replaced with other nodes, but the embedded nodes must not be too similar to the original nodes, such as not higher than the preset similarity, to avoid forming difficult samples.
例如,可以根据节点的原始特征执行节点聚类,然后对于每种类型的上下文节点,随机选择一个节点,并将其替换为具有相同属性类型但不同簇(即不同类别)的另一个节点。随后,通过双线性函数得到负样本事件的得分s′i,然后,可以采用标准的二分类交叉熵(Binary CrossEntropy,BCE)损失(当然也可以替换为其他损失函数)作为多元对比损失,即第二损失值:
For example, node clustering can be performed based on the original features of the nodes, and then for each type of context node, a node is randomly selected and replaced with another node with the same attribute type but a different cluster (i.e., a different category). Subsequently, the score s′ i of the negative sample event is obtained through a bilinear function, and then the standard binary cross entropy (BCE) loss (of course, it can also be replaced by other loss functions) can be used as the multivariate contrast loss, i.e., the second loss value:
随后即可基于多元对比损失对异常事件检测模型进行反向更新。 The abnormal event detection model can then be updated in reverse based on the multivariate contrast loss.
(3)事件对比模块(3) Event comparison module
异常事件模式可能不仅限于事件内的元素异常交互,还出现在事件之间。与局部节点之间的不匹配异常类似,局部事件之间也存在不匹配异常。通常,正常事件更有可能与相邻事件具有相似的语义,而异常事件则没有。因此本申请可以使用事件-事件对比学习来建模相邻事件之间的兼容性。Abnormal event patterns may not only be limited to abnormal interactions of elements within an event, but also occur between events. Similar to mismatch anomalies between local nodes, mismatch anomalies also exist between local events. In general, normal events are more likely to have similar semantics with adjacent events, while abnormal events do not. Therefore, this application can use event-event contrastive learning to model the compatibility between adjacent events.
具体来说,本申请首先使用注意力层来获得事件表示。给定事件e,类型特定的注意力参数P∈Rh×h应用于每个上下文节点hi以获得注意力机制的key表示:
Specifically, this application first uses an attention layer to obtain event representation. Given an event e, a type-specific attention parameter P∈R h×h is applied to each context node hi to obtain the key representation of the attention mechanism:
然后,节点类型为t的注意力权重计算如下:
Then, the attention weight of node type t is calculated as follows:
其中z是事件内标识符节点的表示,zi即表示ei中的标识符节点的表示,标识符节点可以参阅前述多元交互模块中的介绍。上下文嵌入可以通过所有上下文节点嵌入与学习的权重α的加权和来获得:
Where z is the representation of the identifier node in the event, z i is the representation of the identifier node in e i , and the identifier node can refer to the introduction in the aforementioned multivariate interaction module. The context embedding can be obtained by the weighted sum of all context node embeddings and the learned weight α:
将上下文嵌入hc和标识节点嵌入z连接起来,以获得事件表示e:
e=hc∥z
Concatenate the context embedding hc and the identity node embedding z to obtain the event representation e:
e=h c ∥z
接下来,将e的相邻事件集P(e)定义为其正样本:
P(e)={ep∥ep∩e∣>Tpos}
Next, define the set of adjacent events P(e) of e as its positive samples:
P(e)={ ep | ep |> Tpos }
即当两个事件的共享节点数超过阈值Tpos时,这两个事件是彼此的正样本。同样,当共享节点数小于阈值Tneg时,定义了负样本集N(e)。对于正样本集合P(e)和负样本集合N(e),设置以下事件间对比损失,即第三损失值:
That is, when the number of shared nodes between two events exceeds the threshold T pos , the two events are positive samples of each other. Similarly, when the number of shared nodes is less than the threshold T neg , the negative sample set N(e) is defined. For the positive sample set P(e) and the negative sample set N(e), the following inter-event contrast loss, i.e., the third loss value, is set:
其中,eip从P(ei)中取样,ein从N(ei)中取样。σ(·)是激活函数,Winter即事件对比模块中进行异常事件得分评价的线性变换层,即第二线性变换层,通常是一个矩阵,Wm即前述多元交互模块中进行异常事件得分评价的线性变换层。Among them, e ip is sampled from P(e i ), and e in is sampled from N(e i ). σ(·) is the activation function, W inter is the linear transformation layer for abnormal event score evaluation in the event comparison module, that is, the second linear transformation layer, which is usually a matrix, and W m is the linear transformation layer for abnormal event score evaluation in the aforementioned multivariate interaction module.
(4)整体损失(4) Overall loss
在训练阶段,共同优化了上述三个模块。整体优化函数可以表示为:
During the training phase, the above three modules are optimized together. The overall optimization function can be expressed as:
这里α,β和γ是参数来调节三个模块对结果的影响,在进行反向更新时通常也需进行更新,具体可以是人工调整或者根据其他算法进行调整等。Here, α, β and γ are parameters to adjust the impact of the three modules on the results, and they usually need to be updated when performing reverse updates. Specifically, they can be adjusted manually or according to other algorithms.
本申请实施方式中,在异常事件检测模型的建模过程中,无需采集负样本,可以通过构造负样本的方式来实现对比学习,从而实现无监督学习。其中,异常事件检测模型基于对比学习的事件内和事件间异常模式挖掘。首先针对事件内对比学习任务,建模事件内元素的交互异常;其次针对事件间对比学习任务,建模事件间的上下文异常。基于上述对比学习模块,最后提供异常事件得分函数,为衡量事件的异常程度提供了更准确的检测方式。In the implementation manner of the present application, in the modeling process of the abnormal event detection model, there is no need to collect negative samples, and contrastive learning can be achieved by constructing negative samples, thereby achieving unsupervised learning. Among them, the abnormal event detection model is based on the mining of abnormal patterns within and between events through contrastive learning. First, for the intra-event contrastive learning task, the interaction anomalies of elements within the event are modeled; secondly, for the inter-event contrastive learning task, the contextual anomalies between events are modeled. Based on the above contrastive learning module, an abnormal event scoring function is finally provided, which provides a more accurate detection method for measuring the degree of abnormality of an event.
二、推理部分2. Reasoning
推理阶段中的异常事件检测方式与前述训练部分类似,区别在于推理阶段无需计算损失值,可直接使用各个模块来输出所检测到的相似度或者异常值。The method of detecting abnormal events in the inference stage is similar to the aforementioned training part. The difference is that there is no need to calculate the loss value in the inference stage. Each module can be used directly to output the detected similarity or abnormal value.
异常事件检测模型的结构以及执行的步骤可以如图11所示,对于推理阶段,也可以将属性异质性图中的事件转换至同一空间中,并将转换后的处于同一空间的数据表示作为异常事件检测模型的输入,输出针对事件的异常程度值。下面分别对各个阶段进行介绍。The structure and execution steps of the abnormal event detection model can be shown in Figure 11. For the reasoning stage, the events in the attribute heterogeneity graph can also be converted to the same space, and the converted data representation in the same space is used as the input of the abnormal event detection model to output the abnormal degree value for the event. Each stage is introduced below.
1、输入 1. Input
输入数据可以参阅前述图10对应的描述中的输入数据,此处不再赘述。The input data may refer to the input data in the description corresponding to the aforementioned FIG. 10 , which will not be described in detail here.
2.实体属性映射2. Entity attribute mapping
与前述图10类似地,由于事件包含多种类型的节点(图5至图7中所使出的节点类型即为论文、作者和会议),通常直接将原始节点表示用于下游任务会降低性能。通常,若采用异构图卷积,其中的聚合操作可能会损害原始特征交互模式,导致检测结果下降。因此本申请通过一个简单的特定类型转换层将每个节点表示直接转换到共享的潜在空间:
Z(t)=σ(X(t)·W(t)+b(t))
Similar to Figure 10 above, since events contain multiple types of nodes (the node types used in Figures 5 to 7 are papers, authors, and conferences), directly using the original node representation for downstream tasks will usually reduce performance. Usually, if heterogeneous graph convolution is used, the aggregation operation may damage the original feature interaction pattern, resulting in a decrease in detection results. Therefore, this application directly converts each node representation to a shared latent space through a simple specific type conversion layer:
Z ( t ) = σ ( X ( t ) · W ( t ) + b ( t ) )
这里X(t)∈R|V|×d是原始节点特征,W(t)∈Rd×h和b(t)∈R1×h是t类型节点的转换参数。σ(·)代表激活函数。经过转换,每个节点的h维表示在同一空间内,z即表示节点的表征集合。Here X (t) ∈R |V|×d is the original node feature, W (t) ∈Rd ×h and b (t) ∈R1 ×h are the transformation parameters of the t-type node. σ(·) represents the activation function. After the transformation, the h-dimensional representation of each node is in the same space, and z represents the representation set of the node.
3.异常程度打分3. Abnormality score
其中,异常事件检测模型中包括用于对事件内异常进行识别的模块以及对事件间异常进行识别,下面分别进行介绍。Among them, the abnormal event detection model includes modules for identifying anomalies within events and identifying anomalies between events, which are introduced below.
(1)成对对比模块(1) Paired comparison module
作为捕获事件内节点对匹配关系的基本模块,成对相似性也用于许多超图表示学习方法中。其背后的基本基础是,事件中的成对节点匹配度应该高于其他节点,因此可以基于节点对之间相似度发现具有不兼容的异常节点对,即相似度低于一定值的节点对。首先可以对节点对的正常匹配模式进行建模,然后认为不符合该模式的节点对是异常的。若直接融合事件中的所有成对交互,以获得事件异常分数,则作可能会削弱异常节点对异常程度。As a basic module for capturing the matching relationship of node pairs within an event, pairwise similarity is also used in many hypergraph representation learning methods. The basic basis behind it is that the matching degree of paired nodes in an event should be higher than that of other nodes, so incompatible abnormal node pairs can be found based on the similarity between node pairs, that is, node pairs with similarity below a certain value. First, the normal matching pattern of node pairs can be modeled, and then the node pairs that do not conform to the pattern are considered abnormal. If all pairwise interactions in the event are directly fused to obtain the event anomaly score, the degree of abnormality of the abnormal node pairs may be weakened.
可以通过识别节点之间的相似度来表示异常程度:
si=min(sim(zi,zj))
The degree of anomaly can be expressed by identifying the similarity between nodes:
s i =min(sim( zi , zj ))
通常,相似度越低,表示的异常程度越高,相似度越高,表示的异常程度也就越低。因此在后续的异常程度衡量过程中,可以通过取负数的形式来表示异常程度。Generally, the lower the similarity, the higher the abnormality, and the higher the similarity, the lower the abnormality. Therefore, in the subsequent abnormality measurement process, the abnormality can be expressed in the form of a negative number.
(2)多元交互模块(2) Multiple Interaction Modules
事件中的成对交互通常都是正常交互,但当考虑与两个以上节点的交互时,通常事件是异常的。本申请可以用多元对比模块对这类异常事件进行建模。该模块通过建模标识符节点和上下文节点(即事件中的非标识符节点)之间的兼容性来捕获事件中的多元交互模式。标识符节点可以包括事件中的多个节点融合后的节点、事件的中心节点或者聚类中心等,上下文节点即事件中除标识符节点以外的节点。通常,在正常的节点交互中,标识符节点和上下文节点的兼容性很高,即相似度很高。例如,一篇论文的内容与发表会议的类型和作者的兴趣高度相关。Paired interactions in events are usually normal interactions, but when considering interactions with more than two nodes, events are usually abnormal. The present application can use a multivariate comparison module to model such abnormal events. This module captures multivariate interaction patterns in events by modeling the compatibility between identifier nodes and context nodes (i.e., non-identifier nodes in events). Identifier nodes may include nodes fused from multiple nodes in an event, central nodes or clustering centers of an event, etc., and context nodes are nodes other than identifier nodes in an event. Usually, in normal node interactions, the compatibility of identifier nodes and context nodes is very high, i.e., the similarity is very high. For example, the content of a paper is highly correlated with the type of conference in which it is published and the interests of the author.
具体来说,对于事件e中的每个节点vi,可以首先添加一个类型嵌入ti,即标识符节点,以获得类型感知的节点表示hi
hi=zi+ti
Specifically, for each node vi in event e, we can first add a type embedding ti , i.e., an identifier node, to obtain a type-aware node representation h i :
hi = z i + ti
类型嵌入可以使模型捕获到异质节点间的交互,从而捕获更有意义的交互模式。然后对于事件ei中的上下文节点集可以使用上式得到它们的表示为了对标识符节点和上下文节点之间的多变量交互进行建模,并获得最终的上下文表示ci,本申请可以使用自注意机制selfatt(·),然后接一个最大池化层:
Type embedding enables the model to capture the interactions between heterogeneous nodes, thereby capturing more meaningful interaction patterns. Then for the context node set in event e i The above formula can be used to get their expression In order to model the multivariate interactions between the identifier node and the context node and obtain the final context representation c i , this application can use the self-attention mechanism selfatt(·) followed by a maximum pooling layer:
得到与标识符相关的上下文节点的表示。Gets a representation of the context node associated with the identifier.
随后,可以使用双线性评分函数来建模标识符节点和上下文节点之间的兼容性,即第二相似度:
Subsequently, a bilinear scoring function can be used to model the compatibility between the identifier node and the context node, i.e., the second similarity:
其中,hi是事件ei的标识符节点表示,σ(·)是sigmoid激活函数,Wm为线性转换层,即前述的第一线性转换层,在进行反向更新时需进行更新。通常正常事件的分数si应接近于1,而异常事件的分数si应 接近于0。因此,在后续的异常程度识别过程中也可以通过去负数的形式来表示异常程度。Among them, hi is the identifier node representation of event e i , σ(·) is the sigmoid activation function, and Wm is the linear transformation layer, that is, the first linear transformation layer mentioned above, which needs to be updated when performing reverse update. Usually, the score si of normal events should be close to 1, while the score si of abnormal events should be Close to 0. Therefore, in the subsequent abnormality degree identification process, the abnormality degree can also be expressed in the form of negative numbers.
(3)事件对比模块(3) Event comparison module
异常事件模式可能不仅限于事件内的元素异常交互,还出现在事件之间。与局部节点之间的不匹配异常类似,局部事件之间也存在不匹配异常。通常,正常事件更有可能与相邻事件具有相似的语义,而异常事件则没有。因此本申请可以使用事件-事件对比学习来建模相邻事件之间的兼容性。Abnormal event patterns may not only be limited to abnormal interactions of elements within an event, but also occur between events. Similar to mismatch anomalies between local nodes, mismatch anomalies also exist between local events. In general, normal events are more likely to have similar semantics with adjacent events, while abnormal events do not. Therefore, this application can use event-event contrastive learning to model the compatibility between adjacent events.
具体来说,本申请首先使用注意力层来获得事件表示。给定事件e,类型特定的注意力参数P∈Rh×h应用于每个上下文节点hi以获得注意力机制的key表示:
Specifically, this application first uses an attention layer to obtain event representation. Given an event e, a type-specific attention parameter P∈R h×h is applied to each context node hi to obtain the key representation of the attention mechanism:
然后,节点类型为t的注意力权重计算如下:
Then, the attention weight of node type t is calculated as follows:
其中z是事件内标识符节点的表示,zi即表示ei中的标识符节点的表示,标识符节点可以参阅前述多元交互模块中的介绍。上下文嵌入可以通过所有上下文节点嵌入与学习的权重α的加权和来获得:
Where z is the representation of the identifier node in the event, z i is the representation of the identifier node in e i , and the identifier node can refer to the introduction in the aforementioned multivariate interaction module. The context embedding can be obtained by the weighted sum of all context node embeddings and the learned weight α:
将上下文嵌入hc和标识节点嵌入z连接起来,以获得事件表示e:
e=hc∥z
Concatenate the context embedding hc and the identity node embedding z to obtain the event representation e:
e=h c ∥z
随后,可以使用双线性评分函数来建模相邻事件之间的兼容性,即第三相似度:
si=σ(eiWinterep)
Subsequently, a bilinear scoring function can be used to model the compatibility between adjacent events, i.e., the third similarity:
s i =σ(e i W inter e p )
ep为当前事件ei的正样本相邻事件,如ep可以是与ei之间共享节点数量超过Tpos的事件。 ep is the positive sample adjacent event of the current event e i . For example, ep can be an event whose number of shared nodes with e i exceeds T pos .
(4)计算异常事件得分(4) Calculate the abnormal event score
可以对多个模块分别计算得到的输出值进行加权融合,得到对于事件的异常得分,如可以表示为:
s=-(α*min(sim(zi,zj))+β*σ(ciWmzi)+γ*σ(eiWinter ep))
The output values calculated by multiple modules can be weighted and fused to obtain the abnormal score of the event, which can be expressed as:
s=-(α*min(sim( zi , zj ))+β*σ ( ciWmzi ) +γ*σ ( eiWinterep ) )
其中,α、β和γ参数可以用于调节三个模块对结果的影响,可以在前述训练阶段训练得到。最小值min(sim(zi,zj))表示本申请使用事件中最小的节点对相似度来衡量成对交互异常程度,可以理解为当一个节点对相似度相对较小时,事件可能存在异常。也可以替换为所有节点对相似度得分的总和。σ(ciWmzi)和σ(eiWinter ep)表示本申请使用正样本对的双线性(Bilinear)得分来测量阳性对的多变量和事件间得分来测量多变量和事件间异常程度。将异常事件的双线性得分与这三个模块输出的得分重新相加,以获得最终异常事件得分s。由于采用负号,异常分数s越大,表明事件越有可能异常。Among them, the α, β and γ parameters can be used to adjust the impact of the three modules on the results, and can be trained in the aforementioned training stage. The minimum value min(sim(z i ,z j )) indicates that this application uses the smallest node pair similarity in the event to measure the degree of abnormality of paired interactions. It can be understood that when a node pair similarity is relatively small, the event may be abnormal. It can also be replaced by the sum of all node pair similarity scores. σ(c i W m z i ) and σ(e i W inter e p ) indicate that this application uses the bilinear scores of positive sample pairs to measure the multivariate and event scores of positive pairs to measure the degree of abnormality between multivariate and events. The bilinear scores of abnormal events are re-added with the scores output by these three modules to obtain the final abnormal event score s. Due to the use of a negative sign, the larger the abnormal score s, the more likely the event is abnormal.
本申请实施方式中基于属性异质图中的复杂交互事件构建异常事件检测模型,同时考虑事件内异常和事件间异常,充分挖掘各种复杂异常模式,为异常事件检测提供了更加全面的方法。由于本申请的架构可以针对各种类型的任务,所以具有一定的普适性。由于现实生活中大多数业务场景都可以用属性异质性图来建模。因此本申请提供的犯法可以利用在各种属性异质图场景中,如在学术网络,推荐场景,电影网络中都有良好的效果。In the implementation mode of the present application, an abnormal event detection model is constructed based on complex interactive events in attribute heterogeneous graphs, while considering anomalies within events and anomalies between events, fully exploring various complex abnormal patterns, and providing a more comprehensive method for abnormal event detection. Since the architecture of the present application can be used for various types of tasks, it has a certain universality. Since most business scenarios in real life can be modeled using attribute heterogeneous graphs. Therefore, the method provided by the present application can be used in various attribute heterogeneous graph scenarios, such as in academic networks, recommendation scenarios, and movie networks, and has good effects.
且相对于APE和AEHE,本申请提供的方法可以适用于针对属性异质图中复杂的交互异常事件检测,而不局限于特定形式的事件。同时本申请也充分考虑了属性异质图中各种异常复杂交互模式,可以检测出现有方案无法建模的异常模式。本申请也提出了一种针对事件异常程度的打分函数,可以衡量属性异质图中事件的异常程度。Compared with APE and AEHE, the method provided by this application can be applied to the detection of complex interactive abnormal events in attribute heterogeneous graphs, and is not limited to events of a specific form. At the same time, this application also fully considers various abnormal and complex interactive patterns in attribute heterogeneous graphs, and can detect abnormal patterns that cannot be modeled by existing solutions. This application also proposes a scoring function for the degree of abnormality of events, which can measure the degree of abnormality of events in attribute heterogeneous graphs.
下面以具体的对比场景为例,对本申请提供的方法所实现的效果进行更详细的介绍。The following uses a specific comparison scenario as an example to introduce the effect achieved by the method provided in this application in more detail.
通过在真实数据集(以学术网络、推荐场景,电影网络数据集为例)上进行推理,提供了本申请提供的方法与一些已有的方案所实现的效果的对比。By performing reasoning on real data sets (taking academic networks, recommendation scenarios, and movie network data sets as examples), a comparison is provided between the effects achieved by the method provided in this application and some existing solutions.
例如,一些已有的方案可以采用:APE对事件中节点的成对交互进行建模,以获得事件发生的可能性。AEHE利用丰富的节点属性,并结合事件内的成对交互和节点的二阶结构嵌入来执行异常事件检测。 CoLA是一种基于GNN的模型,用于检测同质图中的异常节点,使用对比学习来建模异常节点与其上下文节点之间的不一致模式。ANEMONE采用了与CoLA类似的方案,区别在于使用了上下文层面的多尺度对比学习。Metapath2vec使用基于元路径的随机游走来建模节点的相似性。而本申请首先通过metapath2vec获得节点嵌入,然后执行成对点积以获得节点对相似性分数,事件中的最低分数用于测量异常程度。HeCo使用协同对比策略学习HIN中节点表示,而本申请采用标识节点的对比损失作为异常事件分数。HeteHG-VAE使用超图变分自动编码器学习鲁棒节点表示。For example, some existing schemes can be adopted: APE models the pairwise interactions of nodes in an event to obtain the probability of an event. AEHE utilizes rich node attributes and combines the pairwise interactions within an event and the second-order structural embedding of nodes to perform abnormal event detection. CoLA is a GNN-based model for detecting abnormal nodes in homogeneous graphs, using contrastive learning to model inconsistent patterns between abnormal nodes and their context nodes. ANEMONE adopts a similar scheme to CoLA, except that it uses multi-scale contrastive learning at the context level. Metapath2vec uses meta-path-based random walks to model node similarities. This application first obtains node embeddings through metapath2vec, and then performs pairwise dot products to obtain node pair similarity scores, and the lowest score in the event is used to measure the degree of abnormality. HeCo uses a collaborative contrast strategy to learn node representations in HIN, while this application uses the contrast loss of identified nodes as the abnormal event score. HeteHG-VAE uses a hypergraph variational autoencoder to learn robust node representations.
模型的输入可以采用一些公开数据集,如Aminer、IMDB以及Meituan等。对于异常事件输入,可以人工创建异常。人工异常事件的生成如下:对于每个事件,选择事件中的c(在下面的实验中考虑c=1,2,3)个元素,对于每个目标元素,选择其他k个元素,并计算其属性向量x_i和目标属性向量x之间的欧氏距离。然后,选取欧氏距离最大的节点替换目标元素。The model input can be some public data sets, such as Aminer, IMDB, and Meituan. For abnormal event input, anomalies can be created manually. The generation of artificial abnormal events is as follows: for each event, select c (consider c = 1, 2, 3 in the following experiments) elements in the event, for each target element, select other k elements, and calculate the Euclidean distance between their attribute vector x_i and the target attribute vector x. Then, select the node with the largest Euclidean distance to replace the target element.
可以采用多种指标来表示输出效果。如可以采用平均精度(AP)和曲线下面积(AUC)。一般来说,AP可以反映召回能力,即检测更多异常事件的能力,AUC反映模型的精度。分别实现的效果如表1所示。
A variety of indicators can be used to represent the output effect. For example, average precision (AP) and area under the curve (AUC) can be used. Generally speaking, AP can reflect the recall ability, that is, the ability to detect more abnormal events, and AUC reflects the accuracy of the model. The effects achieved are shown in Table 1.
表1Table 1
根据表1可知,本申请在AP和AUC方面的表现都大大优于所有基线,这证明了模型的有效性。请注意,由于HeCo的全批次训练,在Meituan数据中存在内存问题。可以清楚地看到,属性异质性图表示学习方法在所有三个数据集上的表现都很差,这表明单纯的图表示学习方法远远不够用于异常事件检测。应进一步设计专门针对异常事件检测的模块。对比学习方法HeCo的表现也较差,这表明将对比学习应用于异常事件检测任务是一个挑战。APE和AEHE在Aminer数据集上表现更好,但在其他数据集上表现更差,甚至不如异常节点检测模型,因为这些方式只关注事件中的成对异常。According to Table 1, the performance of this application is significantly better than all baselines in terms of AP and AUC, which proves the effectiveness of the model. Please note that there are memory issues in the Meituan data due to the full batch training of HeCo. It can be clearly seen that the attribute heterogeneity graph representation learning method performs poorly on all three datasets, which shows that pure graph representation learning methods are far from sufficient for abnormal event detection. Modules specifically for abnormal event detection should be further designed. The contrastive learning method HeCo also performs poorly, which shows that it is a challenge to apply contrastive learning to the task of abnormal event detection. APE and AEHE perform better on the Aminer dataset, but worse on other datasets, and are even worse than the abnormal node detection model because these methods only focus on paired anomalies in events.
前述对本申请提供的方法流程进行了详细介绍,下面结合前述的方法流程,对本申请提供的用于执行前述方法步骤的装置进行介绍。The above has provided a detailed introduction to the method flow provided by the present application. Now, in combination with the above method flow, the device provided by the present application for executing the above method steps will be introduced.
参阅图12,本申请提供的一种异常事件检测模型构建装置的结构示意图,包括:Referring to FIG. 12 , a schematic diagram of a structure of an abnormal event detection model building device provided by the present application includes:
获取模块1201,用于获取第二属性异质性图,第二属性异质性图表示多个事件,该第二属性异质性图中包括多个节点以及多个节点之间的关联关系,每个事件通过该多个节点中的至少两个节点以及该至少两个节点之间的关联关系表示,每个事件中的节点包括形成该事件的事件元素的信息;The acquisition module 1201 is used to acquire a second attribute heterogeneity graph, the second attribute heterogeneity graph represents multiple events, the second attribute heterogeneity graph includes multiple nodes and association relationships between the multiple nodes, each event is represented by at least two nodes of the multiple nodes and the association relationship between the at least two nodes, and the node in each event includes information of event elements forming the event;
构建模块1202,用于根据第二属性异质性图构建异常事件检测模型,异常事件检测模型用于检测多个事件中的异常事件,异常事件为根据相邻事件之间的相似度或者事件内的节点之间的相似度确定。The construction module 1202 is used to construct an abnormal event detection model according to the second attribute heterogeneity graph. The abnormal event detection model is used to detect abnormal events among multiple events. The abnormal events are determined according to the similarity between adjacent events or the similarity between nodes within an event.
在一种可能的实施方式中,异常事件检测模型包括节点对对比模块,节点对对比模块用于获取节点对的相似度,相似度用于表示事件的异常程度;In a possible implementation, the abnormal event detection model includes a node pair comparison module, which is used to obtain the similarity of the node pairs, and the similarity is used to indicate the abnormality degree of the event;
构建模块1202,具体用于:将每个事件中的多个节点组成至少一对节点对;通过节点对对比模块,获取至少一对节点对中每对节点对的第一相似度;根据每对节点对的第一相似度获取多个节点中每个节点的成对对比损失值;根据每个节点对的成对对比损失值更新异常事件检测模型,得到更新后的异常事件检测模型。Construction module 1202 is specifically used to: group multiple nodes in each event into at least one pair of node pairs; obtain the first similarity of each pair of node pairs in at least one pair of node pairs through the node pair comparison module; obtain the pairwise comparison loss value of each node in the multiple nodes according to the first similarity of each pair of node pairs; update the abnormal event detection model according to the pairwise comparison loss value of each node pair to obtain the updated abnormal event detection model.
在一种可能的实施方式中,构建模块1202,具体用于:对每个事件中的多个节点对的成对对比损失值进行融合,得到第一损失值;根据第一损失值更新异常事件检测模型,得到更新后的异常事件检测模型。In a possible implementation, the construction module 1202 is specifically used to: fuse the pairwise comparison loss values of multiple node pairs in each event to obtain a first loss value; and update the abnormal event detection model according to the first loss value to obtain an updated abnormal event detection model.
在一种可能的实施方式中,构建模块1202,具体用于:从多个节点中获取第一节点的正样本节点集 合,并构造负样本节点集合,正样本节点集合中的节点和第一节点之间的第一相似度高于负样本节点集合中的节点与第一节点之间的第一相似度,第一节点是每个事件中的多个节点中的任意一个;通过第一节点与正样本节点集合中的节点之间的第一相似度,与第一节点与负样本节点集合中的节点之间的相似度,计算得到第一节点对应的成对对比损失值。In a possible implementation, the construction module 1202 is specifically configured to: obtain a positive sample node set of the first node from multiple nodes. The first similarity between the nodes in the positive sample node set and the first node is higher than the first similarity between the nodes in the negative sample node set and the first node, and the first node is any one of the multiple nodes in each event; the pairwise comparison loss value corresponding to the first node is calculated by the first similarity between the first node and the nodes in the positive sample node set and the similarity between the first node and the nodes in the negative sample node set.
在一种可能的实施方式中,构建模块1202,具体用于:获取温度系数,温度系数与负样本节点集合中的节点与第一节点之间的相似度相关;结合温度系数,通过第一节点与正样本节点集合中的节点之间的第一相似度,与第一节点与负样本节点集合中的节点之间的相似度,计算得到第一节点对应的成对对比损失值。In one possible implementation, module 1202 is constructed to specifically: obtain a temperature coefficient, where the temperature coefficient is related to the similarity between the nodes in the negative sample node set and the first node; and calculate the pairwise comparison loss value corresponding to the first node in combination with the temperature coefficient by using the first similarity between the first node and the nodes in the positive sample node set and the similarity between the first node and the nodes in the negative sample node set.
在一种可能的实施方式中,异常事件检测模型还包括多元交互模块,多元交互模块用于对事件中的节点进行聚类得到至少一种类别,并获取事件中的各个节点与至少一种类别之间的相似度,相似度用于表示对应的事件的异常程度;In a possible implementation, the abnormal event detection model further includes a multivariate interaction module, which is used to cluster nodes in the event to obtain at least one category, and obtain the similarity between each node in the event and at least one category, where the similarity is used to indicate the abnormality degree of the corresponding event;
构建模块1202,还用于通过多元交互模块获取每个事件中的多个节点中的至少一个节点与标识符节点之间的第二相似度,标识符节点包括每个事件的中心节点或者对多个节点进行融合后得到的节点;根据至少一个节点与标识符节点之间的第二相似度计算第二损失值;根据第二损失值更新异常事件检测模型,得到更新后的异常事件检测模型。Construction module 1202 is also used to obtain the second similarity between at least one node among multiple nodes in each event and the identifier node through the multi-element interaction module, the identifier node includes the central node of each event or a node obtained by fusing multiple nodes; calculate the second loss value according to the second similarity between at least one node and the identifier node; update the abnormal event detection model according to the second loss value to obtain an updated abnormal event detection model.
在一种可能的实施方式中,多元交互模块还用于对每个事件中的多个节点进行聚类,得到至少一种类别;In a possible implementation, the multivariate interaction module is further used to cluster multiple nodes in each event to obtain at least one category;
构建模块1202,具体用于:将第一节点替换为第二节点,第一节点为第一事件中的其中一个点,第二节点为与第一节点的属性相同且类别不同;获取第二节点与标识符节点之间的第三相似度;根据第二相似度和第三相似度计算损失值,得到第二损失值。Construction module 1202 is specifically used to: replace the first node with the second node, the first node is one of the points in the first event, and the second node has the same attributes as the first node but a different category; obtain the third similarity between the second node and the identifier node; calculate the loss value based on the second similarity and the third similarity to obtain the second loss value.
在一种可能的实施方式中,异常事件检测模型还包括事件对比模块,事件对比模块用于获取事件之间的相似度;In a possible implementation, the abnormal event detection model further includes an event comparison module, which is used to obtain similarities between events;
构建模块1202,具体用于:从多个事件中筛选出每个事件对应的正样本集合和负样本集合;根据每个事件与正样本集合中的事件之间的第四相似度和每个事件与负样本集合中的事件之间的第五相似度,计算得到第三损失值;根据第三损失值更新异常事件检测模型,得到更新后的异常事件检测模型。Construction module 1202 is specifically used to: filter out a positive sample set and a negative sample set corresponding to each event from multiple events; calculate a third loss value based on the fourth similarity between each event and the events in the positive sample set and the fifth similarity between each event and the events in the negative sample set; update the abnormal event detection model based on the third loss value to obtain an updated abnormal event detection model.
在一种可能的实施方式中,构建模块1202,具体用于:通过事件对比模块获取每对事件之间的共享节点的数量;获取与第二事件之间共享节点的数量大于第一阈值的至少一个事件,得到正样本集合,第二事件为多个事件中的任意一个事件;获取与第二事件之间共享节点的数量不大于第一阈值的至少一个事件,得到负样本集合。In one possible implementation, construction module 1202 is specifically used to: obtain the number of shared nodes between each pair of events through an event comparison module; obtain at least one event whose number of shared nodes with the second event is greater than a first threshold, and obtain a positive sample set, where the second event is any one of multiple events; obtain at least one event whose number of shared nodes with the second event is not greater than the first threshold, and obtain a negative sample set.
在一种可能的实施方式中,构建模块1202,具体用于:通过事件对比模块对每个事件进行语义识别,得到每个事件表征;通过事件对比模块根据每个事件表征计算事件之间的第四相似度。In a possible implementation, the construction module 1202 is specifically configured to: perform semantic recognition on each event through an event comparison module to obtain each event representation; and calculate the fourth similarity between events according to each event representation through the event comparison module.
在一种可能的实施方式中,构建模块1202,还用于:第二属性异质性图中每个事件中的各个节点对应的数据映射至同一空间,得到每个事件在同一空间的第一数据表示;根据第一数据表示构建异常事件检测模型。In a possible implementation, construction module 1202 is also used to: map the data corresponding to each node in each event in the second attribute heterogeneity graph to the same space to obtain a first data representation of each event in the same space; and construct an abnormal event detection model based on the first data representation.
在一种可能的实施方式中,第二属性异质性图中的多个事件用于表示:用户的一次金融交易行为、用户发表评论的行为或者用户的物品交易行为。In a possible implementation, the multiple events in the second attribute heterogeneity graph are used to represent: a financial transaction behavior of a user, a comment-posting behavior of a user, or an item transaction behavior of a user.
参阅图13,本申请提供的一种异常事件检测装置的结构示意图,包括:Referring to FIG. 13 , a schematic diagram of the structure of an abnormal event detection device provided by the present application includes:
获取模块1301,用于获取第一属性异质性图,第一属性异质性图用于表示至少一个事件,该第一属性异质性图中包括多个节点以及多个节点之间的关联关系,每个事件通过该多个节点中的至少两个节点以及该至少两个节点之间的关联关系表示,每个事件中的每个节点包括形成该事件的事件元素的信息;The acquisition module 1301 is used to acquire a first attribute heterogeneity graph, where the first attribute heterogeneity graph is used to represent at least one event, and the first attribute heterogeneity graph includes a plurality of nodes and association relationships between the plurality of nodes, each event is represented by at least two nodes among the plurality of nodes and the association relationship between the at least two nodes, and each node in each event includes information of event elements forming the event;
检测模块1302,用于将第一属性异质性图作为异常事件检测模型的输入,得到输出结果,输出结果用于表示至少一个事件中是否包括异常事件,异常事件为根据事件之间的相似度或者事件内的节点之间的相似度确定。The detection module 1302 is used to use the first attribute heterogeneity graph as the input of the abnormal event detection model to obtain an output result, and the output result is used to indicate whether at least one event includes an abnormal event, and the abnormal event is determined based on the similarity between events or the similarity between nodes within an event.
在一种可能的实施方式中,异常事件检测模型包括以下一种或者多种模块:节点对对比模块、多元交互模块或事件对比模块,节点对比模块用于获取事件内的节点之间的相似度,多元交互模块用于获取 事件内的节点和事件类别之间的相似度,事件对比模块用于获取事件之间的相似度。In a possible implementation, the abnormal event detection model includes one or more of the following modules: a node pair comparison module, a multivariate interaction module, or an event comparison module. The node comparison module is used to obtain the similarity between nodes in an event, and the multivariate interaction module is used to obtain The similarity between nodes within an event and event categories,The event comparison module is used to obtain the similarity between events.
在一种可能的实施方式中,若异常事件检测模型包括节点对对比模块,检测模块1302,具体用于:根据节点对对比模块输出每个事件的第一异常程度,其中,节点对对比模块用于获取每个事件中的节点对之间的相似度,并根据每个事件中的节点对之间的相似度得到第一异常程度;根据每个事件的第一异常程度,判断每个事件是否为异常事件,以得到输出结果。In a possible implementation, if the abnormal event detection model includes a node pair comparison module, the detection module 1302 is specifically used to: output a first abnormality degree of each event according to the node pair comparison module, wherein the node pair comparison module is used to obtain the similarity between the node pairs in each event, and obtain the first abnormality degree according to the similarity between the node pairs in each event; and determine whether each event is an abnormal event according to the first abnormality degree of each event to obtain an output result.
在一种可能的实施方式中,若异常事件检测模型包括多元交互模块,则检测模块1302,具体用于:通过多元交互模块输出每个事件的第二异常程度,其中,多元交互模块用于对至少一个事件中的多个节点进行融合,得到标识符节点,或者将每个事件的中心点作为标识符节点,并通过至少一个节点与标识符节点之间的相似度获取每个事件的第二异常程度;根据每个事件的第二异常程度,判断每个事件是否为异常事件,以得到输出结果。In a possible implementation, if the abnormal event detection model includes a multivariate interaction module, the detection module 1302 is specifically used to: output the second abnormality degree of each event through the multivariate interaction module, wherein the multivariate interaction module is used to fuse multiple nodes in at least one event to obtain an identifier node, or use the center point of each event as the identifier node, and obtain the second abnormality degree of each event through the similarity between at least one node and the identifier node; based on the second abnormality degree of each event, determine whether each event is an abnormal event to obtain an output result.
在一种可能的实施方式中,若异常事件检测模型包括事件对比模块,则检测模块1302,具体用于:通过事件对比模块输出每个事件的第三异常程度,其中,事件对比模块用于获取事件对之间的相似度,根据事件对之间的相似度计算每个事件的第三异常程度;根据每个事件的第三异常程度,判断每个事件是否为异常事件,以得到输出结果。In a possible implementation, if the abnormal event detection model includes an event comparison module, the detection module 1302 is specifically used to: output the third abnormality degree of each event through the event comparison module, wherein the event comparison module is used to obtain the similarity between event pairs, and calculate the third abnormality degree of each event based on the similarity between the event pairs; based on the third abnormality degree of each event, determine whether each event is an abnormal event to obtain an output result.
在一种可能的实施方式中,事件对比模块,具体用于:从多个事件中筛选出每个事件分别对应的正样本集合;根据每个事件和对应的正样本集合中的事件之间的相似度,得到每个事件的第三异常程度。In a possible implementation, the event comparison module is specifically used to: filter out a positive sample set corresponding to each event from multiple events; and obtain a third abnormality degree of each event based on the similarity between each event and an event in the corresponding positive sample set.
在一种可能的实施方式中,事件对比模块,具体用于:对每个事件进行语义识别,得到每个事件的表征;根据每个事件的表征计算每个事件与对应的正样本集合中的事件之间的相似度。In a possible implementation, the event comparison module is specifically used to: perform semantic recognition on each event to obtain a representation of each event; and calculate the similarity between each event and an event in a corresponding positive sample set based on the representation of each event.
在一种可能的实施方式中,若异常事件检测模型包括节点对对比模块、多元交互模块和事件对比模块,则检测模块1302,具体用于:将第一属性异质性图分别作为节点对对比模块、多元交互模块和事件对比模块的输入;对节点对对比模块输出的每个事件的第一异常程度、多元交互模块输出的每个事件的第二异常程度和事件对比模块输出的每个事件的第三异常程度进行融合,得到每个事件的第四异常程度;根据每个事件的第四异常程度判断每个事件是否为异常事件,以得到输出结果。In a possible implementation, if the abnormal event detection model includes a node pair comparison module, a multivariate interaction module and an event comparison module, the detection module 1302 is specifically used to: use the first attribute heterogeneity graph as the input of the node pair comparison module, the multivariate interaction module and the event comparison module respectively; fuse the first abnormality degree of each event output by the node pair comparison module, the second abnormality degree of each event output by the multivariate interaction module and the third abnormality degree of each event output by the event comparison module to obtain the fourth abnormality degree of each event; determine whether each event is an abnormal event according to the fourth abnormality degree of each event to obtain an output result.
在一种可能的实施方式中,检测模块1302,具体用于:将第一属性异质性图中每个事件中的各个节点映射至同一空间,得到每个事件在同一空间的第二数据表示;将第二数据表示作为异常事件检测模型的输入,以得到输出结果。In a possible implementation, the detection module 1302 is specifically used to: map each node in each event in the first attribute heterogeneity graph to the same space to obtain a second data representation of each event in the same space; and use the second data representation as an input to the abnormal event detection model to obtain an output result.
在一种可能的实施方式中,第一属性异质性图中的至少一个事件用于表示:用户的一次金融交易行为、用户发表评论的行为或者用户的物品交易行为。In a possible implementation, at least one event in the first attribute heterogeneity graph is used to represent: a financial transaction behavior of a user, a comment-posting behavior of a user, or an item transaction behavior of a user.
请参阅图14,本申请提供的另一种异常事件检测模型构建装置的结构示意图,如下所述。Please refer to FIG. 14 , which is a schematic diagram of the structure of another abnormal event detection model building device provided in the present application, as described below.
该异常事件检测模型构建装置可以包括处理器1401和存储器1402。该处理器1401和存储器1402通过线路互联。其中,存储器1402中存储有程序指令和数据。The abnormal event detection model building device may include a processor 1401 and a memory 1402. The processor 1401 and the memory 1402 are interconnected via a line. The memory 1402 stores program instructions and data.
存储器1402中存储了前述图4-图11中的步骤对应的程序指令以及数据。The memory 1402 stores program instructions and data corresponding to the steps in the aforementioned FIGS. 4 to 11 .
处理器1401用于执行前述图4-图11中任一实施例所示的异常事件检测模型构建装置执行的方法步骤。The processor 1401 is used to execute the method steps performed by the abnormal event detection model building device shown in any of the embodiments in Figures 4 to 11 above.
可选地,该异常事件检测模型构建装置还可以包括收发器1403,用于接收或者发送数据。Optionally, the abnormal event detection model building device may further include a transceiver 1403 for receiving or sending data.
本申请实施例中还提供一种计算机可读存储介质,该计算机可读存储介质中存储有用于生成车辆行驶速度的程序,当其在计算机上行驶时,使得计算机执行如前述图4-图11所示实施例描述的方法中的步骤。A computer-readable storage medium is also provided in an embodiment of the present application, in which a program for generating a vehicle driving speed is stored. When the program is running on a computer, the computer executes the steps in the method described in the embodiments shown in the aforementioned Figures 4 to 11.
可选地,前述的图14中所示的异常事件检测模型构建装置为芯片。Optionally, the abnormal event detection model building device shown in the aforementioned FIG. 14 is a chip.
请参阅图15,本申请提供的另一种异常事件检测装置的结构示意图,如下所述。Please refer to FIG. 15 , which is a schematic diagram of the structure of another abnormal event detection device provided in the present application, as described below.
该异常事件检测装置可以包括处理器1501和存储器1502。该处理器1501和存储器1502通过线路互联。其中,存储器1502中存储有程序指令和数据。The abnormal event detection device may include a processor 1501 and a memory 1502. The processor 1501 and the memory 1502 are interconnected via a line. The memory 1502 stores program instructions and data.
存储器1502中存储了前述图4-图11中的步骤对应的程序指令以及数据。The memory 1502 stores program instructions and data corresponding to the steps in the aforementioned FIGS. 4 to 11 .
处理器1501用于执行前述图4-图11中任一实施例所示的异常事件检测装置执行的方法步骤。The processor 1501 is used to execute the method steps performed by the abnormal event detection device shown in any of the embodiments in Figures 4 to 11 above.
可选地,该异常事件检测装置还可以包括收发器1503,用于接收或者发送数据。 Optionally, the abnormal event detection device may further include a transceiver 1503 for receiving or sending data.
本申请实施例中还提供一种计算机可读存储介质,该计算机可读存储介质中存储有用于生成车辆行驶速度的程序,当其在计算机上行驶时,使得计算机执行如前述图4-图11所示实施例描述的方法中的步骤。A computer-readable storage medium is also provided in an embodiment of the present application, in which a program for generating a vehicle driving speed is stored. When the program is running on a computer, the computer executes the steps in the method described in the embodiments shown in the aforementioned Figures 4 to 11.
可选地,前述的图15中所示的异常事件检测装置为芯片。Optionally, the abnormal event detection device shown in the aforementioned FIG. 15 is a chip.
本申请实施例还提供了一种异常事件检测模型构建装置,该异常事件检测模型构建装置也可以称为数字处理芯片或者芯片,芯片包括处理单元和通信接口,处理单元通过通信接口获取程序指令,程序指令被处理单元执行,处理单元用于执行前述图4-图11中任一实施例所示的异常事件检测模型构建装置执行的方法步骤。An embodiment of the present application also provides an abnormal event detection model construction device, which can also be called a digital processing chip or chip. The chip includes a processing unit and a communication interface. The processing unit obtains program instructions through the communication interface, and the program instructions are executed by the processing unit. The processing unit is used to execute the method steps performed by the abnormal event detection model construction device shown in any of the embodiments in Figures 4 to 11 above.
本申请实施例还提供了一种异常事件检测装置,该异常事件检测装置也可以称为数字处理芯片或者芯片,芯片包括处理单元和通信接口,处理单元通过通信接口获取程序指令,程序指令被处理单元执行,处理单元用于执行前述图4-图11中任一实施例所示的异常事件检测装置执行的方法步骤。An embodiment of the present application also provides an abnormal event detection device, which can also be called a digital processing chip or chip. The chip includes a processing unit and a communication interface. The processing unit obtains program instructions through the communication interface, and the program instructions are executed by the processing unit. The processing unit is used to execute the method steps performed by the abnormal event detection device shown in any of the embodiments in Figures 4 to 11 above.
本申请实施例还提供一种数字处理芯片。该数字处理芯片中集成了用于实现上述处理器1401,或者处理器1401的功能的电路和一个或者多个接口。当该数字处理芯片中集成了存储器时,该数字处理芯片可以完成前述实施例中的任一个或多个实施例的方法步骤。当该数字处理芯片中未集成存储器时,可以通过通信接口与外置的存储器连接。该数字处理芯片根据外置的存储器中存储的程序代码来实现上述实施例中异常事件检测模型构建装置执行的动作。The embodiment of the present application also provides a digital processing chip. The digital processing chip integrates a circuit and one or more interfaces for implementing the above-mentioned processor 1401, or the functions of the processor 1401. When the digital processing chip integrates a memory, the digital processing chip can complete the method steps of any one or more of the above-mentioned embodiments. When the digital processing chip does not integrate a memory, it can be connected to an external memory through a communication interface. The digital processing chip implements the actions performed by the abnormal event detection model construction device in the above-mentioned embodiment according to the program code stored in the external memory.
本申请实施例提供的异常事件检测模型构建装置可以为芯片,芯片包括:处理单元和通信单元,所述处理单元例如可以是处理器,所述通信单元例如可以是输入/输出接口、管脚或电路等。该处理单元可执行存储单元存储的计算机执行指令,以使服务器内的芯片执行上述图4-图11所示实施例描述的异常事件检测模型构建方法。可选地,所述存储单元为所述芯片内的存储单元,如寄存器、缓存等,所述存储单元还可以是所述无线接入设备端内的位于所述芯片外部的存储单元,如只读存储器(read-only memory,ROM)或可存储静态信息和指令的其他类型的静态存储设备,随机存取存储器(random access memory,RAM)等。The abnormal event detection model building device provided in the embodiment of the present application can be a chip, and the chip includes: a processing unit and a communication unit, the processing unit can be, for example, a processor, and the communication unit can be, for example, an input/output interface, a pin or a circuit, etc. The processing unit can execute the computer execution instructions stored in the storage unit, so that the chip in the server executes the abnormal event detection model building method described in the embodiments shown in Figures 4 to 11 above. Optionally, the storage unit is a storage unit in the chip, such as a register, a cache, etc., and the storage unit can also be a storage unit located outside the chip in the wireless access device end, such as a read-only memory (ROM) or other types of static storage devices that can store static information and instructions, a random access memory (RAM), etc.
本申请实施例还提供一种数字处理芯片。该数字处理芯片中集成了用于实现上述处理器1501,或者处理器1501的功能的电路和一个或者多个接口。当该数字处理芯片中集成了存储器时,该数字处理芯片可以完成前述实施例中的任一个或多个实施例的方法步骤。当该数字处理芯片中未集成存储器时,可以通过通信接口与外置的存储器连接。该数字处理芯片根据外置的存储器中存储的程序代码来实现上述实施例中异常事件检测装置执行的动作。The embodiment of the present application also provides a digital processing chip. The digital processing chip integrates a circuit and one or more interfaces for implementing the above-mentioned processor 1501, or the functions of the processor 1501. When the digital processing chip integrates a memory, the digital processing chip can complete the method steps of any one or more of the above-mentioned embodiments. When the digital processing chip does not integrate a memory, it can be connected to an external memory through a communication interface. The digital processing chip implements the actions performed by the abnormal event detection device in the above-mentioned embodiment according to the program code stored in the external memory.
本申请实施例提供的数据转换装置可以为芯片,芯片包括:处理单元和通信单元,所述处理单元例如可以是处理器,所述通信单元例如可以是输入/输出接口、管脚或电路等。该处理单元可执行存储单元存储的计算机执行指令,以使服务器内的芯片执行上述图4-图11所示实施例描述的数据转换方法。可选地,所述存储单元为所述芯片内的存储单元,如寄存器、缓存等,所述存储单元还可以是所述无线接入设备端内的位于所述芯片外部的存储单元,如只读存储器(read-only memory,ROM)或可存储静态信息和指令的其他类型的静态存储设备,随机存取存储器(random access memory,RAM)等。The data conversion device provided in the embodiment of the present application can be a chip, and the chip includes: a processing unit and a communication unit, the processing unit can be, for example, a processor, and the communication unit can be, for example, an input/output interface, a pin or a circuit, etc. The processing unit can execute the computer execution instructions stored in the storage unit, so that the chip in the server executes the data conversion method described in the embodiments shown in Figures 4 to 11 above. Optionally, the storage unit is a storage unit in the chip, such as a register, a cache, etc., and the storage unit can also be a storage unit located outside the chip in the wireless access device end, such as a read-only memory (ROM) or other types of static storage devices that can store static information and instructions, a random access memory (RAM), etc.
本申请实施例中还提供一种包括计算机程序产品,当其在计算机上运行时,使得计算机执行如前述图4-图11所示实施例描述的方法中图像解压装置或者图像解压装置所执行的步骤。Also provided in an embodiment of the present application is a computer program product, which, when executed on a computer, enables the computer to execute the steps executed by the image decompression device or the image decompression device in the method described in the embodiments shown in the aforementioned FIGS. 4 to 11 .
具体地,前述的处理单元或者处理器可以是中央处理器(central processing unit,CPU)、网络处理器(neural-network processing unit,NPU)、图形处理器(graphics processing unit,GPU)、数字信号处理器(digital signal processor,DSP)、专用集成电路(application specific integrated circuit,ASIC)或现场可编程逻辑门阵列(field programmable gate array,FPGA)或者其他可编程逻辑器件、分立门或者晶体管逻辑器件、分立硬件组件等。通用处理器可以是微处理器或者也可以是任何常规的处理器等。Specifically, the aforementioned processing unit or processor may be a central processing unit (CPU), a neural-network processing unit (NPU), a graphics processing unit (GPU), a digital signal processor (DSP), an application specific integrated circuit (ASIC) or a field programmable gate array (FPGA) or other programmable logic devices, discrete gate or transistor logic devices, discrete hardware components, etc. A general-purpose processor may be a microprocessor or any conventional processor, etc.
示例性地,请参阅图16,图16为本申请实施例提供的芯片的一种结构示意图,所述芯片可以表现为神经网络处理器NPU 160,NPU 160作为协处理器挂载到主CPU(Host CPU)上,由Host CPU分配任务。NPU的核心部分为运算电路1603,通过控制器1604控制运算电路1603提取存储器中的矩阵数据并 进行乘法运算。For example, please refer to FIG. 16, which is a schematic diagram of a structure of a chip provided in an embodiment of the present application. The chip can be a neural network processor NPU 160. NPU 160 is mounted on the host CPU (Host CPU) as a coprocessor, and the host CPU assigns tasks. The core part of the NPU is the operation circuit 1603, which is controlled by the controller 1604 to extract the matrix data in the memory and Perform multiplication.
在一些实现中,运算电路1603内部包括多个处理单元(process engine,PE)。在一些实现中,运算电路1603是二维脉动阵列。运算电路1603还可以是一维脉动阵列或者能够执行例如乘法和加法这样的数学运算的其它电子线路。在一些实现中,运算电路1603是通用的矩阵处理器。In some implementations, the operation circuit 1603 includes multiple processing units (process engines, PEs) inside. In some implementations, the operation circuit 1603 is a two-dimensional systolic array. The operation circuit 1603 can also be a one-dimensional systolic array or other electronic circuits capable of performing mathematical operations such as multiplication and addition. In some implementations, the operation circuit 1603 is a general-purpose matrix processor.
举例来说,假设有输入矩阵A,权重矩阵B,输出矩阵C。运算电路从权重存储器1602中取矩阵B相应的数据,并缓存在运算电路中每一个PE上。运算电路从输入存储器1601中取矩阵A数据与矩阵B进行矩阵运算,得到的矩阵的部分结果或最终结果,保存在累加器(accumulator)1608中。For example, assume there is an input matrix A, a weight matrix B, and an output matrix C. The operation circuit takes the corresponding data of matrix B from the weight memory 1602 and caches it on each PE in the operation circuit. The operation circuit takes the matrix A data from the input memory 1601 and performs matrix operation with matrix B, and the partial result or final result of the matrix is stored in the accumulator 1608.
统一存储器1606用于存放输入数据以及输出数据。权重数据直接通过存储单元访问控制器(direct memory access controller,DMAC)1605,DMAC被搬运到权重存储器1602中。输入数据也通过DMAC被搬运到统一存储器1606中。The unified memory 1606 is used to store input data and output data. The weight data is directly transferred to the weight memory 1602 through the direct memory access controller (DMAC) 1605. The input data is also transferred to the unified memory 1606 through the DMAC.
总线接口单元(bus interface unit,BIU)1610,用于AXI总线与DMAC和取指存储器(instruction fetch buffer,IFB)1609的交互。The bus interface unit (BIU) 1610 is used for the interaction between the AXI bus and the DMAC and instruction fetch buffer (IFB) 1609.
总线接口单元1610(bus interface unit,BIU),用于取指存储器1609从外部存储器获取指令,还用于存储单元访问控制器1605从外部存储器获取输入矩阵A或者权重矩阵B的原数据。The bus interface unit 1610 (BIU) is used for the instruction fetch memory 1609 to obtain instructions from the external memory, and is also used for the storage unit access controller 1605 to obtain the original data of the input matrix A or the weight matrix B from the external memory.
DMAC主要用于将外部存储器DDR中的输入数据搬运到统一存储器1606或将权重数据搬运到权重存储器1602中或将输入数据数据搬运到输入存储器1601中。DMAC is mainly used to transfer input data in the external memory DDR to the unified memory 1606 or to transfer weight data to the weight memory 1602 or to transfer input data to the input memory 1601.
向量计算单元1607包括多个运算处理单元,在需要的情况下,对运算电路的输出做进一步处理,如向量乘,向量加,指数运算,对数运算,大小比较等等。主要用于神经网络中非卷积/全连接层网络计算,如批归一化(batch normalization),像素级求和,对特征平面进行上采样等。The vector calculation unit 1607 includes multiple operation processing units, which further process the output of the operation circuit when necessary, such as vector multiplication, vector addition, exponential operation, logarithmic operation, size comparison, etc. It is mainly used for non-convolutional/fully connected layer network calculations in neural networks, such as batch normalization, pixel-level summation, upsampling of feature planes, etc.
在一些实现中,向量计算单元1607能将经处理的输出的向量存储到统一存储器1606。例如,向量计算单元1607可以将线性函数和/或非线性函数应用到运算电路1603的输出,例如对卷积层提取的特征平面进行线性插值,再例如累加值的向量,用以生成激活值。在一些实现中,向量计算单元1607生成归一化的值、像素级求和的值,或二者均有。在一些实现中,处理过的输出的向量能够用作到运算电路1603的激活输入,例如用于在神经网络中的后续层中的使用。In some implementations, the vector calculation unit 1607 can store the processed output vector to the unified memory 1606. For example, the vector calculation unit 1607 can apply a linear function and/or a nonlinear function to the output of the operation circuit 1603, such as linear interpolation of the feature plane extracted by the convolution layer, and then, for example, a vector of accumulated values to generate an activation value. In some implementations, the vector calculation unit 1607 generates a normalized value, a pixel-level summed value, or both. In some implementations, the processed output vector can be used as an activation input to the operation circuit 1603, for example, for use in a subsequent layer in a neural network.
控制器1604连接的取指存储器(instruction fetch buffer)1609,用于存储控制器1604使用的指令;An instruction fetch buffer 1609 connected to the controller 1604 is used to store instructions used by the controller 1604;
统一存储器1606,输入存储器1601,权重存储器1602以及取指存储器1609均为On-Chip存储器。外部存储器私有于该NPU硬件架构。Unified memory 1606, input memory 1601, weight memory 1602 and instruction fetch memory 1609 are all on-chip memories. External memories are private to the NPU hardware architecture.
其中,循环神经网络中各层的运算可以由运算电路1603或向量计算单元1607执行。Among them, the operations of each layer in the recurrent neural network can be performed by the operation circuit 1603 or the vector calculation unit 1607.
其中,上述任一处提到的处理器,可以是一个通用中央处理器,微处理器,ASIC,或一个或多个用于控制上述图3-图5的方法的程序执行的集成电路。The processor mentioned in any of the above places may be a general-purpose central processing unit, a microprocessor, an ASIC, or one or more integrated circuits for controlling the execution of the programs of the methods of FIG. 3-FIG 5 .
另外需说明的是,以上所描述的装置实施例仅仅是示意性的,其中所述作为分离部件说明的单元可以是或者也可以不是物理上分开的,作为单元显示的部件可以是或者也可以不是物理单元,即可以位于一个地方,或者也可以分布到多个网络单元上。可以根据实际的需要选择其中的部分或者全部模块来实现本实施例方案的目的。另外,本申请提供的装置实施例附图中,模块之间的连接关系表示它们之间具有通信连接,具体可以实现为一条或多条通信总线或信号线。It should also be noted that the device embodiments described above are merely schematic, wherein the units described as separate components may or may not be physically separated, and the components displayed as units may or may not be physical units, that is, they may be located in one place, or they may be distributed over multiple network units. Some or all of the modules may be selected according to actual needs to achieve the purpose of the scheme of this embodiment. In addition, in the drawings of the device embodiments provided by the present application, the connection relationship between the modules indicates that there is a communication connection between them, which may be specifically implemented as one or more communication buses or signal lines.
通过以上的实施方式的描述,所属领域的技术人员可以清楚地了解到本申请可借助软件加必需的通用硬件的方式来实现,当然也可以通过专用硬件包括专用集成电路、专用CPU、专用存储器、专用元器件等来实现。一般情况下,凡由计算机程序完成的功能都可以很容易地用相应的硬件来实现,而且,用来实现同一功能的具体硬件结构也可以是多种多样的,例如模拟电路、数字电路或专用电路等。但是,对本申请而言更多情况下软件程序实现是更佳的实施方式。基于这样的理解,本申请的技术方案本质上或者说对现有技术做出贡献的部分可以以软件产品的形式体现出来,该计算机软件产品存储在可读取的存储介质中,如计算机的软盘、U盘、移动硬盘、只读存储器(read only memory,ROM)、随机存取存储器(random access memory,RAM)、磁碟或者光盘等,包括若干指令用以使得一台计算机设备(可以是个人计算机,服务器,或者网络设备等)执行本申请各个实施例所述的方法。 Through the description of the above implementation mode, the technicians in the field can clearly understand that the present application can be implemented by means of software plus necessary general hardware, and of course, it can also be implemented by special hardware including special integrated circuits, special CPUs, special memories, special components, etc. In general, all functions completed by computer programs can be easily implemented by corresponding hardware, and the specific hardware structure used to implement the same function can also be various, such as analog circuits, digital circuits or special circuits. However, for the present application, software program implementation is a better implementation mode in more cases. Based on such an understanding, the technical solution of the present application is essentially or the part that contributes to the prior art can be embodied in the form of a software product, which is stored in a readable storage medium, such as a computer floppy disk, a U disk, a mobile hard disk, a read-only memory (ROM), a random access memory (RAM), a disk or an optical disk, etc., including a number of instructions to enable a computer device (which can be a personal computer, a server, or a network device, etc.) to execute the methods described in each embodiment of the present application.
在上述实施例中,可以全部或部分地通过软件、硬件、固件或者其任意组合来实现。当使用软件实现时,可以全部或部分地以计算机程序产品的形式实现。In the above embodiments, all or part of the embodiments may be implemented by software, hardware, firmware or any combination thereof. When implemented by software, all or part of the embodiments may be implemented in the form of a computer program product.
所述计算机程序产品包括一个或多个计算机指令。在计算机上加载和执行所述计算机程序指令时,全部或部分地产生按照本申请实施例所述的流程或功能。所述计算机可以是通用计算机、专用计算机、计算机网络、或者其他可编程装置。所述计算机指令可以存储在计算机可读存储介质中,或者从一个计算机可读存储介质向另一计算机可读存储介质传输,例如,所述计算机指令可以从一个网站站点、计算机、服务器或数据中心通过有线(例如同轴电缆、光纤、数字用户线(DSL))或无线(例如红外、无线、微波等)方式向另一个网站站点、计算机、服务器或数据中心进行传输。所述计算机可读存储介质可以是计算机能够存储的任何可用介质或者是包含一个或多个可用介质集成的服务器、数据中心等数据存储设备。所述可用介质可以是磁性介质,(例如,软盘、硬盘、磁带)、光介质(例如,DVD)、或者半导体介质(例如固态硬盘(solid state disk,SSD))等。The computer program product includes one or more computer instructions. When the computer program instructions are loaded and executed on a computer, the process or function described in the embodiment of the present application is generated in whole or in part. The computer may be a general-purpose computer, a special-purpose computer, a computer network, or other programmable device. The computer instructions may be stored in a computer-readable storage medium, or transmitted from one computer-readable storage medium to another computer-readable storage medium. For example, the computer instructions may be transmitted from one website, computer, server or data center to another website, computer, server or data center by wired (e.g., coaxial cable, optical fiber, digital subscriber line (DSL)) or wireless (e.g., infrared, wireless, microwave, etc.) means. The computer-readable storage medium may be any available medium that a computer can store or a data storage device such as a server or data center that includes one or more available media integrated. The available medium may be a magnetic medium (e.g., a floppy disk, a hard disk, a tape), an optical medium (e.g., a DVD), or a semiconductor medium (e.g., a solid state drive (SSD)), etc.
本申请的说明书和权利要求书及上述附图中的术语“第一”、“第二”、“第三”、“第四”等(如果存在)是用于区别类似的对象,而不必用于描述特定的顺序或先后次序。应该理解这样使用的数据在适当情况下可以互换,以便这里描述的实施例能够以除了在这里图示或描述的内容以外的顺序实施。此外,术语“包括”和“具有”以及他们的任何变形,意图在于覆盖不排他的包含,例如,包含了一系列步骤或单元的过程、方法、系统、产品或设备不必限于清楚地列出的那些步骤或单元,而是可包括没有清楚地列出的或对于这些过程、方法、产品或设备固有的其它步骤或单元。The terms "first", "second", "third", "fourth", etc. (if any) in the specification and claims of the present application and the above-mentioned drawings are used to distinguish similar objects, and are not necessarily used to describe a specific order or sequence. It should be understood that the data used in this way can be interchangeable where appropriate, so that the embodiments described herein can be implemented in an order other than that illustrated or described herein. In addition, the terms "including" and "having" and any variations thereof are intended to cover non-exclusive inclusions, for example, a process, method, system, product or device that includes a series of steps or units is not necessarily limited to those steps or units that are clearly listed, but may include other steps or units that are not clearly listed or inherent to these processes, methods, products or devices.
最后应说明的是:以上,仅为本申请的具体实施方式,但本申请的保护范围并不局限于此,任何熟悉本技术领域的技术人员在本申请揭露的技术范围内,可轻易想到变化或替换,都应涵盖在本申请的保护范围之内。 Finally, it should be noted that the above is only a specific implementation method of the present application, but the protection scope of the present application is not limited thereto. Any technician familiar with the technical field can easily think of changes or substitutions within the technical scope disclosed in the present application, which should be covered by the protection scope of the present application.

Claims (22)

  1. 一种异常事件检测方法,其特征在于,包括A method for detecting abnormal events, comprising:
    获取第一属性异质性图,所述第一属性异质性图表示至少一个事件,所述第一属性异质性图包括多个节点以及所述多个节点之间的关联关系,每个事件通过所述多个节点中的至少两个节点以及所述至少两个节点之间的关联关系表示,所述每个事件中的每个节点包括形成所述每个事件中的事件元素的信息;Acquire a first attribute heterogeneity graph, the first attribute heterogeneity graph represents at least one event, the first attribute heterogeneity graph includes a plurality of nodes and association relationships between the plurality of nodes, each event is represented by at least two nodes of the plurality of nodes and the association relationship between the at least two nodes, and each node in each event includes information forming an event element in the each event;
    将所述第一属性异质性图作为异常事件检测模型的输入,得到输出结果,所述输出结果用于表示所述至少一个事件中是否包括异常事件,所述异常事件为根据事件之间的相似度或者事件内的节点之间的相似度确定。The first attribute heterogeneity graph is used as an input of an abnormal event detection model to obtain an output result, wherein the output result is used to indicate whether the at least one event includes an abnormal event, and the abnormal event is determined based on the similarity between events or the similarity between nodes within an event.
  2. 根据权利要求1所述的方法,其特征在于,所述异常事件检测模型包括以下一种或者多种模块:节点对对比模块、多元交互模块或事件对比模块,所述节点对比模块用于获取事件内的节点之间的相似度,所述多元交互模块用于获取事件内的节点和事件类别之间的相似度,所述事件对比模块用于获取事件之间的相似度。The method according to claim 1 is characterized in that the abnormal event detection model includes one or more of the following modules: a node pair comparison module, a multivariate interaction module or an event comparison module, the node comparison module is used to obtain the similarity between nodes within an event, the multivariate interaction module is used to obtain the similarity between nodes within an event and event categories, and the event comparison module is used to obtain the similarity between events.
  3. 根据权利要求2所述的方法,其特征在于,若所述异常事件检测模型包括所述节点对对比模块,所述将所述第一属性异质性图作为异常事件检测模型的输入,得到输出结果,包括:The method according to claim 2, characterized in that if the abnormal event detection model includes the node pair comparison module, the step of using the first attribute heterogeneity graph as an input of the abnormal event detection model to obtain an output result comprises:
    根据所述节点对对比模块输出所述每个事件的第一异常程度,其中,所述节点对对比模块用于获取所述每个事件中的节点对之间的相似度,并根据所述每个事件中的节点对之间的相似度得到所述第一异常程度;Outputting the first abnormality degree of each event according to the node pair comparison module, wherein the node pair comparison module is used to obtain the similarity between the node pairs in each event, and obtain the first abnormality degree according to the similarity between the node pairs in each event;
    根据所述每个事件的第一异常程度,判断所述每个事件是否为异常事件,以得到所述输出结果。According to the first abnormality degree of each event, whether each event is an abnormal event is determined to obtain the output result.
  4. 根据权利要求2或3所述的方法,其特征在于,若所述异常事件检测模型包括所述多元交互模块,则所述将所述第一属性异质性图作为异常事件检测模型的输入,得到输出结果,还包括:The method according to claim 2 or 3, characterized in that if the abnormal event detection model includes the multivariate interaction module, then taking the first attribute heterogeneity graph as an input of the abnormal event detection model to obtain an output result further includes:
    通过所述多元交互模块输出所述每个事件的第二异常程度,其中,所述多元交互模块用于对所述至少一个事件中的多个节点进行融合,得到标识符节点,或者将所述每个事件的中心点作为所述标识符节点,并通过所述至少一个节点与所述标识符节点之间的相似度获取所述每个事件的第二异常程度;Outputting the second abnormality degree of each event through the multivariate interaction module, wherein the multivariate interaction module is used to fuse multiple nodes in the at least one event to obtain an identifier node, or taking the center point of each event as the identifier node, and obtaining the second abnormality degree of each event through the similarity between the at least one node and the identifier node;
    根据所述每个事件的第二异常程度,判断所述每个事件是否为异常事件,以得到所述输出结果。According to the second abnormality degree of each event, whether each event is an abnormal event is determined to obtain the output result.
  5. 根据权利要求2-4中任一项所述的方法,其特征在于,若所述异常事件检测模型包括所述事件对比模块,则所述将所述第一属性异质性图作为异常事件检测模型的输入,得到输出结果,还包括:The method according to any one of claims 2 to 4, characterized in that if the abnormal event detection model includes the event comparison module, then taking the first attribute heterogeneity graph as an input of the abnormal event detection model to obtain an output result further comprises:
    通过所述事件对比模块输出所述每个事件的第三异常程度,其中,所述事件对比模块用于获取事件对之间的相似度,根据所述事件对之间的相似度计算所述每个事件的第三异常程度;Outputting the third abnormality degree of each event through the event comparison module, wherein the event comparison module is used to obtain the similarity between event pairs, and calculate the third abnormality degree of each event according to the similarity between the event pairs;
    根据所述每个事件的第三异常程度,判断所述每个事件是否为异常事件,以得到所述输出结果。According to the third abnormality degree of each event, whether each event is an abnormal event is determined to obtain the output result.
  6. 根据权利要求5所述的方法,其特征在于,所述事件对比模块,具体用于:The method according to claim 5, characterized in that the event comparison module is specifically used to:
    从所述多个事件中筛选出所述每个事件分别对应的正样本集合;Filtering out a set of positive samples corresponding to each event from the multiple events;
    根据所述每个事件和对应的正样本集合中的事件之间的相似度,得到所述每个事件的第三异常程度。According to the similarity between each event and the events in the corresponding positive sample set, a third abnormality degree of each event is obtained.
  7. 根据权利要求5或6所述的方法,其特征在于,所述事件对比模块,具体用于:The method according to claim 5 or 6, characterized in that the event comparison module is specifically used to:
    对所述每个事件进行语义识别,得到所述每个事件的表征;Performing semantic recognition on each of the events to obtain a representation of each of the events;
    根据所述每个事件的表征计算所述每个事件与对应的正样本集合中的事件之间的相似度。The similarity between each event and the events in the corresponding positive sample set is calculated according to the representation of each event.
  8. 根据权利要求2-7中任一项所述的方法,其特征在于,若所述异常事件检测模型包括所述节点对对比模块、所述多元交互模块和所述事件对比模块,则所述将所述第一属性异质性图作为异常事件检测模型的输入,得到输出结果,还包括:The method according to any one of claims 2 to 7, characterized in that if the abnormal event detection model includes the node pair comparison module, the multivariate interaction module and the event comparison module, then taking the first attribute heterogeneity graph as the input of the abnormal event detection model to obtain the output result further includes:
    将所述第一属性异质性图分别作为所述节点对对比模块、所述多元交互模块和所述事件对比模块的 输入;The first attribute heterogeneity graph is used as the node pair comparison module, the multivariate interaction module and the event comparison module respectively. enter;
    对所述节点对对比模块输出的所述每个事件的第一异常程度、所述多元交互模块输出的所述每个事件的第二异常程度和所述事件对比模块输出的所述每个事件的第三异常程度进行融合,得到所述每个事件的第四异常程度;The first abnormality degree of each event output by the node pair comparison module, the second abnormality degree of each event output by the multivariate interaction module, and the third abnormality degree of each event output by the event comparison module are integrated to obtain a fourth abnormality degree of each event;
    根据所述每个事件的第四异常程度判断所述每个事件是否为异常事件,以得到所述输出结果。Whether each event is an abnormal event is determined according to the fourth abnormality degree of each event to obtain the output result.
  9. 根据权利要求2-8中任一项所述的方法,其特征在于,所述将所述第一属性异质性图作为异常事件检测模型的输入,包括:The method according to any one of claims 2 to 8, characterized in that taking the first attribute heterogeneity graph as an input of an abnormal event detection model comprises:
    将所述第一属性异质性图中每个事件中的各个节点映射至同一空间,得到所述每个事件在同一空间的第二数据表示;Mapping each node in each event in the first attribute heterogeneity graph to the same space to obtain a second data representation of each event in the same space;
    将所述第二数据表示作为异常事件检测模型的输入,以得到所述输出结果。The second data representation is used as an input of an abnormal event detection model to obtain the output result.
  10. 根据权利要求1-9中任一项所述的方法,其特征在于,The method according to any one of claims 1 to 9, characterized in that
    所述第一属性异质性图中的所述至少一个事件用于表示:用户的一次金融交易行为、用户发表评论的行为或者用户的物品交易行为。The at least one event in the first attribute heterogeneity graph is used to represent: a financial transaction behavior of a user, a comment-posting behavior of a user, or an item transaction behavior of a user.
  11. 一种异常事件检测模型构建方法,其特征在于,包括:A method for constructing an abnormal event detection model, characterized by comprising:
    获取第二属性异质性图,所述第二属性异质性图用于表示多个事件,所述第二属性异质性图包括多个节点以及所述多个节点之间的关联关系,所述每个事件中的每个节点包括形成所述每个事件中事件元素的信息;Acquire a second attribute heterogeneity graph, the second attribute heterogeneity graph is used to represent multiple events, the second attribute heterogeneity graph includes multiple nodes and association relationships between the multiple nodes, and each node in each event includes information forming an event element in each event;
    根据所述第二属性异质性图构建异常事件检测模型,所述异常事件检测模型用于检测所述多个事件中的异常事件,所述异常事件为根据事件之间的相似度或者事件内的节点之间的相似度确定。An abnormal event detection model is constructed according to the second attribute heterogeneity graph, and the abnormal event detection model is used to detect abnormal events among the multiple events, and the abnormal events are determined according to the similarity between events or the similarity between nodes within an event.
  12. 根据权利要求11所述的方法,其特征在于,所述异常事件检测模型包括节点对对比模块,所述节点对对比模块用于获取节点对的相似度;The method according to claim 11, characterized in that the abnormal event detection model includes a node pair comparison module, and the node pair comparison module is used to obtain the similarity of the node pair;
    所述根据所述第二属性异质性图构建异常事件检测模型,包括:The step of constructing an abnormal event detection model according to the second attribute heterogeneity graph includes:
    将所述每个事件中的多个节点组成至少一对节点对;Grouping the multiple nodes in each event into at least one node pair;
    通过所述节点对对比模块,获取所述至少一对节点对中每对节点对的第一相似度;Obtaining, by means of the node pair comparison module, a first similarity of each pair of node pairs in the at least one pair of node pairs;
    根据所述每对节点对的第一相似度获取所述多个节点中每个节点的成对对比损失值;Obtaining a pairwise comparison loss value of each node in the plurality of nodes according to the first similarity of each pair of node pairs;
    对所述每个事件中的多个节点对的成对对比损失值进行融合,得到第一损失值;Fusing the pairwise comparison loss values of multiple node pairs in each event to obtain a first loss value;
    根据所述第一损失值更新所述异常事件检测模型,得到更新后的异常事件检测模型。The abnormal event detection model is updated according to the first loss value to obtain an updated abnormal event detection model.
  13. 根据权利要求12所述的方法,其特征在于,所述根据所述每对节点对的第一相似度获取所述每个节点的成对对比损失值,包括:The method according to claim 12, characterized in that the step of obtaining the pairwise contrast loss value of each node according to the first similarity of each pair of nodes comprises:
    从所述多个节点中获取第一节点的正样本节点集合,并构造负样本节点集合,所述正样本节点集合中的节点和所述第一节点之间的第一相似度高于所述负样本节点集合中的节点与所述第一节点之间的第一相似度,所述第一节点是所述每个事件中的所述多个节点中的任意一个;Acquire a positive sample node set of a first node from the multiple nodes, and construct a negative sample node set, wherein a first similarity between nodes in the positive sample node set and the first node is higher than a first similarity between nodes in the negative sample node set and the first node, and the first node is any one of the multiple nodes in each event;
    通过所述第一节点与所述正样本节点集合中的节点之间的第一相似度,与所述第一节点与所述负样本节点集合中的节点之间的相似度,计算得到所述第一节点对应的成对对比损失值。The pairwise contrast loss value corresponding to the first node is calculated by using the first similarity between the first node and the nodes in the positive sample node set and the similarity between the first node and the nodes in the negative sample node set.
  14. 根据权利要求13所述的方法,其特征在于,所述通过所述第一节点与所述正样本节点集合中的节点之间的第一相似度,与所述第一节点与所述负样本节点集合中的节点之间的相似度,计算得到所述第一节点对应的成对对比损失值,包括:The method according to claim 13, characterized in that the step of calculating the pairwise contrast loss value corresponding to the first node by using the first similarity between the first node and the nodes in the positive sample node set and the similarity between the first node and the nodes in the negative sample node set comprises:
    获取温度系数,所述温度系数与所述负样本节点集合中的节点与所述第一节点之间的相似度相关;Acquire a temperature coefficient, where the temperature coefficient is related to a similarity between a node in the negative sample node set and the first node;
    结合所述温度系数,通过所述第一节点与所述正样本节点集合中的节点之间的第一相似度,与所述 第一节点与所述负样本节点集合中的节点之间的相似度,计算得到所述第一节点对应的成对对比损失值。In combination with the temperature coefficient, the first similarity between the first node and the nodes in the positive sample node set is used to determine the The similarity between the first node and the nodes in the negative sample node set is calculated to obtain a pairwise comparison loss value corresponding to the first node.
  15. 根据权利要求11-14中任一项所述的方法,其特征在于,所述异常事件检测模型还包括多元交互模块,所述多元交互模块用于对事件中的节点进行聚类得到至少一种类别,并获取事件中的各个节点与所述至少一种类别之间的相似度,所述相似度用于表示对应的事件的异常程度;The method according to any one of claims 11 to 14 is characterized in that the abnormal event detection model further includes a multivariate interaction module, the multivariate interaction module is used to cluster the nodes in the event to obtain at least one category, and obtain the similarity between each node in the event and the at least one category, the similarity is used to indicate the abnormality degree of the corresponding event;
    所述根据所述第二属性异质性图构建异常事件检测模型,还包括:The constructing of an abnormal event detection model according to the second attribute heterogeneity graph further includes:
    通过所述多元交互模块获取所述每个事件中的多个节点中的至少一个节点与标识符节点之间的第二相似度,所述标识符节点包括所述每个事件的中心节点或者对所述多个节点进行融合后得到的节点;Acquire, by the multivariate interaction module, a second similarity between at least one of the multiple nodes in each event and an identifier node, wherein the identifier node includes a central node of each event or a node obtained by fusing the multiple nodes;
    根据所述至少一个节点与所述标识符节点之间的第二相似度计算第二损失值;calculating a second loss value based on a second similarity between the at least one node and the identifier node;
    根据所述第二损失值更新所述异常事件检测模型,得到更新后的异常事件检测模型。The abnormal event detection model is updated according to the second loss value to obtain an updated abnormal event detection model.
  16. 根据权利要求15所述的方法,其特征在于,所述多元交互模块还用于对所述每个事件中的多个节点进行聚类,得到至少一种类别;The method according to claim 15, characterized in that the multivariate interaction module is further used to cluster the multiple nodes in each event to obtain at least one category;
    所述根据所述第二相似度计算第二损失值,包括:The calculating a second loss value according to the second similarity includes:
    将第一节点替换为第二节点,所述第一节点为第一事件中的其中一个点,所述第二节点为与所述第一节点的属性相同且类别不同;Replace the first node with the second node, the first node is one of the points in the first event, and the second node has the same attribute as the first node but a different category;
    获取所述第二节点与所述标识符节点之间的第三相似度;Obtaining a third similarity between the second node and the identifier node;
    根据所述第二相似度和所述第三相似度计算损失值,得到所述第二损失值。A loss value is calculated according to the second similarity and the third similarity to obtain the second loss value.
  17. 根据权利要求11-16中任一项所述的方法,其特征在于,所述异常事件检测模型还包括事件对比模块,所述事件对比模块用于获取事件之间的相似度;The method according to any one of claims 11 to 16, characterized in that the abnormal event detection model further comprises an event comparison module, and the event comparison module is used to obtain the similarity between events;
    所述根据所述第二属性异质性图构建异常事件检测模型,还包括:The constructing of an abnormal event detection model according to the second attribute heterogeneity graph further includes:
    从所述多个事件中筛选出所述每个事件对应的正样本集合和负样本集合;Filtering out a positive sample set and a negative sample set corresponding to each event from the multiple events;
    根据所述每个事件与所述正样本集合中的事件之间的第四相似度和所述每个事件与所述负样本集合中的事件之间的第五相似度,计算得到第三损失值;Calculate a third loss value according to a fourth similarity between each event and the events in the positive sample set and a fifth similarity between each event and the events in the negative sample set;
    根据所述第三损失值更新所述异常事件检测模型,得到更新后的异常事件检测模型。The abnormal event detection model is updated according to the third loss value to obtain an updated abnormal event detection model.
  18. 根据权利要求17所述的方法,其特征在于,所述从所述多个事件中筛选出所述每个事件对应的正样本集合和负样本集合,包括:The method according to claim 17, characterized in that the step of screening out the positive sample set and the negative sample set corresponding to each event from the multiple events comprises:
    通过所述事件对比模块获取所述每对事件之间的共享节点的数量;Acquire the number of shared nodes between each pair of events through the event comparison module;
    获取与第二事件之间共享节点的数量大于第一阈值的至少一个事件,得到所述正样本集合,所述第二事件为所述多个事件中的任意一个事件;Acquire at least one event whose number of shared nodes with a second event is greater than a first threshold to obtain the positive sample set, wherein the second event is any one of the multiple events;
    获取与所述第二事件之间共享节点的数量不大于第一阈值的至少一个事件,得到所述负样本集合。At least one event, the number of nodes shared with the second event being no greater than a first threshold, is acquired to obtain the negative sample set.
  19. 一种异常事件检测装置,其特征在于,包括处理器,所述处理器和存储器耦合,所述存储器存储有程序,当所述存储器存储的程序指令被所述处理器执行时实现权利要求1-10中任一项所述的方法的步骤。An abnormal event detection device, characterized in that it includes a processor, the processor is coupled to a memory, the memory stores a program, and when the program instructions stored in the memory are executed by the processor, the steps of the method described in any one of claims 1 to 10 are implemented.
  20. 一种异常事件检测模型构建装置,其特征在于,包括处理器,所述处理器和存储器耦合,所述存储器存储有程序,当所述存储器存储的程序指令被所述处理器执行时实现权利要求11-18中任一项所述的方法的步骤。A device for building an abnormal event detection model, characterized in that it includes a processor, the processor is coupled to a memory, the memory stores a program, and when the program instructions stored in the memory are executed by the processor, the steps of the method described in any one of claims 11 to 18 are implemented.
  21. 一种计算机可读存储介质,其特征在于,包括计算机程序指令,当所述计算机程序指令由处理器执行时,所述处理器执行如权利要求1-18中任一项所述的方法。A computer-readable storage medium, characterized in that it includes computer program instructions, and when the computer program instructions are executed by a processor, the processor executes the method according to any one of claims 1 to 18.
  22. 一种计算机程序产品,其特征在于,所述计算机程序产品包括软件代码,所述软件代码用于执行如权利要求1至18中任一项所述的方法的步骤。 A computer program product, characterized in that the computer program product comprises software code, and the software code is used to execute the steps of any one of the methods according to claims 1 to 18.
PCT/CN2023/134620 2022-12-02 2023-11-28 Method for detecting abnormal event, and method and apparatus for constructing abnormal-event detection model WO2024114618A1 (en)

Applications Claiming Priority (2)

Application Number Priority Date Filing Date Title
CN202211536903.2 2022-12-02
CN202211536903.2A CN118133031A (en) 2022-12-02 2022-12-02 Abnormal event detection method, abnormal event detection model construction method and device

Publications (1)

Publication Number Publication Date
WO2024114618A1 true WO2024114618A1 (en) 2024-06-06

Family

ID=91232396

Family Applications (1)

Application Number Title Priority Date Filing Date
PCT/CN2023/134620 WO2024114618A1 (en) 2022-12-02 2023-11-28 Method for detecting abnormal event, and method and apparatus for constructing abnormal-event detection model

Country Status (2)

Country Link
CN (1) CN118133031A (en)
WO (1) WO2024114618A1 (en)

Citations (3)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN109615116A (en) * 2018-11-20 2019-04-12 中国科学院计算技术研究所 A kind of telecommunication fraud event detecting method and detection system
CN113610521A (en) * 2021-07-27 2021-11-05 胜斗士(上海)科技技术发展有限公司 Method and apparatus for detecting anomalies in behavioral data
CN115114484A (en) * 2022-05-13 2022-09-27 腾讯科技(深圳)有限公司 Abnormal event detection method and device, computer equipment and storage medium

Patent Citations (3)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN109615116A (en) * 2018-11-20 2019-04-12 中国科学院计算技术研究所 A kind of telecommunication fraud event detecting method and detection system
CN113610521A (en) * 2021-07-27 2021-11-05 胜斗士(上海)科技技术发展有限公司 Method and apparatus for detecting anomalies in behavioral data
CN115114484A (en) * 2022-05-13 2022-09-27 腾讯科技(深圳)有限公司 Abnormal event detection method and device, computer equipment and storage medium

Also Published As

Publication number Publication date
CN118133031A (en) 2024-06-04

Similar Documents

Publication Publication Date Title
Bhatti et al. Deep learning with graph convolutional networks: An overview and latest applications in computational intelligence
WO2022083536A1 (en) Neural network construction method and apparatus
WO2022116933A1 (en) Model training method, data processing method and apparatus
JP6594329B2 (en) System and method for facial expression
US20220215259A1 (en) Neural network training method, data processing method, and related apparatus
WO2021218471A1 (en) Neural network for image processing and related device
CN110222718B (en) Image processing method and device
WO2022016556A1 (en) Neural network distillation method and apparatus
WO2022161387A1 (en) Neural network training method and related device
US20220237917A1 (en) Video comparison method and apparatus, computer device, and storage medium
WO2024041479A1 (en) Data processing method and apparatus
WO2022111387A1 (en) Data processing method and related apparatus
CN113761250A (en) Model training method, merchant classification method and device
CN113761359B (en) Data packet recommendation method, device, electronic equipment and storage medium
WO2024041483A1 (en) Recommendation method and related device
WO2022179606A1 (en) Image processing method and related apparatus
CN113919361A (en) Text classification method and device
Ephzibah et al. Big data management with machine learning inscribed by domain knowledge for health care
CN115631008A (en) Commodity recommendation method, commodity recommendation device, commodity recommendation equipment and commodity recommendation medium
WO2023197910A1 (en) User behavior prediction method and related device thereof
WO2023143570A1 (en) Connection relationship prediction method and related device
WO2021120177A1 (en) Method and apparatus for compiling neural network model
WO2024114618A1 (en) Method for detecting abnormal event, and method and apparatus for constructing abnormal-event detection model
CN113298265B (en) Heterogeneous sensor potential correlation learning method based on deep learning
CN115618065A (en) Data processing method and related equipment