A user preference prediction method and system based on data causal diagram and counterfactual reasoning, and a storage medium

By constructing data causal graphs and counterfactual reasoning, the scoring calculation process is optimized, solving the problem of insufficient consideration of item text information in existing technologies, and improving the fairness and accuracy of the recommendation system.

CN119782623BActive Publication Date: 2025-10-10HARBIN INST OF TECH
View PDF 2 Cites 0 Cited by

Patent Information

Application Number
CN202411979263.1
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2024-12-31
Publication Date
2025-10-10
Estimated Expiration
2044-12-31

AI Technical Summary

Technical Problem

The existing scoring formula does not fully consider the item text information, and the scoring generation process lacks targeted debiasing operations, which may pass the model's inherent bias to the final recommendation results.

Method used

Construct a data causal graph, perform intervention operations through the large model's sequential recommendation model, calculate the matching degree in the real world and the counterfactual world, introduce the hyperparameter λ2 to control the impact of text information on the results, and generate the final prediction scoring formula.

Benefits of technology

The causal relationship between text features, user behavior sequences and scoring results is clarified, the scoring calculation process is optimized, the fairness and accuracy of the recommendation results are improved, and the unnecessary interference of text attributes on sequence attributes is eliminated.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN119782623B_ABST
    Figure CN119782623B_ABST
Patent Text Reader

Abstract

The application discloses a user preference prediction method and system based on a data causal diagram and counterfactual reasoning and a storage medium, relates to the field of behavior sequence recommendation, and aims to solve the problems that an existing scoring formula does not fully consider item text information and lacks targeted deviation elimination operation, and that inherent deviation of a model is possibly transmitted to a final recommendation result. The application comprises the following steps: step 1, collecting user-item interaction and item text data; step 2, constructing a large model, constructing a data causal diagram based on sequence recommendation of the large model, constructing a counterfactual world through intervention operation, and performing scoring prediction; the matching degree of a sequence and an item in a real world and a counterfactual world is calculated, the joint feature matching degree of item text and the sequence in the real world and the counterfactual world is calculated, the matching degree of text information and the sequence is calculated, a hyperparameter lambda 2 is introduced to control the influence scale of the text information on a result, and a final prediction scoring formula is generated; and step 3, generating a recommendation result through the large model.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present invention relates to the technical field of behavior sequence recommendation, and in particular to a method, system and storage medium for predicting user preferences based on data causal graphs and counterfactual reasoning. Background Art

[0002] With the rapid development of personalized recommendation systems, how to efficiently combine user historical behavior with item features to accurately predict ratings has become a research focus. In recent years, large language models, with their powerful text representation capabilities, have been widely used in sequential recommendation systems to extract text features from items and assist in sequential recommendation tasks. However, traditional rating calculation methods face two major problems with the text features of items generated by large models: first, text features may introduce interference unrelated to the user's actual preferences, leading to biased rating predictions; second, existing scoring formulas cannot fully model the interactions between text features and other features, thus limiting the performance of recommendation systems.

[0003] Causal inference offers a new perspective. By constructing a causal graph generated from data, we can clarify the causal relationships between text features, user behavior sequences, and rating results, and design new rating optimization methods based on this. However, traditional rating formulas fail to fully consider item text information and lack targeted debiasing during the rating generation process, potentially transferring inherent model biases into the final recommendation results. Summary of the Invention

[0004] The technical problems to be solved by the present invention are:

[0005] The existing scoring formula does not fully consider the item text information, and the scoring generation process lacks targeted debiasing operations, which may pass the model's inherent bias to the final recommendation results.

[0006] The present invention is to solve the above technical problems using the following technical solutions:

[0007] The present invention provides a user preference prediction method based on data causal graph and counterfactual reasoning, comprising the following steps:

[0008] Step 1: Collect user-item interaction information data, pre-process the user-item interaction information data to obtain a sequence set, collect item text information data, and pre-process the text information data to obtain a text information set;

[0009] Step 2, constructing a large model, the score prediction process of the large model, constructing a data causal graph based on sequence recommendation of the large model, performing intervention operation to construct counterfactual world and performing score prediction, calculating the matching degree of the sequence and the item in the real world and the counterfactual world, calculating the joint feature matching degree of the item text and the sequence in the real world and the counterfactual world, and calculating the matching degree of the text information and the sequence, and introducing a hyperparameter λ2 to control the influence scale of the text information on the result, to generate a final prediction score formula;

[0010] Step 3, inputting the sequence set and the text information set into the large model to generate a recommendation result.

[0011] Further, step 1 includes the following steps:

[0012] Collecting user-item interaction information data, judging whether the item and the user interact to score, filtering out samples whose user and item appear less than 5 times, sorting the items in time sequence, then filtering out the user label, forming a sequence file; filtering out the sequence length of 1 in the sequence file, cutting the sequence into multiple sub-sequences at the same time, and taking the last item in the sequence as the next interaction item result of the sequence, and all the interaction items before the item as a sequence, to obtain a sequence set;

[0013] Collecting item text information data, preprocessing the text information data, including text cleaning, and splicing text information of different labels to generate a text information set;

[0014] Finally, filter out the items in the sequence set that do not contain text information.

[0015] Further, the large model in step 2 includes a large model-based item text representation learning module and a graph neural network-based sequence representation learning module; the large model-based item text representation learning module extracts high-quality semantic embedding of item text through a large language model, generates item representation suitable for recommendation tasks by combining linear layer mapping and multilayer perception; the graph neural network-based sequence representation learning module captures local sequential relationship and cross-session co-occurrence relationship of items using session graphs and global graphs to generate comprehensive representation of user behavior sequences.

