Method, apparatus, equipment, and medium for generating prediction rules based on attribute graph data.
By extracting biplanetary data from attribute graph data, constructing and filtering predicate combinations, and generating optimized prediction rules, the problems of low efficiency and insufficient accuracy in existing technologies are solved, thereby improving the accuracy of recommendation models.
Patent Information
- Application Number
- CN202311126211.5
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2023-08-30
- Publication Date
- 2025-10-28
- Estimated Expiration
- 2043-08-30
AI Technical Summary
Existing recommender system algorithms are inefficient at discovering rules in graph data, unable to discover large-scale graph prediction rules within a reasonable time, and unable to effectively improve the accuracy of machine learning recommender models, especially exhibiting poor scalability when dealing with attribute graph data.
Bistellar data is extracted from attribute graph data to construct recommendation model predicates. Through predicate construction and logical predicate combination, support and confidence are calculated, predicate combinations that meet the conditions are selected, and optimized prediction rules are generated by fusion.
The effective discovery of high-quality prediction rules improved the accuracy of the recommendation model, reduced the number of false positive and false negative samples, and optimized the recommendation results.
Smart Images

Figure CN117194778B_ABST
Abstract
Description
Technical Field
[0001] This application relates to the field of graph data analysis technology, and in particular to a method, apparatus, device and medium for generating prediction rules based on attribute graph data. Background Technology
[0002] Recommender systems are widely used in various applications such as e-commerce, news, music, and video. Existing recommender system algorithms include collaborative filtering (CF), content-based recommendation (CB), and hybrid models. Graph prediction rules can be used to improve the accuracy of recommender system models and reduce the number of false positives (FPs) and false negatives (FNs).
[0003] Currently, many rules are manually formulated by domain experts based on experience, which is not only very costly but also has low accuracy and poor consistency. When it comes to discovering rules from graph data, most existing work focuses on discovering rules with limited expressive power, only able to discover rules with graph patterns but not logical conditions. For discovering graph prediction rules that combine graph patterns and logical conditions from graph data, a level-wise discovery algorithm can be used. This algorithm decomposes the discovery process into vertical expansion and horizontal expansion. The vertical expansion part obtains a graph pattern with n edges by adding an edge to a graph pattern with n-1 edges. The horizontal expansion part maintains a predicate spanning tree for each graph pattern, and finds graph prediction rules that meet the conditions by continuously adding predicate constraints to the spanning tree. Based on this, an application-driven graph filtering strategy is used to select relevant predicates, and a sampling method is used to generate a small subset of data from the graph data, achieving a balance between accuracy and efficiency. Then, a level-wise discovery algorithm is used to generate rules from the samples. However, the aforementioned algorithms have low discovery efficiency, failing to discover large-scale graph prediction rules within a reasonable timeframe. Furthermore, rule discovery requires a Resource Description Framework (RDF) graph, which is unsuitable for commonly used attribute graphs. Converting attribute graphs to RDF graphs results in numerous RDF triples for node attributes, leading to poor scalability when discovering rules on such RDF graphs. Consequently, they cannot effectively discover rules to improve the accuracy of machine learning recommendation models. Therefore, how to efficiently discover high-quality prediction rules to improve the accuracy of existing recommendation models has become an urgent problem to be solved. Summary of the Invention
[0004] In view of this, embodiments of this application provide a method, apparatus, device, and medium for generating prediction rules based on attribute graph data, in order to solve the problem of how to efficiently discover high-quality prediction rules to improve the accuracy of existing recommendation models.
[0005] In a first aspect, embodiments of this application provide a method for generating prediction rules based on attribute graph data, the method comprising:
[0006] A double star data is extracted from an attribute graph data. The double star data includes a first type of node and at least one first node path connecting the first type of node, and a second type of node and at least one second node path connecting the second type of node. The first type of node and the second type of node are different node categories, and the nodes on any two node paths do not intersect.
[0007] Based on the preset recommendation model, a recommendation model predicate is constructed. Based on the preset predicate formula, predicates are constructed for the first attribute node in each first node path and the second attribute node in each second node path to obtain at least one candidate logical predicate. The first attribute node and the second attribute node have the same attribute.
[0008] Based on the at least one candidate logical predicate, at least one candidate predicate combination is constructed. For any candidate predicate combination, combined with the recommendation model predicate, the support and confidence of the candidate predicate combination in the attribute graph data are calculated.
[0009] Candidate predicate combinations that satisfy both the support and confidence scores are identified as target predicate combinations. Each target predicate combination is then fused with the predicates of the recommendation model to obtain the fusion result, which is used to optimize the prediction rule of the recommendation model.
[0010] Secondly, embodiments of this application provide a prediction rule generation apparatus based on attribute graph data, the prediction rule generation apparatus comprising:
[0011] The pattern data generation module is used to extract a double star data from an attribute graph data. The double star data includes a first type of node and at least one first node path connecting the first type of node, and a second type of node and at least one second node path connecting the second type of node. The first type of node and the second type of node are different node categories, and the nodes on any two node paths do not intersect.
[0012] The predicate construction module is used to construct recommendation model predicates based on a preset recommendation model. Based on the preset predicate formula, it constructs predicates for the first attribute data in each first node path and the second attribute data in each second node path to obtain at least one candidate logical predicate. The first attribute data and the second attribute data have the same attribute.
[0013] The indicator calculation module is used to construct at least one candidate predicate combination based on the at least one candidate logical predicate, and for any candidate predicate combination, in combination with the recommendation model predicate, calculate the support and confidence of the candidate predicate combination in the attribute graph data;
[0014] The prediction rule determination module is used to determine the candidate predicate combinations that both the support and the confidence satisfy preset conditions as target predicate combinations, and to fuse each target predicate combination with the predicate of the recommendation model to obtain the fusion result as the prediction rule for optimizing the recommendation model.
[0015] Thirdly, embodiments of this application provide a computer device, the computer device including a processor, a memory, and a computer program stored in the memory and executable on the processor, wherein the processor executes the computer program to implement the prediction rule generation method as described in the first aspect.
[0016] Fourthly, embodiments of this application provide a computer-readable storage medium storing a computer program that, when executed by a processor, implements the prediction rule generation method as described in the first aspect.
[0017] The beneficial effects of this application embodiment compared with the prior art are as follows: This application extracts a double-star data from an attribute graph data, constructs recommendation model predicates based on a preset recommendation model, constructs predicates for the first attribute node in each first node path and the second attribute node in each second node path in the double-star data based on a preset predicate formula, and obtains at least one candidate logical predicate. Based on at least one candidate logical predicate, at least one candidate predicate combination is constructed. For any candidate predicate combination, combined with the recommendation model predicate, the support and confidence of the candidate predicate combination in the attribute graph data are calculated, and the support and confidence are determined to be equal. Candidate predicate combinations that meet preset conditions are designated as target predicate combinations. Each target predicate combination is then fused with the predicates of the recommendation model to obtain the fusion result, which serves as the prediction rule for optimizing the recommendation model. By analyzing the extracted biplanetary data, logical predicates representing the attribute relationships between data are formed, which can effectively discover the correlations between attributes. The logical predicates are then combined and filtered based on support and confidence to obtain optimized predicate combinations, i.e., accurate correlations. These are then combined with the recommendation logic of the recommendation model to obtain high-quality prediction rules. This optimizes the positive and negative errors of the recommendation results when the recommendation model is used, thereby improving the accuracy of the recommendation model. Attached Figure Description
[0018] In order to more clearly illustrate the technical solutions in the embodiments of the present application, the following briefly introduces the drawings required for use in the embodiments or descriptions of the prior art. Obviously, the drawings described below are only some embodiments of the present application. For ordinary technicians in this field, other drawings can be obtained based on these drawings without any creative work.
[0019] Figure 1 This is a schematic diagram of an application environment for a prediction rule generation method based on attribute graph data provided in Embodiment 1 of this application;
[0020] Figure 2 This is a flowchart illustrating a prediction rule generation method based on attribute graph data provided in Embodiment 2 of this application;
[0021] Figure 3 This is a flowchart illustrating a prediction rule generation method based on attribute graph data provided in Embodiment 3 of this application;
[0022] Figure 4 This is a flowchart illustrating a prediction rule generation method based on attribute graph data provided in Embodiment 4 of this application;
[0023] Figure 5 This is a flowchart illustrating a prediction rule generation method based on attribute graph data provided in Embodiment 5 of this application;
[0024] Figure 6 This is a flowchart illustrating a prediction rule generation method based on attribute graph data provided in Embodiment Six of this application;
[0025] Figure 7 This is a flowchart illustrating a prediction rule generation method based on attribute graph data provided in Embodiment 7 of this application;
[0026] Figure 8 This is a schematic diagram of a prediction rule generation device based on attribute graph data provided in Embodiment 8 of this application;
[0027] Figure 9 This is a schematic diagram of the structure of a computer device provided in Embodiment 9 of this application. Detailed Implementation
[0028] In the following description, specific details such as particular system architectures and techniques are set forth for illustrative purposes and not for limitation, in order to provide a thorough understanding of the embodiments of this application. However, those skilled in the art will understand that this application may also be implemented in other embodiments without these specific details. In other instances, detailed descriptions of well-known systems, apparatuses, circuits, and methods have been omitted so as not to obscure the description of this application with unnecessary detail.
[0029] It should be understood that, when used in this application specification and the appended claims, the term "comprising" indicates the presence of the described features, integrals, steps, operations, elements and / or components, but does not exclude the presence or addition of one or more other features, integrals, steps, operations, elements, components and / or a collection thereof.
[0030] It will also be understood that the term "and / or" used in this specification and the appended claims refers to and includes any and all possible combinations of one or more of the associated listed items.
[0031] As used in this specification and the appended claims, the term "if" can be interpreted as "when" or "upon" or "in response to determining" or "in response to detecting," depending on the context. Similarly, the phrase "if it is determined" or "if [described condition or event] is detected" can be interpreted as meaning "upon determination" or "in response to determining" or "upon detection of [described condition or event]" or "in response to detecting [described condition or event]," depending on the context.
[0032] Furthermore, in the description of this application and the appended claims, the terms "first," "second," "third," etc., are used only to distinguish descriptions and should not be construed as indicating or implying relative importance.
[0033] References to "one embodiment" or "some embodiments" in this specification mean that a particular feature, structure, or characteristic described in conjunction with that embodiment is included in one or more embodiments of the present application. Thus, phrases such as "in one embodiment," "in some embodiments," "in other embodiments," and "in other embodiments" appearing in various places in this specification do not necessarily refer to the same embodiment, but rather mean "one or more but not all embodiments," unless otherwise specifically emphasized. The terms "including," "comprising," "having," and variations thereof all mean "including but not limited to," unless otherwise specifically emphasized.
[0034] The embodiments of this application can acquire and process relevant data based on artificial intelligence technology. Artificial intelligence is the 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 that knowledge to obtain optimal results.
[0035] Fundamental AI technologies generally include sensors, dedicated AI chips, cloud computing, distributed storage, big data processing, operating / interaction systems, and mechatronics. AI software technologies primarily encompass computer vision, robotics, biometrics, speech processing, natural language processing, and machine learning / deep learning.
[0036] It should be understood that the sequence number of each step in the following embodiments does not imply the order of execution. The execution order of each process should be determined by its function and internal logic, and should not constitute any limitation on the implementation process of the embodiments of this application.
[0037] To illustrate the technical solution of this application, specific embodiments are described below.
[0038] The prediction rule generation method based on attribute graph data provided in Embodiment 1 of this application can be applied to, for example, Figure 1 In this application environment, the server communicates with the database. The server includes, but is not limited to, PDAs, desktop computers, laptops, ultra-mobile personal computers (UMPCs), netbooks, cloud computing devices, and personal digital assistants (PDAs). The database can be implemented using a dedicated server or a server cluster consisting of multiple servers.
[0039] See Figure 2This is a flowchart illustrating a prediction rule generation method based on attribute graph data provided in Embodiment 2 of this application. The aforementioned prediction rule generation method based on attribute graph data is applied to... Figure 1 The server-side component connects to a database to retrieve attribute graph data stored in the database. Additionally, the recommendation model runs on the server-side or is located on a server connected to by the server. In this application, the server-side uses the recommendation logic corresponding to the recommendation model. For example... Figure 2 As shown, the prediction rule generation method based on attribute graph data may include the following steps:
[0040] Step S201: Extract a double star-shaped data from an attribute graph data.
[0041] In this application, the double-star data includes a first type of node and at least one first node path connecting the first type of node, and a second type of node and at least one second node path connecting the second type of node. The first type of node and the second type of node are different node categories, and the nodes on any two node paths do not intersect.
[0042] This binary star data set is generated from attribute data graphs based on a binary star graph pattern. The data consists of nodes and their corresponding labels, attributes, and other information. Specifically, the node path ρ is defined as a list of nodes (x1, ..., x...). i ,…,x s ), x i For the i-th node on the path, (x i ,l i ,x i+1 ) is an edge labeled l, therefore, a star graph S x It consists of a set of node paths (ρ1,…,ρ) centered at node x. j ,…,ρ k Composed of ) and each node path ρ j The starting point of each node is node x. For this star diagram S... x In a star graph S, there are two paths between nodes that have no common nodes except for node x. That is, every node except node x appears only once in a single path. In this case, node x is defined as a star graph. x The center point is defined as the node without outgoing edges (i.e., the last node in the node path), thus forming a "star" shaped data structure.
[0043] Double star data includes two star plots as described above, with star plot S... x And star diagram S y For example, S yThe central point is node y. Nodes x and y are two different types of nodes. Therefore, the paths of nodes belonging to nodes x and y will not intersect. For example, node x can be a user node, representing a user, and node y can be an item node, representing an item.
[0044] This double-star diagram pattern can be defined as... Among them, V Q It is the set of nodes in the pattern, E Q It is the set of edges in the pattern, L Q These are the labels for nodes and edges in the pattern; It is a list of variables, μ, which will be mapped to V. Q The bijective function. x and y are The two specified variables in the diagram represent the center points of two star graphs, respectively. For example, x represents a user and y represents an item. By collecting node paths and representing relevant features using a dual star graph pattern, the diagram ultimately predicts whether user x likes item y.
[0045] To obtain biplanetary data from attribute map data using the aforementioned biplanetary plot pattern, two stages are required: encoding and generation. These two stages are defined and implemented by the corresponding map pattern generator (i.e., the GenQ module). Assume three countably infinite symbol sets, denoted as Γ, Υ, and U, representing labels, attributes, and constants, respectively.
[0046] During the encoding phase, each double star graph pattern can be mapped to a sequence on Γ∪Υ∪{#, *}, where # and * are two new labels that are not in Γ∪Υ (i.e., cannot be repeated with the labels in Γ∪Υ), used to characterize the edges between nodes in the encoding and to distinguish the two star graphs in the encoding.
[0047] Using lexicographical order to define the partial order relation of Γ∪Υ on the sequence, the double star diagram pattern is encoded as ρ1#...ρ i #...ρ s #*ξ1#...ξ i #...ξ t The sequence of #*, where ρ i ξ is the encoding of the node path from node x to the leaf node. i It is the encoding of the node path from node y to the leaf node, and (b) there is no sequence ρ1'#...ρ i '#..ρ. s 'and ξ1'#...ξ i '#...ξ t '# Satisfy ρ1#...ρ i #...ρ s #Lexicographical order is greater than or equal to ρ1'#...ρ i '#...ρs '# and ξ1#...ξ i #..ξ. t # is lexicographically greater than or equal to ξ1'#...ξ i '#...ξ t '#'.
[0048] Among them, for ρ i Or ξ i Let x be a node in the array, and let L(x) be the label. Let the node attributes be A1, A2, ..., A... n Then the encoding of node x is L(x)A1, A2, ..., A n For node x i The edge with label l between the node and the node is encoded as (x i ,l i ,x i+1 ), where x i and x i+1 All are represented by corresponding codes.
[0049] During the generation phase, the GenQ module uses a Long Short-Term Memory (LSTM) network to generate the encoded sequence until it encounters the end symbol "*". In each round of generation, an upper limit α is set on the number of nodes in the binary star data. Therefore, the longest length of the encoded sequence generated by the GenQ module is (α-2)(4+2|Υ|)+2.
[0050] To enable LSTM to generate all possible binary star data and avoid overfitting, given binary star data Q, let p(Q) represent the probability that Q can be generated by LSTM. Then, the GenQ module updates and modifies p(Q) as follows: Where ω is a hyperparameter during LSTM training, |G| α This is an upper bound on the number of binary star data sets Q with at most α nodes. Then, the probability that each binary star data set Q is generated by the GenQ module is at least... It can be guaranteed that after a sufficient number of rounds, the GenQ module has a high probability of generating all binary star data that meet the given requirements.
[0051] Step S202: Based on the preset recommendation model, construct the recommendation model predicate. Based on the preset predicate formula, construct the predicate for the first attribute node in each first node path and the second attribute node in each second node path to obtain at least one candidate logical predicate.
[0052] In this application, the pre-defined recommendation module can be a model trained on a training dataset for any recommendation scenario, used to implement target recommendations for that scenario. The training dataset for that recommendation scenario and the attribute graph data mentioned above should be of the same type, enabling the discovery of prediction rules in this application to better modify the corresponding recommendation model. The recommendation model can be a CF model, a CB model, or a hybrid model, etc.
[0053] For example, if the recommendation model recommends items to users, the bi-star data generated in the attribute graph data should be user star data and item star data, so that rules in the attribute graph data can be discovered, thereby forming prediction rules to correct the recommendation model.
[0054] The predicate of a recommendation model can refer to the predicate representation constructed based on the model's recommendation logic. The predicate representation expresses the recommendation logic in the form of formula encoding. For example, the predicate representation of a recommendation model is as follows:
[0055]
[0056] Where, For the operators ≥ or <, δ∈[0,1], M(x,y) represents the return value corresponding to the probability of recommending y to x. The return value of the recommendation model is a value between [0,1]. Therefore, the predicate of the recommendation model can be M(x,y)≥δ, and its opposite logical predicate is M(x,y)<δ, or the predicate of the recommendation model can be M(x,y)<δ, and its opposite logical predicate is M(x,y)≥δ. When the operator is other, it can be adjusted according to the requirements.
[0057] The preset predicate formula is a predicate representation formula set according to actual needs and the recommendation logic of the recommendation model. It may include components such as variable predicates. The preset predicate formula is used to express the logic between some attributes in the binary star data in the form of formula encoding. Specifically, it expresses the logic of the first attribute node in each first node path and the second attribute node in each second node path to obtain the corresponding candidate logical predicate. The first attribute node and the second attribute node have the same attribute.
[0058] For example, the predicate formula is as follows:
[0059]
[0060] Where, For variable predicates, Let x1 be a constant predicate, y1 be a variable of x, y1 be a variable of y, z be a variable of x∪y, c be a constant value, A be the attribute value of x1, B be the attribute value of y1, and C be the attribute value of z. Here, x1 is the first attribute node, A is the attribute value of the first attribute node, y1 is the second attribute node, and B is the attribute value of the second attribute node. x1 and y1 have the same attribute, making them comparable.
[0061] in addition, It can be any of the operators =, ≠, <, ≤, >, ≥, so that the predicate formed not only supports the semantics of equality, but also other common comparison semantics, and has stronger expressive power.
[0062] In constant predicates, attribute values may be discrete or continuous. Discrete attributes correspond to discrete values, while continuous attributes are generally continuous numerical values. If the attribute value xC of a node is a discrete attribute, then attribute constraints are added for each distinct value. In the candidate list, if xC is a continuous value attribute and a0 < a1 < ... < a t It represents all values of C appearing in the data, with the split point being s. i =(a i-1 +a i If ) / 2, then for each s i Add two constraints to the candidate: zC≤s i and zC>s i .
[0063] Furthermore, the variable predicates mentioned above are limited. Defined only in In the two leaf nodes x1 and y1, each leaf node can carry at most one variable predicate. That is, the variable predicate is only used to compare the attributes of the related leaf nodes in the double star diagram data corresponding to the "link". The above limitation can achieve a balance between complexity and expressive power.
[0064] Step S203: Based on at least one candidate logical predicate, construct at least one candidate predicate combination. For any candidate predicate combination, combine it with the recommendation model predicate to calculate the support and confidence of the candidate predicate combination in the attribute graph data.
[0065] In this application, for the prediction rule to be generated, there are two evaluation metrics: support and confidence. Therefore, it is necessary to calculate the confidence of the corresponding prediction rule for the constructed candidate predicate combination (part of the prediction rule) under the drive of the recommendation model predicate (part of the prediction rule) of the recommendation model, so as to find the prediction rule with high support and confidence, which can be used to improve the accuracy of the recommendation model.
[0066] Support can be used to measure the frequency with which candidate predicate combinations and recommendation model predicate combinations (i.e. prediction rules) can be applied in attribute graph data. Confidence can be used to measure the strength of the association between candidate predicate combinations and recommendation models, that is, the accuracy that can be achieved when using the candidate predicate combination and recommendation model predicate combination for recommendation prediction.
[0067] Candidate predicate combinations are combinations of at least one logical predicate. This process aims to facilitate the discovery of high-quality prediction rules. Recommendation model predicates are used to find datasets within attribute graph data that can be processed by the recommendation model, thus ensuring that candidate predicate combinations execute in a defined direction.
[0068] Steps S202 and S203 can be executed in a predicate generator (i.e., a GenX module), which is equipped with functions such as predicate construction, predicate combination, and predicate filtering, and is connected to the GenQ module mentioned above to realize the discovery of predicate combinations for constructing prediction rules.
[0069] Based on the definitions in the examples above, for prediction rules (TIEs), a It can be represented as:
[0070]
[0071] in, It is a double-star chart pattern, where X is... A set of predicates, which includes at least one logical predicate.
[0072] In one embodiment, calculating the support and confidence of candidate predicate combinations in attribute graph data includes:
[0073] The third matching result that satisfies the candidate predicate combination and the recommendation model predicate is determined from the attribute graph data; the fourth matching result that satisfies the recommendation model predicate is determined from the attribute graph data.
[0074] The support is calculated based on the intersection of the third and fourth matching results.
[0075] The fifth matching result is determined from the attribute graph data, which satisfies the logical predicate that is opposed to the predicate of the recommendation model. The confidence score is obtained by combining the union of the fourth and fifth matching results with the intersection of the third matching result and the support score.
[0076] If a given And an attribute graph data G, using express For all (v,u) recommended in G, (v,u) must satisfy all logical predicates and recommendation model predicates in X in G.
[0077] The training dataset Γ used by the recommendation model during training consists of (v,u) entity pairs in G, where positive samples are (v,u) pairs in G with existing interaction records, and negative samples are (v,u) pairs in G without interaction records. Therefore, the support can be expressed as... as follows:
[0078]
[0079] in, The third matching result is (v,u)|(v,likes,u)∈Γ, and the fourth matching result is (v,u)|(v,likes,u)∈Γ. This support has anti-monotonicity. If the prediction rule has a partial order relation, then... and If Q is a subgraph of Q′, and all predicates in X are contained in X′, then
[0080] Confidence level can be expressed as as follows:
[0081]
[0082] Where (v,u)|(v,unlikes,u)∈Γ represents the fifth matching result, and τ represents likes or unlikes. Prediction rules with high confidence help reduce FPs and FNs in the recommendation model.
[0083] Step S204: Determine the candidate predicate combinations that meet the preset conditions in terms of support and confidence as target predicate combinations, and fuse each target predicate combination with the predicate of the recommendation model to obtain the fusion result as the prediction rule of the optimized recommendation model.
[0084] In this application, if both the support and confidence scores meet preset conditions, the corresponding candidate predicate combination can be determined as the final target predicate combination. The target predicate combination that meets the preset conditions may be one or more; in actual use, the number of target predicate combinations is determined according to the requirements. Furthermore, if only one target predicate combination is selected, the support and confidence scores of all target predicate combinations that meet the preset conditions can be compared, and the target predicate combination with the highest support and confidence score can be retained.
[0085] The preset condition can be a preset threshold. Support has a preset support threshold, and confidence has a preset confidence threshold. If the support is greater than the preset support threshold, the support meets the preset condition. If the confidence is greater than the preset confidence threshold, the confidence meets the preset condition.
[0086] The target predicate combination is fused with the recommendation model predicate of the above recommendation model to obtain the final prediction rule. This prediction rule is an optimization of the recommendation rule of the recommendation model. If the direction of the recommendation model predicate is the recommendation direction, the prediction rule after adding the target predicate combination can further limit the recommendation rule to reduce the misjudgment of recommendation. If the direction of the recommendation model predicate is the non-recommendation direction, the prediction rule after adding the target predicate combination can supplement the recommendation of the scope of the non-recommendation rule to reduce the misjudgment of non-recommendation.
[0087] Taking the encoding method defined above as an example, for The predefined rule is as follows: M(x,y)≥δ is the predicate of the recommendation model, and X is the combination of logical predicates. When the recommendation model suggests recommending item y to user x (i.e., M(x,y)≥δ), the logical condition X is added to filter FPs (i.e., to re-filter the recommendations of the recommendation model and correct the erroneous predictions of the original recommendations). In other words, item y will only be recommended to user x if both M(x,y)≥δ and X are true.
[0088] For example, regarding The prediction rule is defined as follows: M(x,y)<δ is the predicate of the recommendation model, and X is the combination of logical predicates. When the recommendation model does not recommend item y to user x (i.e., M(x,y)<δ)), but the additional logical condition X is satisfied, item y will still be recommended to user x. This rule helps reduce the FNs of the recommendation model (i.e., it supplements the recommendation model's recommendations and can correct the original incorrect prediction of not recommending).
[0089] For example, taking users and performance tickets as examples, where users correspond to x as mentioned above and performance tickets correspond to y as mentioned above, the GenQ module uses LSTM to discover binary star data and encode the binary star data by analyzing the node paths of user-class nodes and item-class nodes such as performance tickets in the attribute graph data G. For example, the encoded expression of a binary star data is "user, book, flight ticket, destination#user, buy, theater ticket, generation#*theaterticket, location, city, name#theater ticket, of, generation, name#*", where user is the central node x, theater ticket is the central node y, book and buy can be represented as edges, that is, edges connecting the user node to the flight ticket node or the theater ticket node, destination, generation, name, etc. correspond to the attribute information of the nodes, and each attribute information can correspond to an attribute value.
[0090] If the predicate of the recommendation model is M(x,y)≥0.7, then the obtained prediction rule aims to reduce the FPs of the recommendation model. Based on the above biplane data, candidate predicate combinations are constructed. First, candidate predicate combinations containing all variable and constant predicates need to be constructed, such as x1.destination=y1.name, x1.destination≠y1.name, x2.genre=y2.name, x2.genre≠y2.name, etc. Where LA is the attribute value of destination appearing in G, and History is the attribute value of generation appearing in G. Then, the Gini index of all these logical predicates is calculated, and the one with the smallest index is selected as the first predicate to be chosen, assuming it is 1.
[0091] Given x1.destination = y1.name, we add another logical predicate and calculate the Gini index. We select the predicate combination with the smallest Gini index, resulting in the predicate combination X: x1.destination = y1.name ∧ x2.genre = y2.name. This predicate combination X satisfies both support and confidence. We then combine this predicate combination X with M(x,y)≥0.7 to form a TIE, as follows:
[0092]
[0093] X:x1.destination=y1.name∧x2.genre=y2.name
[0094] The explanation for the above scenario is as follows: Although user x has previously purchased tickets for a live theater, if user x has already booked a flight to a city different from the performance location, or if the performance does not match the user's purchase history preferences, then the upcoming performance ticket y cannot be recommended to user x. The recommendation model ignores this context-aware feature and may generate incorrect recommendations with a high probability, thus generating FPs.
[0095] This application embodiment extracts a double-star data from an attribute graph data. Based on a preset recommendation model, recommendation model predicates are constructed. Based on a preset predicate formula, predicates are constructed for the first attribute node in each first node path and the second attribute node in each second node path in the double-star data, resulting in at least one candidate logical predicate. Based on at least one candidate logical predicate, at least one candidate predicate combination is constructed. For any candidate predicate combination, combined with the recommendation model predicates, the support and confidence of the candidate predicate combination in the attribute graph data are calculated. Candidate predicates whose support and confidence both meet preset conditions are determined. Word combinations are used as target predicate combinations. Each target predicate combination is fused with the predicates of the recommendation model to obtain the fusion result as the prediction rule of the optimized recommendation model. By analyzing the extracted biplane data, logical predicates representing the attribute relationships between data are formed, which can effectively discover the correlation between attributes. Then, the logical predicates are combined and filtered in combination with support and confidence to obtain optimized predicate combinations, i.e., accurate correlations. These are combined with the recommendation logic of the recommendation model to obtain high-quality prediction rules. Thus, when the recommendation model is used, the positive and negative errors of the recommendation results are optimized, and the accuracy of the recommendation model is improved.
[0096] See Figure 3 This is a flowchart illustrating a prediction rule generation method based on attribute graph data provided in Embodiment 3 of this application. Figure 3 As shown, a further improvement to step S203 may include the following steps:
[0097] Step S301: Based on the first matching result of each candidate logical predicate in the attribute graph data, calculate the Gini index of the corresponding candidate logical predicate, and take the candidate logical predicate with the smallest Gini index as the initial predicate combination.
[0098] In this application, before constructing candidate predicate combinations, it is necessary to determine the effect that each candidate logical predicate can achieve when used as a logical constraint. The effect is judged by the Gini index, which is an effective standard for measuring the extent to which a predicate can divide a set of data into different categories.
[0099] In the attribute graph data, data matching is performed based on each candidate logical predicate. This data matching generates corresponding binary star data. It is then determined whether the binary star data satisfies the corresponding candidate logical predicate. All matching results are used to calculate the Gini index of the candidate logical predicate.
[0100] The formula for calculating the Gini index is as follows:
[0101] Gini(G) = 1 - f1 2 -f2 2
[0102] In the formula, f1 represents the proportion of matching samples in G, f2 represents the proportion of non-matching samples in G, and G is the attribute graph data mentioned above. A smaller Gini index indicates that the corresponding candidate logical predicate can better classify the data, thus achieving better results.
[0103] Step S302: Using the initial predicate combination as a candidate predicate combination, calculate the support and confidence of the candidate predicate combination in the attribute graph data based on the candidate predicate combination and the recommendation model predicate.
[0104] In this application, during the current round of screening, the candidate logical predicate with the smallest Gini index is selected. This candidate logical predicate is then combined with the recommendation model predicate to calculate its support and confidence in the attribute graph data. Steps S301 and S302 described above can be executed within the GenX module given in step S203.
[0105] In this embodiment, the GenX module uses the Gini index to select logical predicates during the predicate generation stage, thereby achieving pruning and screening of candidate predicate combinations, reducing the level-wise search space, and improving the efficiency of prediction rule discovery.
[0106] See Figure 4 This is a flowchart illustrating a prediction rule generation method based on attribute graph data provided in Embodiment 4 of this application. Figure 4 As shown, after step S302 above, the prediction rule generation method further includes the following steps:
[0107] Step S401: Check whether the support and confidence both meet the preset conditions. If the support or confidence does not meet the preset conditions, add another logical predicate to the initial predicate combination to obtain an updated predicate combination.
[0108] In this application, other logical predicates are any logical predicates that do not appear in the initial predicate combination among at least one candidate logical predicates. That is, if the support and confidence of the above candidate predicate combination in the attribute graph data do not meet expectations, then a new candidate predicate combination needs to be sought.
[0109] Add other logical predicates that are not in the original initial predicate combination to the initial predicate combination to form a new predicate combination. If there are n other logical predicates, add them one by one to the initial predicate combination to form an updated predicate combination of n.
[0110] Step S402: Calculate the Gini index of each updated predicate combination, select the updated predicate combination with the smallest Gini index from all updated predicate combinations, and use the updated predicate combination as the initial predicate combination.
[0111] In this application, the Gini index is calculated for each updated predicate combination to prune the updated predicate combinations and improve the efficiency of predicate combination selection. The calculation of the Gini index for the updated predicate combination can refer to the calculation method in step S301 above. Of course, to reduce computational load and resource consumption, the calculation of the Gini index can be performed based on the processing results of the initial predicate combinations, as detailed in Embodiment Five below.
[0112] Step S403: Return to the execution of the step of taking the initial predicate combination as a candidate predicate combination, and calculating the support and confidence of the candidate predicate combination in the attribute graph data based on the candidate predicate combination and the recommendation model predicate, until the support and confidence both meet the preset conditions or the iteration reaches the preset number of times.
[0113] In this application, candidate predicate combinations are constructed iteratively, and support and confidence are calculated, so that the candidate predicate combinations can be continuously screened to obtain the required candidate predicate combinations that meet certain conditions.
[0114] During the iterative process, more than one candidate predicate combination with support and confidence scores that meet the preset conditions can be generated, thus obtaining high-quality or even higher-quality prediction rules under certain circumstances. For example, in the first round, a predicate combination X1 with support and confidence scores that meet the preset conditions is found. To obtain a higher-quality predicate combination, the second round of operation is performed, adding p1 to the predicate combination X1 to form a new predicate combination X1+p1. If the support and confidence scores of X1+p1 meet the preset conditions, then the predicate combination X2 = X1+p1 is found.
[0115] This process can be used to train the GenQ module, which is based on an LSTM model. The parameters in the LSTM model require training with a corresponding training set. Specifically, after each round, the GenX module returns a high-quality predicate combination that meets preset conditions to the GenQ module. The GenQ module then uses this high-quality predicate combination to continue adjusting and training the LSTM model, so that it can generate even higher-quality predicate combinations in the next round.
[0116] The training of the GenQ module described above is as follows:
[0117] Input: Attribute graph data G, training dataset Γ, number of iterations I, recommendation model, preset support threshold r1, preset confidence threshold r2, number of nodes α in the binary star data.
[0118] Output: at least one The requirement is Req(r1,r2,α), i.e. and There are at most α nodes.
[0119] Using the scheme described in Example 4 above, iterative training is performed, with the GenQ and GenX modules working alternately. In each round, the GenQ module first trains an LSTM model to generate binary star data Q and the important attributes of each node in Q. Then, the GenX module constructs candidate predicate combinations from the important attributes selected by the GenQ module, and then selects and generates predicate combinations X related to Q, which are combined with Q to generate a set of TIEs. At the end of each iteration, the GenX module evaluates the quality of the generated TIEs by support and confidence, retains high-quality TIEs that meet the threshold, and feeds them back to the GenQ module. The GenQ module updates the LSTM parameters for optimization, generating more high-quality TIEs in subsequent rounds until the number of iterations reaches I. Using a feedback method, the GenX module returns high-quality TIEs to the GenQ module to guide its LSTM parameter adjustment, enabling it to generate more high-quality binary star data in the next round.
[0120] After a sufficient number of rounds, there is a high probability of finding all predicate combinations that meet the given requirements. The GenQ module can generate all possible biplanetary datasets, while the GenX module can examine all predicate combinations under the condition Req(r1,r2,α). Given a graph G and a training dataset Γ, given the requirement Req(r1,r2,α) and a constant ξ∈(0,1), if there exists a set Σ that meets Req(r1,r2,α)... T After I rounds, the GenX module has at least a 1-∈ probability of discovering the set Σ. TBased on all TIEs, the bound of the iteration number I can be derived from the Chernoff bound, as shown in the following formula:
[0121]
[0122] In the formula, k and ω are two hyperparameters of the GenQ module.
[0123] See Figure 5 This is a flowchart illustrating a prediction rule generation method based on attribute graph data provided in Embodiment 5 of this application. Figure 5 As shown, the process of calculating the Gini index for each updated predicate combination in step S402 above may include the following steps:
[0124] Step S501: Obtain the second matching result in the attribute graph data that satisfies the initial predicate combination.
[0125] In this application, the matching result of the initial predicate combination has already been executed in the previous steps. For example, when the initial predicate combination is any candidate logical predicate in step S301, the updated predicate combination is based on the candidate logical predicate with the addition of other logical predicates. When calculating the updated predicate combination, the candidate logical predicate has already been matched and there is a corresponding matching result. The matching result can be retained for use in subsequent processing.
[0126] Step S502: For any updated predicate combination, determine the first data that satisfies the updated predicate combination and the second data that does not satisfy the updated predicate combination from the second matching result.
[0127] Step S503: Calculate the Gini index of the corresponding updated predicate combination based on the second matching result, the first data, and the second data.
[0128] In this application, the calculation of the Gini index of the updated predicate combination can be obtained based on the second matching result mentioned above. Specifically, it is necessary to obtain the data of the updated predicate combination that meets and does not meet the requirements in the second matching result, and then combine it with the corresponding calculation formula to obtain the Gini index of the updated predicate combination.
[0129] For example, given an existing X (i.e., the initial predicate combination), to add a new predicate p, the formula for calculating the Gini index is as follows:
[0130] Gini_index(X,p)=|D1|Gini(D1) / |D|+|D2|Gini(D2) / |D|
[0131] In the formula, D represents all matching results in the attribute graph data that satisfy X, D1 represents all results in D that satisfy X^p, and D2 represents all results in D that do not satisfy X^p. The classification effect after adding the p constraint to X shows that a predicate p with a smaller Gini index can better distinguish between positive and negative samples.
[0132] Based on existing matching results, this application's embodiments perform Gini index calculation, avoiding re-matching all updated predicate combinations, reducing resource consumption and improving computational efficiency.
[0133] Based on this, each time GenX is used, the predicate p with the smallest Gini index is selected and added to form a new predicate combination. We can quickly find multiple predicate combinations to form new high-quality TIEs with the pattern, thereby reducing FPs and FNs. Furthermore, this also allows our TIEs to have as few predicates as possible, making them easier to interpret.
[0134] See Figure 6 This is a flowchart illustrating a prediction rule generation method based on attribute graph data provided in Embodiment Six of this application. Figure 6 As shown, in one embodiment of step S203 of Example 2, the process of determining the third matching result from the attribute graph data that satisfies the candidate predicate combination and the recommendation model predicate may include the following steps:
[0135] Step S601: Determine the node pairs consisting of the first type of nodes and the second type of nodes that satisfy the candidate predicate combination and the recommendation model predicate from the attribute graph data, and determine the bi-star data corresponding to each node pair.
[0136] In this application, for candidate predicate combinations and recommendation model predicates, node pairs formed by first-type nodes and second-type nodes that satisfy both can be determined in the attribute graph data. The first-type node pair corresponds to its own star data, and the second-type node pair corresponds to its own star data, thus forming a double star data corresponding to the node pair.
[0137] In this process, the GenQ module described in the above embodiments is required to generate the corresponding binary star data. Then, it is determined whether each binary star data satisfies the above candidate predicate combination and recommendation model predicate, thereby determining the binary star data that satisfies the requirements.
[0138] Step S602: Compress the corresponding binary star data for each node to obtain the compressed representation result, and determine the binary star data that is not an empty set in the compressed representation result as the third matching result.
[0139] In this application, compressed representation involves merging all matching results of any node in any binary star data except for the first and second type nodes. If any node is an empty set, then the compressed representation result of the corresponding binary star data is determined to be an empty set. Using compressed representation can reduce the storage amount of binary star data, thereby helping to reduce resource waste. At the same time, it helps to improve the efficiency of subsequent calculation of support and confidence using the third matching result.
[0140] For example, regarding the double-star data in step S201 After predicate discovery, candidate predicate combinations and recommendation model predicates are obtained. The matching result in the attribute graph data G is represented as Q[v,u,X], where the matching maps x to v and y to u. If In addition to the central nodes x and y, there are m nodes. Therefore, the compressed representation of the matching result Q[v,u,X] can be in the form of m tuples, where the m tuples are (C(x1),...,C(x...)). i ),...,C(x m C(x) i Let ) be one of the elements, C(x) i This can be represented as:
[0141]
[0142] C(x i ) storage node x i All matching results, if each C(x) i If none of the following sets are empty, then Q[v,u,X] is not empty. Therefore, without calculating every specific matching result, we only need to calculate Q[v,u,X] to obtain the support and confidence, thus Q[v,u,X] can be calculated in O(|Q||G|) time complexity, reducing the computation time.
[0143] See Figure 7 This is a flowchart illustrating a prediction rule generation method based on attribute graph data provided in Embodiment 7 of this application. Figure 7 As shown, when a candidate predicate combination is detected as being obtained by adding a logical predicate to an original predicate combination (i.e., the candidate predicate combination for obtaining the third matching result is obtained by adding a logical predicate), in one embodiment of step S203 of Example 2, the process of determining the third matching result that satisfies the candidate predicate combination and the recommendation model predicate from the attribute graph data may include the following steps:
[0144] Step S701: Obtain the historical matching results obtained when calculating the corresponding support of the original predicate combination.
[0145] Step S702: Determine the matching result that satisfies the added logical predicate from the historical matching results as the third matching result.
[0146] In this application, if the support is calculated for the current candidate predicate combination, the current candidate predicate combination is obtained by adding a logical predicate to an original predicate combination. For example, adding a logical predicate p to the original predicate combination X results in a new predicate combination X+p, which is the current candidate predicate combination.
[0147] Since the original predicate combination and the recommendation model predicates were already matched in the previous round of calculation, meaning the original predicate combination has historical matching results, the data in these historical matching results that satisfy the added logical predicate is the third matching result. Therefore, there is no need to match the candidate predicate combination in the attribute graph data, thus reducing computational load. Specifically, during the matching process, the matching result of the node containing the added logical predicate is first updated. Then, the matching results of all nodes along the node path are updated. During each update, it is necessary to check whether each node satisfies the homomorphic semantic requirement.
[0148] The above process is a dynamic maintenance process. Due to the limitations of the star topology, the newly added 'p' only affects the matching results of the path of the node it belongs to, and thus affects the matching results of the central node. Through the designed incremental algorithm, the matching results are calculated incrementally from historical matching results, eliminating the need to recalculate the matching results of all other node paths, thus reducing the computational load.
[0149] Corresponding to the prediction rule generation method based on attribute graph data in the above embodiment, Figure 8 This paper shows a structural block diagram of a prediction rule generation device based on attribute graph data provided in Embodiment 8 of this application. The prediction rule generation device is applied to... Figure 1 The database in the document can be a database connected to a financial system. This database supports retrieval by clients corresponding to the financial system, providing relevant data. The client, through appropriate functional components, collects user-provided search data and, based on this data, retrieves search results from the database. For ease of explanation, only the parts relevant to the embodiments of this application are shown.
[0150] See Figure 8 The prediction rule generation device includes:
[0151] The pattern data generation module 81 is used to extract a double star data from an attribute graph data. The double star data includes a first type of node and at least one first node path connecting the first type of node, as well as a second type of node and at least one second node path connecting the second type of node. The first type of node and the second type of node are different node categories, and the nodes on any two node paths do not intersect.
[0152] The predicate construction module 82 is used to construct recommendation model predicates based on the preset recommendation model. Based on the preset predicate formula, it constructs predicates for the first attribute data in each first node path and the second attribute data in each second node path to obtain at least one candidate logical predicate. The first attribute data and the second attribute data have the same attribute.
[0153] The indicator calculation module 83 is used to construct at least one candidate predicate combination based on at least one candidate logical predicate, and for any candidate predicate combination, combine the recommendation model predicate to calculate the support and confidence of the candidate predicate combination in the attribute graph data.
[0154] The prediction rule determination module 84 is used to determine the candidate predicate combinations that meet the preset conditions in terms of support and confidence as the target predicate combinations. Each target predicate combination is fused with the predicates of the recommendation model to obtain the fusion result as the prediction rule for optimizing the recommendation model.
[0155] Optionally, the indicator calculation module 83 includes:
[0156] The index calculation unit is used to calculate the Gini index of the corresponding candidate logical predicate based on the first matching result of each candidate logical predicate in the attribute graph data, and to take the candidate logical predicate with the smallest Gini index as the initial predicate combination.
[0157] The indicator calculation unit is used to calculate the support and confidence of the candidate predicate combination in the attribute graph data, based on the initial predicate combination as a candidate predicate combination and the predicate of the recommendation model.
[0158] Optionally, the prediction rule generation device further includes:
[0159] The indicator detection module is used to calculate the support and confidence of the candidate predicate combination in the attribute graph data based on the candidate predicate combination and the recommendation model predicate, and then detect whether the support and confidence both meet the preset conditions. If the support or confidence does not meet the preset conditions, an other logical predicate is added to the initial predicate combination to obtain an updated predicate combination. The other logical predicate is any logical predicate that does not appear in the initial predicate combination among at least one candidate logical predicate.
[0160] The update calculation module is used to calculate the Gini index of each updated predicate combination, select the updated predicate combination with the smallest Gini index from all updated predicate combinations, and use the updated predicate combination as the initial predicate combination.
[0161] The return execution module is used to return to the execution steps of taking the initial predicate combination as a candidate predicate combination, calculating the support and confidence of the candidate predicate combination in the attribute graph data based on the candidate predicate combination and the recommendation model predicate, until the support and confidence both meet the preset conditions or the iteration reaches the preset number of times.
[0162] Optionally, update the computing module, including:
[0163] The matching result acquisition unit is used to acquire the second matching result in the attribute graph data that satisfies the initial predicate combination;
[0164] The data extraction unit is used to determine, for any updated predicate combination, first data that satisfies the updated predicate combination and second data that does not satisfy the updated predicate combination from the second matching result;
[0165] The update index calculation unit is used to calculate the Gini index of the corresponding updated predicate combination based on the second matching result, the first data, and the second data.
[0166] Optionally, the indicator calculation module 83 includes:
[0167] The matching result determination unit is used to determine the third matching result that satisfies the candidate predicate combination and the recommendation model predicate from the attribute graph data, and to determine the fourth matching result that satisfies the recommendation model predicate from the attribute graph data.
[0168] The support calculation unit is used to calculate the support based on the intersection of the third and fourth matching results.
[0169] The confidence calculation unit is used to determine the fifth matching result from the attribute graph data that satisfies the logical predicate that is opposed to the predicate of the recommendation model. Based on the intersection of the union of the fourth and fifth matching results and the third matching result, and combined with the support, the confidence score is obtained.
[0170] Optionally, the matching result determination unit includes:
[0171] The data matching subunit is used to determine the first and second type of nodes that satisfy the candidate predicate combination and the recommendation model predicate from the attribute graph data, and to determine the bi-star data corresponding to each node pair.
[0172] The matching result compression subunit is used to compress the corresponding binary star data for each node to obtain the compressed representation result. The binary star data that is not an empty set in the compressed representation result is determined as the third matching result. The compressed representation is to merge all the matching results of any node in any binary star data except for the first type of node and the second type of node. If any node is an empty set, the compressed representation result of the corresponding binary star data is determined to be an empty set.
[0173] Optionally, if a candidate predicate combination is detected as being obtained by adding a logical predicate to an original predicate combination, then the matching result determination unit includes:
[0174] The history matching acquisition sub-unit is used to obtain the historical matching results obtained when calculating the corresponding support of the original predicate combination;
[0175] The dynamic matching subunit is used to determine the third matching result from the historical matching results if the added logical predicate is satisfied.
[0176] It should be noted that the information interaction and execution process between the above modules are based on the same concept as the method embodiments of this application. For details on their specific functions and technical effects, please refer to the method embodiments section, which will not be repeated here.
[0177] Figure 9 This is a schematic diagram of the structure of a computer device provided in Embodiment 9 of this application. Figure 9 As shown, the computer device of this embodiment includes: at least one processor ( Figure 9 Only one is shown in the diagram), a memory, and a computer program stored in the memory and capable of running on at least one processor. When the processor executes the computer program, it implements the steps in any of the above embodiments of the prediction rule generation method based on attribute graph data.
[0178] This computer device may include, but is not limited to, a processor and memory. Those skilled in the art will understand that... Figure 9 The examples of computer devices are merely examples and do not constitute a limitation on computer devices. Computer devices may include more or fewer components than shown in the illustration, or combinations of certain components, or different components, such as network interfaces, displays, and input devices.
[0179] The processor referred to can be a CPU, but it can also be other general-purpose processors, digital signal processors (DSPs), application-specific integrated circuits (ASICs), field-programmable gate arrays (FPGAs), or other programmable logic devices, discrete gate or transistor logic devices, discrete hardware components, etc. A general-purpose processor can be a microprocessor or any conventional processor.
[0180] Memory includes readable storage media, internal memory, etc., wherein internal memory can be the RAM of a computer device, providing an environment for the operation of the operating system and computer-readable instructions stored in the readable storage media. The readable storage media can be the hard drive of a computer device, or in other embodiments, it can be an external storage device of the computer device, such as a plug-in hard drive, Smart Media Card (SMC), Secure Digital (SD) card, or Flash Card. Furthermore, memory can include both internal storage units and external storage devices of a computer device. Memory is used to store the operating system, applications, bootloader, data, and other programs, such as program code for computer programs. Memory can also be used to temporarily store data that has been output or will be output.
[0181] Those skilled in the art will clearly understand that, for the sake of convenience and brevity, the above-described division of functional units and modules is used as an example. In practical applications, the above functions can be assigned to different functional units and modules as needed, that is, the internal structure of the device can be divided into different functional units or modules to complete all or part of the functions described above. The functional units and modules in the embodiments can be integrated into one processing unit, or each unit can exist physically separately, or two or more units can be integrated into one unit. The integrated unit can be implemented in hardware or as a software functional unit. Furthermore, the specific names of the functional units and modules are only for easy differentiation and are not intended to limit the scope of protection of this application. The specific working process of the units and modules in the above device can be referred to the corresponding process in the foregoing method embodiments, and will not be repeated here. If the integrated unit is implemented as a software functional unit and sold or used as an independent product, it can be stored in a computer-readable storage medium. Based on this understanding, all or part of the processes in the methods of the above embodiments of this application can be implemented by a computer program instructing related hardware. The computer program can be stored in a computer-readable storage medium, and when executed by a processor, it can implement the steps of the above method embodiments. The computer program includes computer program code, which can be in the form of source code, object code, executable files, or certain intermediate forms. A computer-readable medium can include at least: any entity or device capable of carrying computer program code, a recording medium, a computer memory, read-only memory (ROM), random access memory (RAM), electrical carrier signals, telecommunication signals, and software distribution media. Examples include USB flash drives, portable hard drives, magnetic disks, or optical disks. In some jurisdictions, according to legislation and patent practice, computer-readable media cannot be electrical carrier signals or telecommunication signals.
[0182] The implementation of all or part of the processes in the methods of the above embodiments can also be accomplished by a computer program product. When the computer program product is run on a computer device, it enables the computer device to execute the steps in the above method embodiments.
[0183] In the above embodiments, the description of each embodiment has its own focus. For parts that are not described or recorded in detail in a certain embodiment, reference can be made to the relevant description of other embodiments.
[0184] Those skilled in the art will recognize that the units and algorithm steps of the various examples described in conjunction with the embodiments disclosed herein can be implemented in electronic hardware, or a combination of computer software and electronic hardware. Whether these functions are implemented in hardware or software depends on the specific application and design constraints of the technical solution. Those skilled in the art can use different methods to implement the described functions for each specific application, but such implementation should not be considered beyond the scope of this application.
[0185] In the embodiments provided in this application, it should be understood that the disclosed apparatus / computer devices and methods can be implemented in other ways. For example, the apparatus / computer device embodiments described above are merely illustrative. For instance, the division of modules or units is only a logical functional division, and in actual implementation, there may be other division methods. For example, multiple units or components may be combined or integrated into another system, or some features may be ignored or not executed. Furthermore, the coupling or direct coupling or communication connection shown or discussed may be through some interfaces; the indirect coupling or communication connection between apparatuses or units may be electrical, mechanical, or other forms.
[0186] The units described as separate components may or may not be physically separate. The components shown as units may or may not be physical units; that is, they may be located in one place or distributed across multiple network units. Some or all of the units can be selected to achieve the purpose of this embodiment according to actual needs.
[0187] The above embodiments are only used to illustrate the technical solutions of this application, and are not intended to limit them. Although this application has been described in detail with reference to the foregoing embodiments, those skilled in the art should understand that modifications can still be made to the technical solutions described in the foregoing embodiments, or equivalent substitutions can be made to some of the technical features. Such modifications or substitutions do not cause the essence of the corresponding technical solutions to deviate from the spirit and scope of the technical solutions of the embodiments of this application, and should all be included within the protection scope of this application.
Claims
1. A method for generating prediction rules based on attribute graph data, characterized in that, The prediction rule generation method includes: A double star data is extracted from an attribute graph data. The double star data includes a first type of node and at least one first node path connecting the first type of node, and a second type of node and at least one second node path connecting the second type of node. The first type of node and the second type of node are different node categories, and the nodes on any two node paths do not intersect. Based on the preset recommendation model, a recommendation model predicate is constructed. Based on the preset predicate formula, predicates are constructed for the first attribute node in each first node path and the second attribute node in each second node path to obtain at least one candidate logical predicate. The first attribute node and the second attribute node have the same attribute. Based on the at least one candidate logical predicate, at least one candidate predicate combination is constructed. For any candidate predicate combination, combined with the recommendation model predicate, the support and confidence of the candidate predicate combination in the attribute graph data are calculated. Candidate predicate combinations that satisfy both the support and confidence scores are identified as target predicate combinations. Each target predicate combination is then fused with the predicates of the recommendation model to obtain the fusion result, which is used to optimize the prediction rule of the recommendation model.
2. The prediction rule generation method according to claim 1, characterized in that, The step of constructing at least one candidate predicate combination based on the at least one candidate logical predicate, and calculating the support and confidence of the candidate predicate combination in the attribute graph data for any candidate predicate combination in conjunction with the recommendation model predicate, includes: Based on the first matching result of each candidate logical predicate in the attribute graph data, the Gini index of the corresponding candidate logical predicate is calculated, and the candidate logical predicate with the smallest Gini index is taken as the initial predicate combination. Using the initial predicate combination as a candidate predicate combination, the support and confidence of the candidate predicate combination in the attribute graph data are calculated based on the candidate predicate combination and the recommendation model predicate.
3. The prediction rule generation method according to claim 2, characterized in that, After calculating the support and confidence of the candidate predicate combination in the attribute graph data based on the candidate predicate combination and the recommendation model predicate, the method further includes: The system checks whether the support and confidence both meet the preset conditions. If the support or confidence does not meet the preset conditions, an additional logical predicate is added to the initial predicate combination to obtain an updated predicate combination. The additional logical predicate is any logical predicate among the at least one candidate logical predicate that does not appear in the initial predicate combination. Calculate the Gini index of each updated predicate combination, select the updated predicate combination with the smallest Gini index from all updated predicate combinations, and use the updated predicate combination as the initial predicate combination. Return to the execution of the steps of taking the initial predicate combination as a candidate predicate combination, and calculating the support and confidence of the candidate predicate combination in the attribute graph data based on the candidate predicate combination and the recommendation model predicate, until the support and the confidence both meet the preset conditions or the iteration reaches the preset number of times.
4. The prediction rule generation method according to claim 3, characterized in that, The calculation of the Gini index for each updated predicate combination includes: Obtain the second matching result from the attribute graph data that satisfies the initial predicate combination; For any updated predicate combination, determine from the second matching result the first data that satisfies the updated predicate combination and the second data that does not satisfy the updated predicate combination; Based on the second matching result, the first data, and the second data, the Gini index corresponding to the updated predicate combination is calculated.
5. The prediction rule generation method according to any one of claims 1 to 4, characterized in that, The calculation of the support and confidence of the candidate predicate combination in the attribute graph data includes: A third matching result is determined from the attribute graph data that satisfies the candidate predicate combination and the recommendation model predicate; a fourth matching result is determined from the attribute graph data that satisfies the recommendation model predicate. The support is calculated based on the intersection of the third matching result and the fourth matching result; The fifth matching result is determined from the attribute graph data, which satisfies the logical predicate that is opposed to the predicate of the recommendation model. The confidence score is obtained by combining the intersection of the union of the fourth and fifth matching results and the third matching result with the support score.
6. The prediction rule generation method according to claim 5, characterized in that, The step of determining the third matching result from the attribute graph data that satisfies the candidate predicate combination and the recommendation model predicate includes: From the attribute graph data, determine the first type of nodes and the second type of nodes that satisfy the candidate predicate combination and the recommendation model predicate, and determine the double star data corresponding to each node pair; For each node, the corresponding binary star data is compressed to obtain a compressed representation result. The binary star data that is not an empty set in the compressed representation result is determined as the third matching result. The compressed representation is to merge all matching results of any node in any binary star data except for the first type of node and the second type of node. If any node is an empty set, the compressed representation result of the corresponding binary star data is determined to be an empty set.
7. The prediction rule generation method according to claim 5, characterized in that, If it is detected that the candidate predicate combination is obtained by adding a logical predicate to an original predicate combination, then the step of determining the third matching result from the attribute graph data that satisfies the candidate predicate combination and the recommendation model predicate includes: Obtain the historical matching results obtained when calculating the corresponding support of the original predicate combination; The matching result that satisfies the added logical predicate in the historical matching results is determined as the third matching result.
8. A prediction rule generation device based on attribute graph data, characterized in that, The prediction rule generation device includes: The pattern data generation module is used to extract a double star data from an attribute graph data. The double star data includes a first type of node and at least one first node path connecting the first type of node, and a second type of node and at least one second node path connecting the second type of node. The first type of node and the second type of node are different node categories, and the nodes on any two node paths do not intersect. The predicate construction module is used to construct recommendation model predicates based on a preset recommendation model. Based on the preset predicate formula, it constructs predicates for the first attribute data in each first node path and the second attribute data in each second node path to obtain at least one candidate logical predicate. The first attribute data and the second attribute data have the same attribute. The indicator calculation module is used to construct at least one candidate predicate combination based on the at least one candidate logical predicate, and for any candidate predicate combination, in combination with the recommendation model predicate, calculate the support and confidence of the candidate predicate combination in the attribute graph data; The prediction rule determination module is used to determine the candidate predicate combinations that both the support and the confidence satisfy preset conditions as target predicate combinations, and to fuse each target predicate combination with the predicate of the recommendation model to obtain the fusion result as the prediction rule for optimizing the recommendation model.
9. A computer device, characterized in that, The computer device includes a processor, a memory, and a computer program stored in the memory and executable on the processor, wherein the processor executes the computer program to implement the prediction rule generation method as described in any one of claims 1 to 7.
10. A computer-readable storage medium storing a computer program, characterized in that, When the computer program is executed by a processor, it implements the prediction rule generation method as described in any one of claims 1 to 7.