Abnormal commodity detection model construction method and system based on labeled sparse heterogeneous graph
Patent Information
- Application Number
- CN202410924459.4
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2024-07-11
- Publication Date
- 2025-03-11
- Estimated Expiration
- 2044-07-11
Smart Images

Figure CN118885938B_ABST
Abstract
Description
Technical Field
[0001] The present invention relates to the field of computer technology, and in particular to a method and system for constructing an abnormal commodity detection model based on a labeled sparse heterogeneous graph. Background Art
[0002] Graph models are used to describe the relationship between entities. They contain two elements: nodes and edges. Nodes represent entities, and edges represent the connection between entities. There are many applications of graph models in the real world, such as social networks, transportation networks, and protein networks. Social networks refer to connecting people through the Internet platform to form groups or networks with certain characteristics. The network contains a variety of social entities and social relationships; transportation networks contain various elements in the transportation system (such as roads, intersections, vehicles, passengers, etc.) and the relationships between them (such as driving routes, traffic flow, transfer relationships, etc.); protein networks are a complex system composed of a group of proteins and the interactions between them.
[0003] A heterogeneous graph refers to a graph structure with more than one node type or edge type, representing multiple types of entities and complex relationships between them. Heterogeneous graphs can be used to simulate real-world interactions in various fields such as knowledge graphs, social networks, and e-commerce networks. With the rapid development of online shopping platforms (such as Taobao, Amazon, and JD.com), a large amount of interaction data is generated every moment. This data can be modeled as a heterogeneous graph containing various entity types and relationships, including users, products, stores, and the interactions between them. However, many abnormal commodity transactions are hidden in the massive interaction data. Abnormal commodities usually refer to those false or illegal commodities. The commodity information released by merchants violates the regulations of the platform or relevant laws and regulations, such as the sale of contraband, counterfeit and shoddy goods, etc. These commodities may contain some common characteristics, such as abnormally high or abnormally low prices among similar commodities, inconsistent descriptions with actual conditions, exaggerated slogans, and inconsistent pictures with descriptions. Abnormal commodities are often associated with other known false or illegal commodities, or have close relations with known illegal stores and sellers.
[0004] The emergence of these abnormal products has harmed the legitimate rights and interests of consumers and also affected the reputation of online shopping platforms. In order to ensure the healthy development of the online shopping industry, it is urgent to explore an effective method to detect product anomalies on heterogeneous graphs. Summary of the invention
[0005] The purpose of the present invention is to provide a method and system for constructing an abnormal commodity detection model based on a labeled sparse heterogeneous graph, aiming to solve the above-mentioned problems in the prior art.
[0006] The embodiment of the present invention provides a method for constructing an abnormal commodity detection model based on a label sparse heterogeneous graph, comprising:
[0007] Acquire shopping website related data, construct a label sparse heterogeneous graph according to the shopping website related data, and preprocess the label sparse heterogeneous graph to obtain an updated heterogeneous graph;
[0008] The updated heterogeneous graph is divided into a training set and a validation set, the training set is input into the improved relational graph convolutional network model RGCN for training to obtain a trained abnormal commodity detection model, and the validation set is used to verify the trained abnormal commodity detection model to obtain a final abnormal commodity detection model.
[0009] The embodiment of the present invention provides a system for building an abnormal commodity detection model based on a label sparse heterogeneous graph, including:
[0010] A processing module, used for acquiring shopping website related data, constructing a label sparse heterogeneous graph according to the shopping website related data, and preprocessing the label sparse heterogeneous graph to obtain an updated heterogeneous graph;
[0011] A construction module is used to divide the updated heterogeneous graph into a training set and a validation set, input the training set into the improved relational graph convolutional network model RGCN for training to obtain a trained abnormal product detection model, and use the validation set to verify the trained abnormal product detection model to obtain a final abnormal product detection model.
[0012] An embodiment of the present invention also provides an electronic device, comprising: a memory, a processor, and a computer program stored in the memory and executable on the processor, wherein the computer program, when executed by the processor, implements the steps of the above-mentioned method for constructing an abnormal product detection model based on a label sparse heterogeneous graph.
[0013] An embodiment of the present invention also provides a computer-readable storage medium, on which a program for implementing information transmission is stored. When the program is executed by a processor, the steps of the method for constructing an abnormal product detection model based on a label sparse heterogeneous graph are implemented.
[0014] The use of the embodiments of the present invention can include the following beneficial effects: the abnormal product detection model proposed in the embodiments of the present invention can identify potential abnormal products in a graph structure with sparse labels. The model will classify each product according to the relationship between the products and the characteristics of the products themselves, and add predicted labels to them (normal products are 0, abnormal products are 1). Through the comprehensive analysis of the model, false or illegal products can be effectively identified, and massive online shopping interaction data can be fully utilized to improve the accuracy of detecting abnormal products. Through such detection, the interests of consumers can be more effectively protected and the healthy ecology of online shopping platforms can be maintained. BRIEF DESCRIPTION OF THE DRAWINGS
[0015] In order to more clearly illustrate one or more embodiments of this specification or the technical solutions in the prior art, the drawings required for use in the embodiments or the description of the prior art will be briefly introduced below. Obviously, the drawings described below are only some embodiments recorded in this specification. For ordinary technicians in this field, other drawings can be obtained based on these drawings without paying creative labor.
[0016] Figure 1 It is a flow chart of a method for constructing an abnormal commodity detection model based on a label sparse heterogeneous graph according to an embodiment of the present invention;
[0017] Figure 2 is an example diagram of abnormal commodity detection on a heterogeneous graph according to an embodiment of the present invention;
[0018] Figure 3 This is a diagram of an abnormal commodity detection framework according to an embodiment of the present invention;
[0019] Figure 4 It is a schematic diagram of a system for building an abnormal commodity detection model based on a labeled sparse heterogeneous graph according to an embodiment of the present invention. DETAILED DESCRIPTION
[0020] In order to enable those skilled in the art to better understand the technical solutions in one or more embodiments of this specification, the following will be combined with the drawings in one or more embodiments of this specification to clearly and completely describe the technical solutions in one or more embodiments of this specification. Obviously, the described embodiments are only part of the embodiments of this specification, not all of the embodiments. Based on one or more embodiments of this specification, all other embodiments obtained by ordinary technicians in this field without creative work should fall within the scope of protection of this document.
[0021] Method Embodiment
[0022] According to an embodiment of the present invention, a method for constructing an abnormal commodity detection model based on a labeled sparse heterogeneous graph is provided. Figure 1is a flow chart of a method for constructing an abnormal commodity detection model based on a label sparse heterogeneous graph according to an embodiment of the present invention. Figure 1 As shown, the method for constructing an abnormal commodity detection model based on a label sparse heterogeneous graph according to an embodiment of the present invention specifically includes:
[0023] Step S101, obtaining shopping website related data, constructing a label sparse heterogeneous graph according to the shopping website related data, and preprocessing the label sparse heterogeneous graph to obtain an updated heterogeneous graph, specifically including:
[0024] Perform unbalanced sampling on different types of nodes in the labeled sparse heterogeneous graph based on the sampling probability shown in Formula 1 to obtain sampled nodes, sample neighbor nodes of the sampled nodes using the Euclidean distance function shown in Formula 2 to obtain a sampled heterogeneous graph, and randomly discard the meta-paths in the sampled heterogeneous graph using Formula 3 to obtain an updated heterogeneous graph;
[0025]
[0026] Among them, P(u) represents the probability of node u being sampled, represents the number of neighbor nodes of node u, LF(L(u)) represents the frequency of occurrence of label type L(u) of node u, CH (u,v) Represents the set of neighbor nodes after sampling the neighbor node v of the target node u, 0 means the node is not sampled, 1 means the node is sampled, is the neighbor node of node u, D(u,v) represents the Euclidean distance between node u and its neighbor node v, Δ represents the different distance thresholds used for nodes belonging to the minority class and the majority class, represents the unbalanced heterogeneous graph after randomly dropping meta-paths, M represents the random drop vector for performing random drop operations on meta-paths in the graph, and ⊙ represents the Hadamard product;
[0027] Step S102, dividing the updated heterogeneous graph into a training set and a validation set, inputting the training set into the improved relational graph convolutional network model RGCN for training to obtain a trained abnormal commodity detection model, and using the validation set to verify the trained abnormal commodity detection model to obtain a final abnormal commodity detection model, specifically including:
[0028] The training set is input into the improved relational graph convolutional network model RGCN for masked label propagation, a masking operation is performed on the label of the root node in the updated heterogeneous graph, and the neighborhood label information of the target node after the masking operation is calculated using Formula 4, and the neighborhood label information is added to the node representation of the target node to obtain an embedded representation of the target node. Based on the embedded representation, the neighborhood information of the target node is layer-aggregated through a knowledge hopping network as shown in Formula 5 to obtain an aggregated embedded representation of the target node, and the improved RGCN is optimized through a loss function, and it is continuously iterated and updated until a trained abnormal product detection model is obtained;
[0029]
[0030] Among them, l u is the neighborhood label information of node u, is the set of neighbor nodes of node u, w uv is the connection strength between node u and its neighbor node v, δ(·) is an indicator function, and h u (i+1) represents the aggregate embedding representation of the target node u in layer i, h v (i) represents the embedding representation of the neighbor node v in the i-th layer, is a collection of relations, represents the set of neighbor nodes of node u, is the transformation matrix of relation r at the i-th layer, is the transformation matrix of the node itself, and σ is the activation function;
[0031] The method further comprises:
[0032] The final abnormal commodity detection model is used to detect abnormal commodities in the transaction data of the online shopping platform.
[0033] The above technical solution of the embodiment of the present invention is described in detail below in combination with the specific situation of the method for building an abnormal product detection model based on a labeled sparse heterogeneous graph in the embodiment of the present invention.
[0034] The abnormal commodity detection on the heterogeneous graph proposed in the embodiment of the present invention is as follows Figure 2 As shown, icons u1-u4 represent user nodes, and icons i1-i8 represent product nodes; edges with different line styles between user nodes and product nodes represent different interactive relationships, where edge A represents "click", edge B represents "add to cart", edge C represents "purchase", and edge D represents "collection"; products with sad icons are considered abnormal, while products with smile icons are considered normal, and products with question mark icons are missing labels. Figure 2In the data, i8 is a “prescription drug” and is marked as abnormal because it is not allowed to be sold online without a doctor’s prescription; i4 is a “cigarette” and its online sale violates relevant laws and regulations, so it is detected as an abnormal product.
[0035] From the above examples, it can be seen that the number of abnormal products is significantly less than that of normal products, and only a small number of products are clearly marked. Heterogeneous graphs contain multiple types of nodes and interactive behaviors, so abnormal product detection on heterogeneous graphs will encounter three inevitable difficulties: First, because the number of abnormal nodes is much different from that of normal nodes, it leads to a serious class imbalance problem. Using unbalanced data to directly train the Graph Neural Network (GNN) classifier will make it difficult for the classifier to learn the characteristics of the minority class and tend to the majority class (i.e., normal nodes), resulting in poor classification effect of the classifier on minority class samples (i.e., abnormal nodes); secondly, heterogeneous graphs contain multiple types of nodes and interactive behaviors, with highly heterogeneous characteristics. Detecting abnormal products on heterogeneous graphs requires extracting key information from these complex graph structures; finally, because only a few nodes in the real-world dataset are clearly marked as abnormal or normal, most nodes are in an unlabeled state. Therefore, due to the sparsity of labels in the labeled dataset, abnormal nodes are very rare and difficult to detect.
[0036] In the early field of graph data anomaly detection, detection methods relied heavily on handcrafted feature engineering or statistical models built by domain experts, which essentially limited the ability of these technologies to detect unknown anomalies and required a lot of manpower. Later, many machine learning techniques, such as matrix decomposition and support vector machines, were also used to detect graph anomalies. However, real-world graph data usually contains millions of nodes and edges, resulting in extremely high dimensions and large-scale data. These techniques are not easy to effectively scale to such large data. With the development of graph representation learning technology, GNN has shown strong performance in the field of graph data mining. For example, graph data features extracted by graph neural networks can easily separate graph anomalies from normal objects.
[0037] In order to solve the above difficulties, the embodiment of the present invention proposes a new method to detect abnormal commodities on a sparsely labeled heterogeneous graph. First, the original data should be cleaned and feature extracted, and labels should be added to known normal commodities and abnormal commodities; then the processed data should be used to model a heterogeneous graph network, and the node types (such as commodity nodes, user nodes, category nodes, etc.) and edge types (user clicks / purchases / collects commodities, commodities belong to a certain category, etc.) should be defined respectively; in order to alleviate the class imbalance problem and train an unbiased classifier, the embodiment of the present invention does not directly train on the entire graph, but uses an unbalanced sampling algorithm to construct a training subgraph. After obtaining balanced training data, a deep learning framework (such as PyTorch Geometric) is used to construct a relational graph convolutional network (RGCN) model, and the sampled balanced data set is divided into a training set and a validation set. The RGCN model is trained using the training data, the objective function is optimized, the model performance is evaluated on the validation set, and the hyperparameters are adjusted to improve the model effect. During the training process, the embodiment of the present invention optimizes the message propagation process of the graph neural network, masks the label of the root node, propagates the labels of the neighboring nodes during the propagation process, and transmits the node feature information and label information at the same time, solving the problem of sparse labels on heterogeneous graphs. When outputting the final embedded representation of the node, the embodiment of the present invention considers the original input features and the features after aggregation of each layer at the same time, so that the embedded representation of the node can integrate information from different layers and has a certain degree of robustness to noise; finally, the trained RGCN model is used to predict the full data, extract the node embedding features, calculate the product anomaly score according to the predicted probability output by the model, set a threshold, and mark the products exceeding the threshold as abnormal products.
[0038] The embodiment of the present invention mainly includes three key modules:
[0039] 1. The unbalanced sampling module calculates the sampling probability based on the type of node and the density of neighboring nodes, which can maximize the balance between the number of minority class samples and majority class samples. In order to effectively manage various edge types, a random meta-path loss technique is adopted. In each training cycle, a loss vector is generated to determine the meta-path to be excluded. This method isolates related nodes during the graph structure learning process, enabling the classifier to learn complex graph structures well.
[0040] 2. The masked label propagation module first masks the label of the root node, and then uses the graph structure information to propagate the labels of the neighboring nodes to the root node. The weights of the neighboring node labels are determined by the strength of their connection with the root node. This iterative method involves using the label of each node multiple times, which effectively solves the problem of label sparsity. In addition, label propagation that relies on weighted neighbor averages is robust to noise and outliers. Although a limited number of mislabeled or noisy data will be encountered, this method can generate relatively accurate label predictions.
[0041] 3. The skip knowledge network module combines the representations from multiple layers as output, so that adaptive aggregation can be performed in the neighborhood range determined by the graph structure and node position. In a graph neural network, an increase in the number of layers usually causes the representations of nodes to become too similar, thereby reducing classification performance. The embodiment of the present invention uses a skip knowledge network to achieve adaptive node representation, alleviating the over-smoothing problem caused by too many layers in the graph neural network.
[0042] The abnormal commodity detection method proposed in the embodiment of the present invention is specifically as follows:
[0043] 1. Model Overview
[0044] The heterogeneous graph is defined as and denote the node set and edge set respectively, and Represent the sets of node types and edge types respectively, where Given a heterogeneous graph G, graph anomaly detection can be viewed as a binary classification task. Specifically, each node v should be identified as “normal” (labeled as 0) or “abnormal” (labeled as 1), that is, After observing the labels of a limited number of nodes, this work aims to predict the labels of other nodes.
[0045] like Figure 3 As shown, the embodiment of the present invention mainly consists of three modules, which work together. The embodiment of the present invention provides an example with 15 nodes. First, the embodiment of the present invention performs unbalanced sampling processing on the initial heterogeneous graph data, oversampling and undersampling the nodes of the minority class and the majority class respectively; then, random meta-path discarding is applied to generate different graph structures for training; then, the label of the root node is masked, and the labels of the neighbor nodes are integrated as data enhancement during the message passing process; in addition, in the multi-layer neural network structure, the skip knowledge network is aggregated and embedded from different layers.
[0046] 2. Unbalanced Sampling
[0047] In order to balance the number of minority class samples and majority class samples in the data, the embodiment of the present invention needs to process the original data. Unbalanced sampling includes two parts: node sampling and random meta-path discarding.
[0048] 2.1 Node Sampling
[0049] In unbalanced sampling, oversampling and undersampling techniques are used to balance the number of nodes of different classes. The embodiment of the present invention uses this method to solve the imbalance problem of normal samples and abnormal samples on a heterogeneous graph.
[0050] In an unbalanced heterogeneous graph, there are two different category labels, normal and abnormal, and normal nodes contain multiple types. For example, in regular online shopping, users may buy different products from different stores. These users, products, and stores form multiple types of nodes in the unbalanced graph.
[0051] In order to simplify the subsequent processing of node vectors, such as the aggregation process after oversampling and undersampling, the representation vectors of different types of nodes are first mapped to the same feature space, as shown in the following formula:
[0052] h′ A =W A h A (1)
[0053] Among them, W A Indicates a node type specific The node mapping matrix, h A ∈R d Represents the initial vector representation of node type A, with vector dimensions of d, h′ A ∈R d′ Represents the node vector representation of node type A after being mapped to the same dimension through a specific mapping matrix, with dimension d′.
[0054] After mapping different types of nodes to the same feature space, sampling is performed. Since the number of abnormal nodes is relatively small, while the number of other normal nodes is large, oversampling normal nodes will lead to an increase in the noise interaction ratio. Therefore, the embodiment of the present invention adopts oversampling and undersampling methods. The core idea is to control the sampling number of normal nodes within a certain range in a probabilistic form, while increasing the sampling number of abnormal nodes. The specific sampling probability is shown in the following formula:
[0055]
[0056] Among them, P(u) represents the probability of node u being sampled, represents the number of neighbor nodes of node u, LF(L(u)) represents the frequency of occurrence of label type L(u) of node u, and formula (2) represents the sampling probability of oversampling normal nodes and undersampling abnormal nodes, aiming to sample more key nodes that are closely connected with other nodes and belong to the minority class.
[0057] After the probability-controlled sampling is completed, because the neighbor nodes of the selected node on the heterogeneous graph contain important information, the Euclidean distance function is used to further sample the neighbor nodes of the selected node, only sampling relatively close nodes and filtering out the nodes farther away in the unbalanced graph. The following formula shows how to select neighbor nodes:
[0058]
[0059] D(u,v)=∥h′ u -h′ v ∥ (4)
[0060] Among them, CH (u,v) Represents the set of neighbor nodes after sampling the neighbor node v of the target node u, 0 means the node is not sampled, 1 means the node is sampled, is the neighbor node of node u, and D(u,v) represents the Euclidean distance between node u and its neighbor node v. The embodiment of the present invention uses different distance thresholds Δ for nodes belonging to the minority class and the majority class, and uses a larger threshold for minority class nodes to sample a wider range of nodes.
[0061] 2.2 Random Meta-Path Dropping
[0062] Inspired by the data distribution deviation in processing different interactive behaviors in contrastive learning, the embodiment of the present invention performs a random drop operation on the meta-path in the unbalanced heterogeneous graph, as shown in the following formula:
[0063]
[0064] in, represents an unbalanced heterogeneous graph after randomly dropping meta-paths, M represents the random drop vector that performs random drop operations on meta-paths in the graph, and ⊙ represents the Hadamard product.
[0065] During the training phase, meta-path dropout can generate different random deformations of the input graph data, which can be seen as a data augmentation method specifically for graphs; in addition, by using a random subset of neighbors instead of all neighbors for aggregation, it can avoid the model from over-relying on certain specific meta-paths and ignoring other graph structure information.
[0066] Algorithm 1 describes the entire unbalanced sampling process, where lines 1-3 are used to map node features to a common feature space, lines 4-6 calculate the sampling probability of each node, line 7 initializes the sampled node subset, lines 8-11 sample nodes according to the calculated probability, lines 12-18 further sample neighbor nodes based on the Euclidean distance, and line 19 samples the edge type set. Generate a random drop vector M, and line 20 uses formula (5) to generate the updated heterogeneous graph G′.
[0067]
[0068]
[0069] 3. Masked label propagation
[0070] After unbalanced sampling, a heterogeneous subgraph that can be used for graph neural network learning is obtained. In order to make full use of the existing labels in the heterogeneous graph and solve the problem of sparse labels, label propagation is performed before embedding neighbor nodes. Masked label propagation can be used as a data enhancement method. During the message propagation process, node feature information and label information are transmitted simultaneously. However, directly adding the embedding of labels to all nodes is prone to label information leakage. Therefore, the embodiment of the present invention performs a masking operation on the label of the root node in the graph, and the weight of the neighbor node label is determined by the strength of its connection with the root node.
[0071]
[0072] Among them, l u is the neighborhood label information of node u, is the set of neighbor nodes of node u, w uv is the connection strength between node u and its neighbor node v, δ(·) is an indicator function, when the label of node v is l k is equal to 1 when , otherwise it is equal to 0.
[0073] During masked label propagation, partially observable node labels are mapped to the same feature space as the nodes, as follows:
[0074] h u (i) =h u (i)′ +l u W (7)
[0075] Among them, h u (i) represents the embedding representation of the target node in the i-th layer, l u represents the label of node u, and W represents the mapping matrix of label vector.
[0076] 4. Jumping through the knowledge network
[0077] Although the message aggregation method of graph neural networks can adapt to graphs with different structures, its fixed hierarchical structure and the way of aggregating information from neighborhoods may lead to significant deviations in the node representations of different neighborhood structures, which are catastrophic for different nodes.
[0078] After obtaining the node embedding representation including label propagation, the neighbors of the target node are aggregated using the knowledge hopping network, which is in the following form:
[0079]
[0080] h u (L) =COMBINE({h u (i) ,i=1,2,3,…,L}) (9)
[0081] Among them, h u (i+1) represents the aggregate embedding representation of the target node u in layer i, h v (i) represents the embedding representation of the neighbor node v in the i-th layer, is a collection of relations, represents the set of neighbor nodes of node u, is the transformation matrix of relation r at the i-th layer, is the transformation matrix of the node itself, σ is the activation function, h u (L) is the final embedding representation of node u, L represents the label of the last layer of the neural network, and COMBINE represents any commonly used layer aggregation mechanism, such as concatenation, max-pooling, and long short-term memory-attention (LSTM-attention).
[0082] In common neighborhood aggregation networks, each layer gradually expands the influence distribution by aggregating the neighborhood of the previous layer. In the last layer, for each node, the embodiment of the present invention selectively selects and combines the embedding representations from the previous layers (these embedding representations are "jumped" to the last layer). If this operation is performed independently for each node, the model can adjust the effective neighborhood size of each node as needed, thereby accurately achieving the required adaptability.
[0083] 5. Optimization goals
[0084] For semi-supervised classification of nodes, the embodiment of the present invention uses an RGCN model with a softmax(·) activated output in the last layer, ignores unlabeled nodes, and minimizes the cross entropy loss on all labeled nodes:
[0085]
[0086] Where y is a collection of node indices with labels, is the k entries of the ith labeled node in the network output, t ik represents its corresponding true label.
[0087] According to this optimization goal, RGCN is trained and the output probability y obtained by forward propagation is used. pred and the actual label y truth Calculating Losses The gradient of the loss with respect to the model parameters is calculated through the back-propagation algorithm, and the model parameters are updated using the Adam optimizer. After multiple rounds of learning, the classifier reaches convergence.
[0088] 6. Label prediction
[0089] After obtaining the trained RGCN classifier, the label prediction of unknown nodes can be performed to perform anomaly detection tasks, as shown in the following formula:
[0090]
[0091] in, represents the final label of node u, Represents a function that generates the predicted label of node u based on the final embedding of node u. The specific method is to first use the forward propagation process of the trained RGCN model to obtain the final feature embedding representation of each node The final embedding of each node Pass it to a fully connected layer MLP and apply the RELU activation function to obtain the probability distribution of the node belonging to each category. The specific formula is as follows:
[0092]
[0093] Among them, Linear(·) represents a single-layer linear network, Linear(x) is formalized as Wx+b, and finally the argmax(·) function is used to obtain the category with the maximum probability and return the category label:
[0094]
[0095] Algorithm 2 describes the steps of the abnormal product detection algorithm. Line 1 calls Algorithm 1 to generate the sampled node subset S and the updated heterogeneous graph G′. Lines 2-8 are used to iteratively update the features of each node. Line 4 calculates the neighborhood label information l of node u. u , line 5 will l u Added to the representation of node u, line 6 performs message propagation aggregation of the current layer, and lines 9-14 generate the predicted label of each node Line 10 uses the skip knowledge network for layer aggregation, line 11 obtains the probability distribution of each node through the fully connected layer, line 12 returns the class label with the highest probability, and line 13 returns the predicted label of the node.
[0096] System Example
[0097] According to an embodiment of the present invention, a system for constructing an abnormal commodity detection model based on a labeled sparse heterogeneous graph is provided. Figure 4 is a schematic diagram of a system for building an abnormal commodity detection model based on a label sparse heterogeneous graph according to an embodiment of the present invention. Figure 4 As shown, the abnormal commodity detection model construction system based on the label sparse heterogeneous graph according to an embodiment of the present invention specifically includes:
[0098] The processing module 40 is used to obtain shopping website related data, construct a label sparse heterogeneous graph according to the shopping website related data, and pre-process the label sparse heterogeneous graph to obtain an updated heterogeneous graph, which is specifically used to:
[0099] Perform unbalanced sampling on different types of nodes in the labeled sparse heterogeneous graph based on the sampling probability shown in Formula 1 to obtain sampled nodes, sample neighbor nodes of the sampled nodes using the Euclidean distance function shown in Formula 2 to obtain a sampled heterogeneous graph, and randomly discard the meta-paths in the sampled heterogeneous graph using Formula 3 to obtain an updated heterogeneous graph;
[0100]
[0101] Among them, P(u) represents the probability of node u being sampled, represents the number of neighbor nodes of node u, LF(L(u)) represents the frequency of occurrence of label type L(u) of node u, CH (u,v) Represents the set of neighbor nodes after sampling the neighbor node v of the target node u, 0 means the node is not sampled, 1 means the node is sampled, is the neighbor node of node u, D(u,v) represents the Euclidean distance between node u and its neighbor node v, Δ represents the different distance thresholds used for nodes belonging to the minority class and the majority class, represents the unbalanced heterogeneous graph after randomly dropping meta-paths, M represents the random drop vector for performing random drop operations on meta-paths in the graph, and ⊙ represents the Hadamard product;
[0102] The construction module 42 is used to divide the updated heterogeneous graph into a training set and a verification set, input the training set into the improved relational graph convolutional network model RGCN for training to obtain a trained abnormal commodity detection model, and use the verification set to verify the trained abnormal commodity detection model to obtain the final abnormal commodity detection model, which is specifically used for:
[0103] The training set is input into the improved relational graph convolutional network model RGCN for masked label propagation, a masking operation is performed on the label of the root node in the updated heterogeneous graph, and the neighborhood label information of the target node after the masking operation is calculated using Formula 4, and the neighborhood label information is added to the node representation of the target node to obtain an embedded representation of the target node. Based on the embedded representation, the neighborhood information of the target node is layer-aggregated through a knowledge hopping network as shown in Formula 5 to obtain an aggregated embedded representation of the target node, and the improved RGCN is optimized through a loss function, and it is continuously iterated and updated until a trained abnormal product detection model is obtained;
[0104]
[0105] Among them, l u is the neighborhood label information of node u, is the set of neighbor nodes of node u, w uv is the connection strength between node u and its neighbor node v, δ(·) is an indicator function, and h u (i+1) represents the aggregate embedding representation of the target node u in layer i, h v (i) represents the embedding representation of the neighbor node v in the i-th layer, is a collection of relations, represents the set of neighbor nodes of node u, is the transformation matrix of relation r at the i-th layer, is the transformation matrix of the node itself, and σ is the activation function;
[0106] The system further comprises:
[0107] The detection module is used to detect abnormal commodities in the transaction data of the online shopping platform through the final abnormal commodity detection model.
[0108] The embodiment of the present invention is a system embodiment corresponding to the above-mentioned method embodiment. The specific operations of each module can be understood by referring to the description of the method embodiment, which will not be repeated here.
[0109] In summary, the abnormal commodity detection method proposed in the embodiment of the present invention can be applied to the real transaction scenarios of online shopping platforms. Using heterogeneous graphs to model the transaction data of online shopping platforms, most of the commodity data of online shopping platforms are missing labels. The model of the embodiment of the present invention can identify potential abnormal commodities in the graph structure with sparse labels. The model will classify each commodity according to the relationship between commodities and the characteristics of the commodities themselves, and add predicted labels to them (normal commodities are 0, abnormal commodities are 1). Those commodities predicted to be abnormal, even if they look normal, are more likely to be false or illegal commodities according to the comprehensive analysis of the model. At the same time, this method not only relies on the attributes of a single commodity, but also utilizes the association information between commodities, which can make full use of the massive online shopping interaction data and improve the accuracy of detecting abnormal commodities. Through such detection, the interests of consumers can be more effectively protected and the healthy ecology of online shopping platforms can be maintained.
[0110] Device Example 1
[0111] An embodiment of the present invention provides an electronic device, comprising: a memory, a processor, and a computer program stored in the memory and executable on the processor, wherein the computer program implements the steps described in the method embodiment when executed by the processor.
[0112] Device Example 2
[0113] An embodiment of the present invention provides a computer-readable storage medium, on which a program for implementing information transmission is stored. When the program is executed by a processor, the steps described in the method embodiment are implemented.
[0114] The computer-readable storage medium in this embodiment includes, but is not limited to, ROM, RAM, magnetic disk or optical disk, etc.
[0115] Finally, it should be noted that the above embodiments are only used to illustrate the technical solutions of the present invention, rather than to limit it. Although the present invention has been described in detail with reference to the aforementioned embodiments, those skilled in the art should understand that they can still modify the technical solutions described in the aforementioned embodiments, or replace some or all of the technical features therein with equivalents. However, these modifications or replacements do not cause the essence of the corresponding technical solutions to deviate from the scope of the technical solutions of the embodiments of the present invention.
Claims
1. A method for constructing an abnormal commodity detection model based on a labeled sparse heterogeneous graph, characterized in that: include: Acquiring shopping website related data, constructing a label sparse heterogeneous graph according to the shopping website related data, and preprocessing the label sparse heterogeneous graph to obtain an updated heterogeneous graph, specifically including: Perform unbalanced sampling on different types of nodes in the labeled sparse heterogeneous graph based on the sampling probability shown in Formula 1 to obtain sampled nodes, sample neighbor nodes of the sampled nodes using the Euclidean distance function shown in Formula 2 to obtain a sampled heterogeneous graph, and randomly discard the meta-paths in the sampled heterogeneous graph using Formula 3 to obtain an updated heterogeneous graph; Among them, P(u) represents the probability of node u being sampled, represents the number of neighbor nodes of node u, LF(L(u)) represents the frequency of occurrence of label type L(u) of node u, CH (u,v) Represents the set of neighbor nodes after sampling the neighbor node v of the target node u, 0 means the node is not sampled, 1 means the node is sampled, is the neighbor node of node u, D(u,v) represents the Euclidean distance between node u and its neighbor node v, Δ represents the different distance thresholds used for nodes belonging to the minority class and the majority class, represents the unbalanced heterogeneous graph after randomly dropping meta-paths, M represents the random drop vector for performing random drop operations on meta-paths in the graph, and ⊙ represents the Hadamard product; The updated heterogeneous graph is divided into a training set and a validation set, the training set is input into the improved relational graph convolutional network model RGCN for training, and a trained abnormal commodity detection model is obtained. The trained abnormal commodity detection model is verified using the validation set to obtain a final abnormal commodity detection model, which specifically includes: The training set is input into the improved relational graph convolutional network model RGCN for masked label propagation, a masking operation is performed on the label of the root node in the updated heterogeneous graph, and the neighborhood label information of the target node after the masking operation is calculated using Formula 4, and the neighborhood label information is added to the node representation of the target node to obtain an embedded representation of the target node. Based on the embedded representation, the neighborhood information of the target node is layer-aggregated through a knowledge hopping network as shown in Formula 5 to obtain an aggregated embedded representation of the target node, and the improved RGCN is optimized through a loss function, and it is continuously iterated and updated until a trained abnormal product detection model is obtained; Among them, l u is the neighborhood label information of node u, is the set of neighbor nodes of node u, w uv is the connection strength between node u and its neighbor node v, δ(·) is an indicator function, and h u (i+1) represents the aggregate embedding representation of the target node u in layer i, h v (i) represents the embedding representation of the neighbor node v in the i-th layer, is a collection of relations, represents the set of neighbor nodes of node u, is the transformation matrix of relation r at the i-th layer, is the transformation matrix of the node itself, and σ is the activation function.
2. The method according to claim 1, characterized in that The method further comprises: The final abnormal commodity detection model is used to detect abnormal commodities in the transaction data of the online shopping platform.
3. A system for building an abnormal commodity detection model based on a labeled sparse heterogeneous graph, characterized in that: include: The processing module is used to obtain shopping website related data, construct a label sparse heterogeneous graph according to the shopping website related data, and pre-process the label sparse heterogeneous graph to obtain an updated heterogeneous graph, specifically for: Perform unbalanced sampling on different types of nodes in the labeled sparse heterogeneous graph based on the sampling probability shown in Formula 1 to obtain sampled nodes, sample neighbor nodes of the sampled nodes using the Euclidean distance function shown in Formula 2 to obtain a sampled heterogeneous graph, and randomly discard the meta-paths in the sampled heterogeneous graph using Formula 3 to obtain an updated heterogeneous graph; Among them, P(u) represents the probability of node u being sampled, represents the number of neighbor nodes of node u, LF(L(u)) represents the frequency of occurrence of label type L(u) of node u, CH (u,v) Represents the set of neighbor nodes after sampling the neighbor node v of the target node u, 0 means the node is not sampled, 1 means the node is sampled, is the neighbor node of node u, D(u,v) represents the Euclidean distance between node u and its neighbor node v, Δ represents the different distance thresholds used for nodes belonging to the minority class and the majority class, represents the unbalanced heterogeneous graph after randomly dropping meta-paths, M represents the random drop vector for performing random drop operations on meta-paths in the graph, and ⊙ represents the Hadamard product; The construction module is used to divide the updated heterogeneous graph into a training set and a validation set, input the training set into the improved relational graph convolutional network model RGCN for training, obtain a trained abnormal commodity detection model, and use the validation set to verify the trained abnormal commodity detection model to obtain the final abnormal commodity detection model, which is specifically used for: The training set is input into the improved relational graph convolutional network model RGCN for masked label propagation, a masking operation is performed on the label of the root node in the updated heterogeneous graph, and the neighborhood label information of the target node after the masking operation is calculated using Formula 4, and the neighborhood label information is added to the node representation of the target node to obtain an embedded representation of the target node. Based on the embedded representation, the neighborhood information of the target node is layer-aggregated through a knowledge hopping network as shown in Formula 5 to obtain an aggregated embedded representation of the target node, and the improved RGCN is optimized through a loss function, and it is continuously iterated and updated until a trained abnormal product detection model is obtained; Among them, l u is the neighborhood label information of node u, is the set of neighbor nodes of node u, w uv is the connection strength between node u and its neighbor node v, δ(·) is an indicator function, and h u (i+1) represents the aggregate embedding representation of the target node u in layer i, h v (i) represents the embedding representation of the neighbor node v in the i-th layer, is a collection of relations, represents the set of neighbor nodes of node u, is the transformation matrix of relation r at the i-th layer, is the transformation matrix of the node itself, and σ is the activation function.
4. The system according to claim 3, characterized in that The system further comprises: The detection module is used to detect abnormal commodities in the transaction data of the online shopping platform through the final abnormal commodity detection model.
5. An electronic device, characterized in that: include: A memory, a processor, and a computer program stored in the memory and executable on the processor, wherein the computer program, when executed by the processor, implements the steps of the method for constructing an abnormal commodity detection model based on a labeled sparse heterogeneous graph as described in any one of claims 1 to 2.
6. A computer-readable storage medium, characterized in that: The computer-readable storage medium stores an implementation program for information transmission, and when the program is executed by the processor, the steps of the method for building an abnormal commodity detection model based on a label sparse heterogeneous graph as described in any one of claims 1 to 2 are implemented.
Citation Information
Patent Citations
Chat scene abnormal user discovery method and system based on graph neural network
CN117312567A
Personalized cross-domain recommendation method based on network data driving
CN117556148A