[0016] Further, the function implementation process of the graph neural network-based sequence representation learning module is as follows:

[0017] The construction method of the session graph is as follows: constructing each session s as a directed session graph Where the point set The vertices in the edge set Any edge in the edge set Represents the order of items in the sequence, Indicates that item i is interacted before item j;

[0018] For node v i Representation Indicated by the upper layer and neighbor nodes Features Weighted aggregation is obtained, namely:

[0019]

[0020] The weight α ij is the attention weight calculated based on the correlation between nodes, which is used to dynamically adjust the influence of neighbor nodes on the update of the target node. ij For node v i and v j The relevance score is combined with the feature representation of the item embedding representation and Through nonlinear changes of the learnable parameters W4 and the attention vector a, we can obtain:

[0021]

[0022]

[0023] Global Picture The construction method is: each node v in the graph i Represents an item. If the item v i and v j co-occurs in at least one user session, then i and v j Create an edge (v i , v j ), the edge weight is defined by the co-occurrence frequency between items, that is:

[0024]

[0025] where freq(v i , v j ) is v i and v j The number of co-occurrences, freq(v i ) and freq(v j ) are items v i and v j Number of occurrences;

[0026] Information propagation aggregates information of neighbor nodes through weighted sum based on attention mechanism; neighbor features The weighted aggregation formula is:

[0027]

[0028] The importance of neighbor nodes is determined by the conversation context-sensitive weight function π(v i , v j ) calculation, which is used to distinguish the importance of different neighbors to the current item, and the weight is:

[0029]

[0030] in is the feature vector obtained by averaging the pooled items in the current session, namely:

[0031]

[0032] Among them, w ij is the weight between items, ⊙ represents element-wise multiplication, || represents concatenation, W5 and q1 are learnable parameters;

[0033] The information aggregation step represents the feature of the current item h v and features propagated from neighbors Fusion is performed to generate new item representations through nonlinear transformation, namely:

[0034]

[0035] Where W6 is the linear transformation weight matrix and ReLU is the activation function;

[0036] The stacked multi-layer propagation mechanism captures high-order neighbor information. Each layer is generated by calculating the item representation and neighbor representation of the previous layer. The representation of the k-th layer is defined as:

[0037]

[0038] First, we learn high-level feature representations of items through the global graph and combine them with session features to generate a comprehensive representation of the items. The final representation of each item is:

[0039]

[0040] Representing items and reverse position indicates p l-i+1 Perform splicing and generate a new representation through nonlinear changes, namely:

[0041]

[0042] Where W7 and b4 are learnable parameters;

[0043] Finally, the weighted representations of the items are combined into the final session representation, i.e.:

[0044]

[0045] Weight β i Obtained by dynamic calculation of the soft attention mechanism:

[0046]

[0047] W8, W9, q2, and b5 are learnable parameters;

[0048] The preliminary session feature s′ is calculated using the average representation of all items in the session, namely:

[0049]

[0050] Where l is the sequence length.

[0051] Furthermore, the rating prediction process of the large model in step 2 specifically includes the following steps:

[0052] Calculate the matching degree between the sequence and the item in the real world and the counterfactual world, that is:

[0053]

[0054] Calculate the joint feature matching between item texts and sequences in the real world and the counterfactual world, that is:

[0055]

[0056] Calculate the matching degree between text information and sequence, namely:

[0057]

[0058] The hyperparameter λ2 is introduced to control the impact of text information on the results and generate the final prediction score formula:

[0059]

[0060] In the formula, s is the sequence representation, For item v i The item indicates that Q h,s is the matching degree between the inherent characteristics of the item and the sequence characteristics, P s,l is the influence of sequence and text features on the score, P h,l,s Modeling the influence of item inherent features, sequence features and text features, E is a transformation matrix, θ s is the text perception factor of the sequence, ο is the Hadamard product of the vector, and σ is the Sigmod function.

[0061] Furthermore, the loss function of the large model is:

[0062] l=l rec (Y h,l,s )+l rec (Q h,s )+l rec (P s , P h,l,s )

[0063] where l rec Using binary cross loss entropy function:

[0064]

[0065] Where m is the size of the candidate item set, that is, the number of all candidate items, y i ∈{0, 1} is the true label.

[0066] Furthermore, the value range of the hyperparameter λ2 is 0~1.

[0067] Furthermore, the value of the hyperparameter λ2 is 0.8.

[0068] The present invention provides a user preference prediction system based on data causal graphs and counterfactual reasoning. The system has a program module corresponding to the steps of the method described in any one of the above technical solutions, and executes the steps in the above-mentioned user preference prediction method based on data causal graphs and counterfactual reasoning during operation.

[0069] The present invention provides a computer-readable storage medium storing a computer program, wherein the computer program is configured to implement the steps of the user preference prediction method based on data causal graph and counterfactual reasoning described in any one of the above technical solutions when called by a processor.

[0070] Compared with the prior art, the present invention has the following beneficial effects:

[0071] By constructing a causal graph generated by data, the present invention can clarify the causal relationship between text features, user behavior sequences and scoring results, fully consider the joint influence of text features, inherent characteristics of items and sequence characteristics, and optimize the scoring calculation process from the perspective of causality; for the main influencing factors of the score, the scoring results are further optimized based on the counterfactual principle, and the total indirect effect is introduced to replace the total effect, so as to more accurately quantify the impact of text features on the score, improve the fairness and rationality of the recommendation results, and at the same time eliminate unnecessary interference of text attributes on sequence attributes to improve the fairness and accuracy of the model's recommendations.

[0072] The effectiveness and stability of the method of the present invention were comprehensively evaluated by experimentally verifying the method on multiple data sets, including scoring comparison experiments, ablation experiments, and parameter sensitivity analysis experiments. BRIEF DESCRIPTION OF THE DRAWINGS

[0073] Figure 1 This is a causal graph of sequence recommendation model data based on a large model in an embodiment of the present invention;

[0074] Figure 2 This is a flow chart of the prediction score calculation in an embodiment of the present invention;

[0075] Figure 3 A causal graph of the real world and the counterfactual world in an embodiment of the present invention;

[0076] Figure 4 Figure 1 is a causal graph of the real world and counterfactual world in an embodiment of the present invention. Figure (a) is a causal graph of real-world data, and Figure (b) is a causal graph of counterfactual world data after an intervention operation.

[0077] Figure 5 Figure 1 shows the comparison results of scores under different data sets in an embodiment of the present invention, where Figure (a) shows the comparison results of Scientific scores, Figure (b) shows the comparison results of Arts scores, Figure (c) shows the comparison results of Office scores, and Figure (d) shows the comparison results of Instruments scores.

[0078] Figure 6 2 is a graph of the λ2 sensitivity analysis results in an embodiment of the present invention, wherein (a) is a Recall@50 curve graph, (b) is a NDCG@50 curve graph, and (c) is a MRR@50 curve graph. DETAILED DESCRIPTION

[0079] In order to enable those skilled in the art to better understand the present invention, exemplary embodiments or examples of the present invention will be described below with reference to the accompanying drawings. Obviously, the described embodiments or examples are only some of the embodiments or examples of the present invention, and not all of them. Based on the embodiments or examples of the present invention, all other embodiments or examples obtained by those skilled in the art without creative work should fall within the scope of protection of the present invention.

[0080] In order to make the above-mentioned objects, features and advantages of the present invention more obvious and easy to understand, specific embodiments of the present invention are described in detail below with reference to the accompanying drawings.

[0081] Specific implementation scheme 1: The present invention provides a user preference prediction method based on data causal graph and counterfactual reasoning, comprising the following steps:

[0082] Step 1: Collect user-item interaction information data, pre-process the user-item interaction information data to obtain a sequence set, collect item text information data, and pre-process the text information data to obtain a text information set;

[0083] Step 2: Build a large model. The rating prediction process of the large model constructs a data causal graph based on the sequence recommendation of the large model, performs intervention operations to construct the counterfactual world and perform rating prediction. By calculating the matching degree between the sequence and the item in the real world and the counterfactual world, calculating the joint feature matching degree between the item text and the sequence in the real world and the counterfactual world, and calculating the matching degree between the text information and the sequence, and introducing the hyperparameter λ2 to control the influence of the text information on the result, the final prediction rating formula is generated;

[0084] Step 3: Input the sequence set and the text information set into the large model to generate recommendation results.

[0085] Specific implementation plan 2: Step 1 includes the following steps:

[0086] Collect user-item interaction data, determine whether items and users interact and score them, filter out samples where users and items have been rated less than five times, sort items chronologically, and then filter out user tags to form a sequence file. Then filter out sequences with a length of 1 in the sequence file and split the sequence into multiple subsequences. The last item in the sequence is used as the next interaction item in the sequence, and all the interaction items before the item are treated as a sequence to obtain a sequence set.

[0087] Collecting item text information data and preprocessing the text information data, including text cleaning, splicing text information of different tags, and generating a text information set;

[0088] Finally, the items in the sequence set that do not contain text information are filtered out.

[0089] The rest of this embodiment is the same as the specific embodiment 1.

[0090] Specific implementation plan three: The large model described in step 2 adopts a large model and graph neural network-based sequential recommendation model (Large Language Model-based Sequential Recommendation, LLM-SR), including a large model-based item text representation learning module and a graph neural network-based sequence representation learning module; the large model-based item text representation learning module extracts high-quality semantic embedding of item text through a large language model, and combines linear layer mapping and multi-layer perceptron to generate item representations adapted to recommendation tasks; the graph neural network-based sequence representation learning module uses session graphs and global graphs to capture the local sequential relationships and cross-session co-occurrence relationships of items, and generates a comprehensive representation of user behavior sequences.

[0091] The rest of this embodiment is the same as the specific embodiment 1.

[0092] Specific implementation plan 4: The functional implementation process of the sequence representation learning module based on graph neural network is as follows:

[0093] The session graph is constructed as follows: Each session s is constructed as a directed session graph The point set The vertices in are the vertices in session s, and the edge set Any edge in Represents the order of items in the sequence, Indicates that item i is interacted before item j;

[0094] For node v i Representation Indicated by the upper layer and neighbor nodes Features Weighted aggregation is obtained, namely:

[0095]

[0096] The weight α ij is the attention weight calculated based on the correlation between nodes, which is used to dynamically adjust the influence of neighbor nodes on the update of the target node. ij For node v i and v j The relevance score is combined with the feature representation of the item embedding representation and Through nonlinear changes of the learnable parameters W4 and the attention vector a, we can obtain:

[0097]

[0098]

[0099] Global Picture The construction method is: each node v in the graph i Represents an item. If the item v i and v j co-occurs in at least one user session, then i and v j Create an edge (v i , v j ), the edge weight is defined by the co-occurrence frequency between items, that is:

[0100]

[0101] where freq(v i , v j ) is v i and v j The number of co-occurrences, freq(v i ) and freq(v j ) are items v i and v j Number of occurrences;

[0102] Information propagation aggregates information of neighbor nodes through weighted sum based on attention mechanism; neighbor features The weighted aggregation formula is:

[0103]

[0104] The importance of neighbor nodes is determined by the conversation context-sensitive weight function π(v i , v j ) calculation, which is used to distinguish the importance of different neighbors to the current item, and the weight is:

[0105]

[0106] in is the feature vector obtained by averaging the pooled items in the current session, namely:

[0107]

[0108] Among them, w ij is the weight between items, ⊙ represents element-wise multiplication, || represents concatenation, W5 and q1 are learnable parameters;

[0109] The information aggregation step represents the feature of the current item h v and features propagated from neighbors Fusion is performed to generate new item representations through nonlinear transformation, namely:

[0110]

[0111] Where W6 is the linear transformation weight matrix and ReLU is the activation function;

[0112] The stacked multi-layer propagation mechanism captures high-order neighbor information. Each layer is generated by calculating the item representation and neighbor representation of the previous layer. The representation of the k-th layer is defined as:

[0113]

[0114] First, we learn high-level feature representations of items through the global graph and combine them with session features to generate a comprehensive representation of the items. The final representation of each item is:

[0115]

[0116] Representing items and reverse position indicates p l-i+1 Perform splicing and generate a new representation through nonlinear changes, namely:

[0117]

[0118] Where W7 and b4 are learnable parameters.

[0119] Finally, the weighted representations of the items are combined into the final session representation, i.e.:

[0120]

[0121] Weight β i Obtained by dynamic calculation of the soft attention mechanism:

[0122]

[0123] W8, W9, q2, and b5 are learnable parameters;

[0124] The preliminary session feature s′ is calculated using the average representation of all items in the session, namely:

[0125]

[0126] Where l is the sequence length.

[0127] The rest of this implementation plan is the same as the specific implementation plan three.

[0128] Specific implementation plan 5: This implementation plan is aimed at the data causal graph designed for the sequence recommendation framework based on the large language model. Figure 1As shown in the figure. The edge T→I in the figure indicates that the inherent attributes of the item are affected by the text attributes of the item. This is because in the model, the representation of the item is generated by the graph convolution operation of the item text representation. The edge T→L indicates that the text attributes of the item have an impact on the text feature representation generated by the large model. Since the text feature representation is generated by extracting text information through the large model, this causal effect is obvious. The edges I→M, L→M and S→M represent the joint influence of the sequence-item matching pair on the inherent attributes of the item, the inherent attributes of the sequence, and the text feature representation generated by the large model. The edges L→N and S→N indicate that the user-text matching pair is affected by both the inherent attributes of the sequence and the text feature representation generated by the large model. Finally, the edges M→Y and N→Y indicate that the scoring result is jointly determined by the user-item matching pair and the user-text matching pair.

[0129] This implementation scheme adjusts the scoring calculation formula of the model and improves it to formula (4-2). Where E is a transformation matrix used to transform the text features L(T i ) that is l i Mapped into the context-aware space. θ s It represents the text perception factor of the sequence, which is used to measure the degree to which the sequence is attracted by the text features of the items. It is worth noting that θ s and E(l i ) are located in the same perceptual space, and the inner product of the two reflects the correlation between the sequence and the item text features. In the score calculation, this implementation further decomposes the influence of the causal path M→Y into two parts. One is the influence of the item and sequence on the score, which is expressed as The second is the synergistic influence of items, text information and sequence on the score, which is expressed as In addition, the influence of the causal path N→Y is determined by the degree to which the sequence is attracted by the item text features, which is expressed as

[0130]

[0131] Based on formula (4-2), the implementation details of each part of the prediction score are shown in formulas (4-3) to (4-5).

[0132]

[0133]

[0134]

[0135] Among them, s is a sequence representation, For item v i The item indicates that is the Hadamard product of the vector, and σ is the Sigmod function. The final prediction score is formula (4-6), where The function uses simple scalar multiplication.

[0136]

[0137] The specific calculation process is as follows Figure 2 As shown, P s,l Model the relationship between sequence features and text features, and output the joint impact of sequence and text features on the score, P h,l,s Modeling the joint influence of item inherent features, sequence features, and text features, indicating the contribution of the three to the score, Q h,s Model the relationship between the inherent characteristics of the item and the sequence characteristics, output the matching degree between the item and the sequence characteristics, and the final score It is obtained by comprehensive calculation of the outputs of the above three modules.

[0138] The core of this implementation's score optimization is based on the counterfactual hypothesis: "If a sequence has already matched other items with the same large-scale model-extracted text features as the current item, would it still choose to match the current item?" By constructing a counterfactual world and comparing it with the real world, we can effectively identify the actual effect of the text features extracted by the large-scale model on recommendation results. The introduction of the counterfactual principle not only quantifies the positive or negative impact of text features on recommendations but also provides theoretical support for eliminating potential biases and optimizing recommendation results.

[0139] In causal inference, intervention refers to setting the value of a certain node B = b (expressed as do(B = b), simplified as do(S)), cutting off the incoming edges of certain nodes in the causal graph, thereby controlling the causal relationship between variables. If node B is intervened, the causal path between variables A and B will be cut off, and the value of B will no longer be affected by A. This process can be achieved through Figure 3 (c) Intuitively, by do(A=a * ) intervention operation, the causal relationship between variables A and B is eliminated, and the change of B is completely independent of A. Figure 3 In the CNN model, node colors are used to distinguish different intervention states: a blue node indicates that the node has been subjected to the intervention, while a half-blue, half-white node indicates that the node is affected by both the intervention and other normal causal pathways. This graphical representation clearly demonstrates the impact of the intervention on causal relationships, providing intuitive support for path separation and effect analysis in causal inference.

[0140] like Figure 3As shown in the figure, in this causal graph, nodes A, B, and C correspond to three random variables, A is the dependent variable, B is the mediating variable, and C is the outcome variable. The edge A-→B represents that B is affected by A, and A is the cause of B. The edges B-→C and A-→C represent that C is affected by both A and B, and both A and B are causes of C. In the causal relationship graph, there are two paths, A-→C and A-→B-→C, that simultaneously affect variable C. This implementation scheme is based on intervention operations and applies the counterfactual principle to study the causal effects between random variables in the counterfactual world, and then infer how the dependent variable A affects the outcome variable C through the mediating variable B in the real world.

[0141] Based on the total effect (TE) theory, we calculate the change in the outcome variable C when both the dependent variable A and the mediating variable B change simultaneously. This means we calculate the combined causal effect of the two paths, A→C and A→B→C. The calculation formula is (4-9).

[0142]

[0143] Based on the theory of natural direct effects, we calculate the change in outcome variable C when dependent variable A changes without changing mediating variable B. This is to calculate the causal effect of the path A→C. The calculation formula is (4-10).

[0144]

[0145] Based on the Total Indirect Effect (TIE) theory, the causal effect along the path A→B→C is calculated by subtracting the natural direct effect from the total effect. The calculation formula is (4-11).

[0146]

[0147] Constructing a similar causal diagram for the counterfactual world Figure 4 As shown in the figure, in this counterfactual world, intervention operations are performed on the item representation and text representation, causing the item-sequence matching pair to become half blue and half white, while the text-sequence matching pair remains white because it is not affected by the intervention operation.

[0148] Introducing the intervention calculation method, assuming that the intervention I=i*, the score prediction result at this time is shown in formula (4-12).

[0149]

[0150] The total indirect effect can be obtained by subtracting the natural direct effect from the total effect. Based on this basic principle, keeping the causal effect of the {L, S}→N→Y path unchanged, the causal effect of the {I, L, S}→M→Y path is calculated, so we have:

[0151]

[0152] Combining the rating prediction formula (4-6) based on the data causal graph, and to enhance the representation of the final results while preserving the influence of textual information on user choices, we introduce the hyperparameter λ2 to control the scale of the influence of textual information on the results. The final model's rating prediction formula is shown in Formula (4-14).

[0153]

[0154] The rest of this implementation plan is the same as the specific implementation plan four.

[0155] Specific implementation plan six: This implementation plan uses a multi-task learning framework to integrate the sequence to predict the rating of the item Y h,l,s , sequence and item-intrinsic attributes score prediction Q h,s And the sequence-to-item text feature joint score prediction P s, l P h,l,s The three optimization subtasks use the loss function shown in formula (4-7).

[0156] l=l rec (Y h,l,s )+l rec (Q h,s )+l rec (P s,l P h,l,s ), #(4-7)

[0157] Where l uses the binary cross loss entropy function, as shown in formula (4-8):

[0158] reC

[0159]

[0160] Where m is the size of the candidate item set, that is, the number of all candidate items, y i ∈{0, 1} is the true label.

[0161] The rest of this implementation plan is the same as the specific implementation plan five.

[0162] This causal inference-based scoring optimization method (CISO) addresses the problem that traditional scoring calculation formulas fail to fully consider item text information and the inherent biases of large language models by constructing a data causal graph and introducing counterfactual inference. Its core idea is to optimize the scoring prediction formula from the perspective of causality and counterfactual assumptions to improve the fairness and accuracy of the recommendation system. The pseudo code for this scoring optimization method is as follows:

[0163]

[0164] The input of the scoring optimization method based on causal inference is the candidate item set I = {i1, i2, ..., i |I|}, the item text representation set H = {h1, h2, ..., h |H|}, parameter λ2 controls the weight of the text information on the rating prediction. The predicted rating of the items in the item set I by sequence S Algorithm lines 1-2 use the method of calculating the average textual and feature representations of items to calculate the textual and feature representations of items in the counterfactual world. These are used for intervention operations to construct the counterfactual world. Algorithm lines 4-7 perform score prediction calculations. Line 4 calculates the matching degree between the sequence and the item in both the real world and the counterfactual world; line 5 calculates the joint feature matching degree between the item text and the sequence in both the real world and the counterfactual world; line 6 calculates the matching degree between the text information and the sequence; and line 7 combines the above subtasks to calculate the predicted score and obtain the final score.

[0165] The user preference prediction method (algorithm) based on data causal graph and counterfactual reasoning proposed in the present invention is the underlying technical core of the present invention, and various products can be derived based on the algorithm.

[0166] Based on the method proposed in the present invention, a user preference prediction system based on data causal graphs and counterfactual reasoning is developed using a programming language. The system has program modules corresponding to the steps of the above-mentioned technical solution, and executes the steps of the above-mentioned user preference prediction method based on data causal graphs and counterfactual reasoning during operation.

[0167] The developed system (software) computer program is stored on a computer-readable storage medium. When called by a processor, the computer program is configured to implement the steps of the aforementioned method for predicting user preferences based on data causal graphs and counterfactual reasoning. This materializes the present invention on a carrier, becoming a computer program product.

[0168] Various implementations of the systems and techniques described herein can be realized in digital electronic circuitry, integrated circuitry, dedicated ASICs (application specific integrated circuits), computer hardware, firmware, software, and / or combinations thereof. These various implementations can include being implemented in one or more computer programs that are executable and / or interpreted on a programmable system comprising at least one programmable processor, which can be a special purpose or general purpose programmable processor that can receive data and instructions from a storage system, at least one input device, and at least one output device, and transmit data and instructions to the storage system, the at least one input device, and the at least one output device.

[0169] The computer programs (also referred to as programs, software, software applications, or code) of the present invention include machine instructions for a programmable processor and can be implemented using high-level procedural and / or object-oriented programming languages, and / or assembly / machine languages. As used herein, the terms "machine-readable medium" and "computer-readable medium" refer to any computer program product, device, and / or apparatus (e.g., a magnetic disk, an optical disk, a memory, a programmable logic device (PLD)) for providing machine instructions and / or data to a programmable processor, including a machine-readable medium that receives machine instructions as a machine-readable signal. The term "machine-readable signal" refers to any signal for providing machine instructions and / or data to a programmable processor.

[0170] The beneficial effects of the present invention are described in detail using the following examples.

[0171] Example 1

[0172] In this embodiment, experiments were conducted on four different datasets from Amazon Review Data 2018: Industrial and Scientific (Scientific), Arts Crafts and Sewing (Arts), Office Products (Office), and Musical Instruments (Instruments).

[0173] Table 1 shows the statistics for four selected datasets. With the exception of the Scientific dataset, all other datasets have reached millions of interactions. The text information in all four datasets is also very rich, with an average text length exceeding 100 characters. The number of users also reaches tens of thousands. The Office dataset has 87,436 users, 25,986 items, and 684,837 interactions, the highest number of records among the four datasets.

[0174] Table 1 Statistics of the dataset

[0175]

[0176] All data is initially stored in two files: a rating-only file and a metadata file. In the metadata file, each item consists of multiple data tags and corresponding information. The items in the five datasets share the tags "Title," "Brand," and "Category," as these three tags contain important textual descriptions of the items. This example first performs text cleaning and then concatenates the text information from the three different tags to generate a new data file in the format (item, text). Finally, items in the sequence file that lack textual information are filtered out.

[0177] For the rating-only file, the data content is in the form of (user, item, rating, timestamp). The rating value is modified by whether or not the rating is used as the interaction criterion. Samples with less than 5 occurrences of the user and item are filtered out. For the interaction behaviors of the same user, the data pairs (user, item1, item2, item3) are generated by sorting them according to the timestamp label. The user label is then filtered out to form a sequence file. Sequences with a sequence length of 1 in the sequence file are then filtered out. Sequence splitting is performed at the same time. A sequence is split into multiple sequences using a sliding window method. The last item in the sequence is used as the next interaction item result of the sequence. All the interaction items before the item are treated as a sequence, such as S = [v s,1 , v s,2 ,…,v s,n ], and then cut into multiple subsequences according to the sliding window [(v s,1 ), v s,2 ],[(v s,1 , v s,2 ), v s,3 ],...[(v s,1 , v s,2 , v s,n-1 ), v s,n ].

[0178] The training and test sets are divided based on session timestamps. First, the latest session time in the dataset is determined as the benchmark, and a 7-day time window is subtracted from this time to determine the time threshold for division. Sessions with timestamps earlier than this threshold are classified as the training set, while sessions with timestamps later than this threshold are classified as the test set. During processing, items appearing in the training set are renumbered, and a dictionary of uniquely identified items is constructed. Only items that appeared in the training set are retained in the test set. Finally, the session data is converted into a sequence format.

[0179] This example is based on the above-mentioned LLM-SR model and conducts experiments on four datasets: Scientific, Arts, Office, and Instruments. The effectiveness of the score optimization method is judged based on the changes in the evaluation index values ​​before and after the improvement of the prediction score calculation formula (Formula 4-3 before improvement, Formula 4-14 after improvement). The experimental results are shown in Figure 2. Figure 5 shown.

[0180] As can be seen, the causal inference-based scoring optimization method of this embodiment significantly improves model recommendation performance on all four datasets, with the most significant improvement on the Recall evaluation metric. The NDCG metric also improves somewhat, while the MRR metric improves to a relatively small extent, but overall shows a positive upward trend. This shows that the method of the present invention effectively captures the combined influence of sequence, text, and item features on scoring, offering superiority over traditional scoring methods that only consider sequence and item features, significantly improving the accuracy and ranking of model recommendation results.

[0181] Example 2

[0182] The scoring optimization method based on causal inference is mainly composed of P s,l 、P h,l,s and Q h,s It consists of three parts. This embodiment uses ablation experiments to verify the rationality of the scoring formula of the present invention, and designs three variant scoring calculation methods Y1, Y2 and Y3, as shown in formulas (4-15), (4-16) and (4-17).

[0183] Y1=P s,l Q h,s , #(4-15)

[0184] Y2=P h,l,s Q h,s , #(4-16)

[0185] Y3=Q h,s , #(4-17)

[0186] Y1 ignores the combined influence of item, sequence, and text features; Y2 ignores the combined influence of sequence and text features on the score; and Y3, the traditional scoring method, considers only the degree of match between item and sequence features. Experiments using the four scoring formulas on four datasets yielded the following results, as shown in Tables 2, 3, and 4.

[0187] As can be seen, the Recall@50 value of the scoring optimization method of the present invention is significantly higher than that of the other three variant scoring methods, verifying its effectiveness in improving the accuracy of recommendation results. The experimental results of Y1 on all four data sets are lower than those of Y3, which shows that the scoring formula cannot be arbitrarily modified, as it may lead to negative improvements. Comparing scores Y2 and Y3, it can be found that the Recall@50 experimental results corresponding to score Y2 do not change much, indicating that there are still unreasonable aspects in the design of score Y2.

[0188] Table 2 Ablation experiment Recall@50 results (%)

[0189]

[0190] As can be seen from the results in Tables 3 and 4, the NDCG@50 and MRR@50 indicators of the scoring optimization method of the present invention are superior to the other three scoring methods on all four data sets. Although the improvement is not as significant as Recall@50, it still shows a certain improvement effect, indicating that the proposed optimization method has a positive effect on the ranking performance of the recommendation results. Further comparison of the experimental results of Y1, Y2 and Y3 shows that the performance of the Y1 scoring method is slightly weaker than that of Y2 and Y3. However, the overall difference in the experimental results of the three is small, indicating that these variant scoring methods do not have a significant impact on the ranking performance of the recommendation results, verifying the limitations of the three scoring designs.

[0191] In summary, the optimization method proposed in this paper not only performs outstandingly in terms of the coverage of recommendation results, but also has certain advantages in ranking performance, which further proves the effectiveness and rationality of the optimization method.

[0192] Table 3 Ablation experiment NDCG@50 results (%)

[0193]

[0194] Table 4 Ablation experiment MRR@50 results (%)

[0195]

[0196] Example 3

[0197] In this embodiment, sensitivity analysis of the parameter λ is performed on four datasets: Scientific, Arts, Office, and Instrumems. The values ​​of λ2 are {0, 0.2, 0.4, 0.6, 0.8, 1.2}. Experiments are conducted with different λ2 values ​​within the range of values. The experimental results are shown in the figure. Figure 6 shown.

[0198] exist Figure 6In the four data sets of (a), as λ2 increases, the value of Recall@50 also gradually increases, and reaches its maximum value when λ2=0.8. Subsequently, as the value of λ2 increases, the value of Recall@50 begins to decrease. When the value of λ2 is 1, Recall@50 only decreases slightly, but when λ reaches 1.2, Recall@50 drops drastically. This can be explained as the appropriate adoption of counterfactual scoring optimization strategies can increase the accuracy of recommendation results, but excessive adoption will lead to a decrease in results. This is also in line with the principle of the calculation formula of the total indirect effect. When the value of λ exceeds 1, the total effect minus the natural direct effect will result in the subtraction of additional effects. The total indirect effect obtained at this time cannot reflect the situation where the dependent variable affects the outcome variable through the mediating variable. Figure 6 In (c), the MRR@50 curve shows the same pattern as the Recall@50 change. As λ2 increases, the MRR@50 value increases continuously, reaches the maximum value when λ2=0.8, and then begins to decline. When λ, exceeds 1, a cliff-like drop occurs.

[0199] exist Figure 6 In (b), the variation trend of NDCG@50 with λ2 differs slightly from that of Recall@50, not showing a consistent trend of first increasing and then decreasing. The trend in the Office and Instruments datasets is exactly the same as Recall@50: it first increases and then decreases, but the increase is very small. In contrast, the trend in the Arts dataset is first increasing, then decreasing, then increasing again, and finally decreasing again. However, when λ2 is in the range of 0-1, the NDCG@50 values ​​are consistently better than those when λ2 = 0. In the Scientific dataset, although the trend also increases and then decreases, there is no abrupt drop at λ2 = 1.2, only a slight decrease. This phenomenon can be explained by the NDCG evaluation metric. The NDCG evaluation metric focuses on the overall sequence properties of the candidate sequence, not the accuracy of the result. Therefore, increasing λ2 does not necessarily lead to better results. However, overall, when λ2 is in the range of 0-1, NDCG@50 improves in all four datasets compared to when λ2 is 0. After comprehensive consideration, this paper believes that the λ2 value of 0.8 is more appropriate. Although this is not the optimal solution sometimes, its overall performance is better.

[0200] Although the present invention is disclosed as above, the scope of protection disclosed by the present invention is not limited thereto. Those skilled in the art of the present invention may make various changes and modifications without departing from the spirit and scope of the present invention, and these changes and modifications will fall within the scope of protection of the present invention.

Claims

1. A user preference prediction method based on data causal graph and counterfactual reasoning, characterized by: The steps include: Step 1: Collect user-item interaction information data, pre-process the user-item interaction information data to obtain a sequence set, collect item text information data, and pre-process the text information data to obtain a text information set; Step 2: Build a large model. The score prediction process of the large model constructs a data causal graph based on the sequence recommendation of the large model, performs intervention operations to construct a counterfactual world and perform score prediction. By calculating the matching degree between the sequence and the item in the real world and the counterfactual world, calculating the joint feature matching degree between the item text and the sequence in the real world and the counterfactual world, and calculating the matching degree between the text information and the sequence, and introducing hyperparameters to control the impact of the text information on the results, the final prediction score formula is generated; Step 3: Input the sequence set and the text information set into the large model to generate recommendation results; The large model in step 2 includes an item text representation learning module based on the large model and a sequence representation learning module based on a graph neural network; The large-model-based item text representation learning module extracts high-quality semantic embeddings of item texts through a large language model, and combines linear layer mapping and multi-layer perceptrons to generate item representations suitable for recommendation tasks. The graph neural network-based sequence representation learning module uses session graphs and global graphs to capture the local sequential relationships and cross-session co-occurrence relationships of items, generating a comprehensive representation of user behavior sequences. The functional implementation process of the sequence representation learning module based on graph neural network is as follows: The session graph is constructed as follows: Each session s is constructed as a directed session graph The point set The vertices in are the vertices in session s, and the edge set Any edge in Represents the order of items in the sequence, Indicates that item i is interacted before item j; For node v i Representation Indicated by the upper layer and neighbor nodes Features Weighted aggregation is obtained, namely: The weight α ij is the attention weight calculated based on the correlation between nodes, which is used to dynamically adjust the influence of neighbor nodes on the update of the target node. ij For node v i and v j The relevance score is combined with the feature representation of the item embedding representation and Through nonlinear changes of the learnable parameters W4 and the attention vector a, we can obtain: Global Picture The construction method is: each node v in the graph i Represents an item. If the item v i and v j co-occurs in at least one user session, then i and v j Create an edge (v i , v j ), the edge weight is defined by the co-occurrence frequency between items, that is: where freq(v i , v j ) is v i and v j The number of co-occurrences, freq(v i ) and freq(v j ) are items v i and v j Number of occurrences; Information propagation aggregates information from neighboring nodes through a weighted sum based on an attention mechanism; Neighborhood characteristics The weighted aggregation formula is: The importance of neighbor nodes is determined by the conversation context-sensitive weight function π(v i , v j ) calculation, which is used to distinguish the importance of different neighbors to the current item, and the weight is: in is the feature vector obtained by averaging the pooled items in the current session, namely: Among them, w ij is the weight between items, ⊙ represents element-wise multiplication, || represents concatenation, W5 and q1 are learnable parameters; The information aggregation step represents the feature of the current item h v and features propagated from neighbors Perform fusion and generate new item representations through nonlinear transformation, namely: Where W6 is the linear transformation weight matrix and ReLU is the activation function; The stacked multi-layer propagation mechanism captures high-order neighbor information. Each layer is generated by calculating the item representation and neighbor representation of the previous layer. The representation of the k-th layer is defined as: First, we learn high-level feature representations of items through the global graph and combine them with session features to generate a comprehensive representation of the items. The final representation of each item is: Representing items and reverse position indicates p l-i+1 Perform splicing and generate a new representation through nonlinear changes, namely: Where W7 and b4 are learnable parameters; Finally, the weighted representations of the items are combined into the final session representation, i.e.: The weight βi is obtained by dynamic calculation of the soft attention mechanism: W8, W9, q2, and b5 are learnable parameters; The preliminary session feature s′ is calculated using the average representation of all items in the session, namely: Where l is the sequence length; The rating prediction process of the large model in step 2 specifically includes the following steps: Calculate the matching degree between the sequence and the item in the real world and the counterfactual world, that is: Calculate the joint feature matching between item texts and sequences in the real world and the counterfactual world, that is: Calculate the matching degree between text information and sequence, namely: The hyperparameter λ2 is introduced to control the impact of text information on the results and generate the final prediction score formula: In the formula, s is the sequence representation, For item v i The item indicates that Q h,s is the matching degree between the inherent characteristics of the item and the sequence characteristics, P s,l is the influence of sequence and text features on the score, P h,l,s Modeling the influence of item inherent features, sequence features and text features, E is a transformation matrix, θ s is the text-aware factor of the sequence, is the Hadamard product of the vector, σ is the Sigmod function; The loss function of the large model is: in Using binary cross loss entropy function: Where m is the size of the candidate item set, that is, the number of all candidate items, y i ∈{0, 1} is the true label.

2. The user preference prediction method based on data causal graph and counterfactual reasoning according to claim 1 is characterized in that: Step 1 includes the following steps: Collect user-item interaction data, determine whether items and users interact and score them, filter out samples where users and items have been rated less than five times, sort items chronologically, and then filter out user tags to form a sequence file. Then filter out sequences with a length of 1 in the sequence file and split the sequence into multiple subsequences. The last item in the sequence is used as the next interaction item in the sequence, and all the interaction items before the item are treated as a sequence to obtain a sequence set. Collecting item text information data and preprocessing the text information data, including text cleaning, splicing text information of different tags, and generating a text information set; Finally, the items in the sequence set that do not contain text information are filtered out.

3. The user preference prediction method based on data causal graph and counterfactual reasoning according to claim 1 is characterized in that: The value range of the hyperparameter λ2 is 0~1.

4. The user preference prediction method based on data causal graph and counterfactual reasoning according to claim 3 is characterized in that: The value of the hyperparameter λ2 is 0.

8.

5. A user preference prediction system based on data causal graph and counterfactual reasoning, characterized by: The system has a program module corresponding to the steps of the method described in any one of claims 1 to 4 above, and executes the steps in the user preference prediction method based on data causal graph and counterfactual reasoning when running.

6. A computer-readable storage medium, characterized in that The computer-readable storage medium stores a computer program, and the computer program is configured to implement the steps of the user preference prediction method based on data causal graph and counterfactual reasoning according to any one of claims 1 to 4 when called by a processor.

Citation Information

Patent Citations

  • Anti-fact fair recommendation method based on inverse tendency weighting method

    CN114936890A

  • Bias detection and explainability of deep learning models

    US20220383167A1