User behavior prediction method based on causal tendency score
By constructing a feature association network and causal tendency score calculation, the causal relationship behind user behavior is revealed, and the problem of causal relationship being ignored in the existing technology is solved, and accurate prediction and personalized optimization of user behavior are achieved.
Patent Information
- Application Number
- CN202510920118.4
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2025-07-04
- Publication Date
- 2025-08-15
- Estimated Expiration
- 2045-07-04
AI Technical Summary
Existing user behavior prediction methods focus on the correlation between behaviors and ignore causality, making prediction errors difficult to explain and scientific and effective optimization strategies difficult to formulate scientific and effective optimization strategies.
By constructing a feature association network, screening causal candidate pairs, quantifying causal effects and calculating causal tendency scores, revealing the root cause of behavior prediction errors, and formulating optimization strategies based on causal relationships.
It realizes in-depth exploration and quantitative evaluation of the causal relationship behind user behavior, improves the interpretability and decision-making support capabilities of the model, can accurately predict user behavior and formulate personalized optimization strategies.
Smart Images

Figure CN120494210A_ABST
Abstract
Description
Technical Field
[0001] The present invention relates to the technical field of user behavior prediction, and in particular to a user behavior prediction method based on causal propensity scores. Background Art
[0002] With the widespread use of the internet, mobile devices, and the Internet of Things, user behavioral data generated across various platforms is becoming multimodal, high-dimensional, and dynamic, including clickstreams, browsing histories, transaction information, social media interactions, location trajectories, and other forms. This data provides a foundation for uncovering underlying behavioral patterns.
[0003] Traditional statistical methods such as regression analysis and time series modeling (such as the ARIMA model) have been widely used in user behavior analysis, but their linear assumptions and static characteristics make it difficult to adapt to complex and changing real-world scenarios. After the rise of machine learning technology, methods such as supervised learning, unsupervised learning, and reinforcement learning have gradually been introduced to handle tasks such as classification, clustering, and sequence prediction.
[0004] Most current user behavior prediction methods focus solely on correlations between behaviors, ignoring the underlying causal relationships. While this approach can reflect behavioral patterns to a certain extent, it lacks a deep understanding of the underlying driving mechanisms. This makes it difficult to interpret prediction errors and develop effective optimization strategies based on the prediction results. Summary of the Invention
[0005] In view of the shortcomings of the existing technology, the present invention provides a user behavior prediction method based on causal propensity score, which aims to solve the problems in the background technology.
[0006] To achieve the above objectives, the present invention provides the following technical solution: a method for predicting user behavior based on causal propensity scores, comprising: Step S1: Collecting user's historical behavior information from the history database; Step S2: extracting behavioral features from historical behavioral information, normalizing the extracted behavioral features, and outputting a normalized feature matrix; Step S3: Based on the normalized feature matrix, a behavior prediction model is established; the behavior prediction model parameters are adjusted through the back propagation algorithm and the optimizer, and the prediction error result is output; Step S4: Analyze the causal relationship between the behavioral characteristics based on the historical behavioral information and calculate the causal tendency score; Step S5: Analyze the reasons why the behavior prediction model produces prediction errors based on the causal propensity score; when certain causal relationships are not captured by the behavior prediction model, adjust the corresponding behavior characteristics; and update the behavior prediction model based on the adjusted behavior characteristics to obtain an optimized behavior prediction model; Step S6: Use the optimized behavior prediction model to predict user behavior and formulate an optimization strategy based on the causal relationship revealed by the causal propensity score.
[0007] Furthermore, the specific process of step S4 is as follows: Step S4.1: Based on historical behavior information, sort out the specific manifestations and occurrence sequence of each corresponding behavior feature, map the behavior features with chronological order and logical associations to nodes, and construct a feature association network; Step S4.2: Based on the feature association network and the basic principles of causal inference, candidate pairs with causal relationships are selected from all pairs of behavioral feature nodes; Step S4.3: Using a causal inference algorithm, quantify the causal relationship strength of the candidate pairs to obtain a standardized causal effect value; Step S4.4: Convert the standardized causal effect value into a causal propensity score within the set interval.
[0008] Furthermore, the specific process of step S4.1 is as follows: Step S4.11: Extract the timestamp and behavior type of the user behavior from the historical behavior information and construct a time-ordered behavior sequence; Step S4.12: Based on the time-ordered behavior sequence, identify recurring patterns in user behavior, i.e., frequent patterns, and output a set of frequent behavior patterns; Step S4.13: Based on the temporal distribution characteristics of the time-ordered behavior sequence and referring to the concentrated period of high-frequency behaviors in the frequent behavior pattern set, divide the time window and output the time window matrix; Step S4.14: Use an association rule mining algorithm to mine the associations between user behaviors based on the time-ordered behavior sequences and the partitioned time window matrix, focusing on high-frequency behavior combinations in the frequent behavior pattern set, and output a set of behavior association rules. Step S4.15: Convert the behavior association rule set into a graph structure to obtain a feature association network.
[0009] Furthermore, the specific process of step S4.2 is as follows: Step S4.21: Verify whether the connection behavior of each directed edge of the feature association network satisfies the temporal order, select the association pairs that meet the temporal order, and output the temporally ordered association pair set; Step S4.22: Perform a statistical significance test on the set of time-ordered correlation pairs and calculate the Pearson correlation coefficient to measure the strength of the correlation. Filter out the behavior pairs without significant statistical correlation and output the set of significantly correlated behavior pairs. Step S4.23: Count the co-occurrence frequencies of each behavior pair in the set of significantly correlated behavior pairs in the historical data, filter out the behavior combinations with high frequency co-occurrence, and output the set of high frequency co-occurrence behavior pairs; Step S4.24: For each subset of the high-frequency co-occurring behavior pairs, i.e., behavior pairs, analyze the time interval distribution of their occurrences, fit a probability distribution model, and calculate the average time interval and confidence interval; Step S4.25: Combine the average time interval, confidence interval, the temporal orderliness of the temporally ordered association pair set in step S4.21, the significant correlation of the significantly correlated behavior pair set in step S4.22, the co-occurrence frequency in step S4.23, and the time interval distribution in step S4.24 to comprehensively determine the causal possibility of the behavior pairs and generate candidate pairs with causal relationships.
[0010] Furthermore, the specific process of step S4.3 is as follows: Step S4.31: Based on the normalized feature matrix, identify the confounding variables that affect the causal relationship of the candidate pairs; screen out potential confounding factors related to the causal variable and the outcome variable through feature importance analysis, and output the confounding variable mapping table; Step S4.32: For each candidate pair, using the variables in the confounding variable mapping table as input features, construct a logistic regression model, train the logistic regression model to predict the probability of the user performing the cause behavior, and obtain a propensity score calculation model; Step S4.33: Based on the propensity score calculation model, a matching algorithm is applied to generate matched samples for the treatment group and the control group; Step S4.34: Estimate the causal effect on the matched sample, calculate the difference in the outcome variable between the treatment group and the control group, and obtain the average treatment effect and individual treatment effect; Step S4.35: Standardize the values of the average treatment effect and the individual treatment effect, and output the standardized causal effect value.
[0011] Furthermore, the specific process of step S4.4 is as follows: Step S4.41: normalize the standardized causal effect value and output a normalized causal effect vector; Step S4.42: Estimate the standard error and confidence interval of the normalized causal effect vector using statistical methods; convert the confidence interval width into a confidence index to form a causal relationship confidence matrix containing the causal relationship; Step S4.43: Combine the causal confidence matrix and use the weighted average method to generate an integrated causal score vector; Step S4.44: Convert the integrated causal score vector into structured knowledge and construct a causal propensity score knowledge graph; Step S4.45: Use the cross-validation method to verify the causal propensity score knowledge graph and output the causal propensity score.
[0012] Furthermore, the specific process of step S2 is: Step S2.1: Performing structured analysis on the historical behavior information to extract a set of basic behavior features; Step S2.2: constructing a behavior sequence sample using a sliding window technique based on the basic behavior feature set; Step S2.3: Constructing multi-dimensional correlation features based on the behavior sequence samples and the historical behavior information; Step S2.4: performing nonlinear feature transformation on the multi-dimensional correlation features to output a high-order feature set; Step S2.5: normalize the high-order feature set to obtain a normalized feature matrix.
[0013] Furthermore, the specific process of step S2.5 is as follows: Step S2.51: Use the chi-square test and mutual information method to screen out the strongly correlated features with the target behavior in the high-order feature set; Step S2.52: Sort the strongly correlated features based on random forest feature importance; Step S2.53: Continuously scale the strongly correlated features, perform one-hot encoding on the category features, and output a normalized feature matrix; the category features are directly extracted from the user's historical behavior information.
[0014] Furthermore, based on the normalized feature matrix, the specific process of establishing a behavior prediction model is as follows: Step S3.11: Divide the normalized feature matrix into training set, validation set, and test set; Step S3.12: Construct a multilayer perceptron consisting of an input layer, a hidden layer, and an output layer; Step S3.13: Configure the output layer of the multilayer perceptron, including classification and regression tasks; Step S3.14: Set the loss functions for the classification task and the regression task respectively, and optimize the multilayer perceptron using the Adam optimizer and L2 regularization to obtain the initial behavior prediction model; Step S3.15: Train the initial behavior prediction model using the training set; optimize the hyperparameters during the training of the initial behavior prediction model through random search; evaluate the initial behavior prediction models with different parameter combinations on the validation set, select the model parameter configuration with the lowest loss, and output the staged behavior prediction model; test the staged behavior prediction model using the test set to obtain the behavior prediction model.
[0015] Furthermore, the behavior prediction model parameters are adjusted through the back-propagation algorithm and the optimizer, and the specific process of outputting the prediction error result is as follows: Step S3.21: Input the normalized feature matrix of the current batch into the behavior prediction model and process it through linear transformation and nonlinear activation function to obtain the final predicted output value of the normalized feature matrix of the current batch; Step S3.22: Use the loss function to calculate the difference between the final predicted output value and the true label to obtain the normalized feature matrix loss value of the current batch; Step S3.23: Based on the normalized feature matrix loss value of the current batch, apply the chain rule and reversely deduce layer by layer to calculate the gradient of the effect of the behavior prediction model parameters on the loss, and generate a trainable parameter gradient matrix; Step S3.24: updating the behavior prediction model parameters using the Adam optimizer according to the trainable parameter gradient matrix and the preset learning rate; Step S3.25: After each training batch, calculate and record the updated behavior prediction model parameters; when the preset rounds of training are completed, use the validation set to evaluate the performance of the prediction model and select the optimal prediction model parameters; Step S3.26: Based on the selected optimal prediction model parameters, the final prediction error index is calculated using the test set, and the prediction error result is output.
[0016] Compared with existing technologies, this invention has the following advantages: By constructing a feature association network, screening candidate causal pairs, quantifying causal effects, and calculating causal propensity scores, it achieves in-depth exploration and quantitative evaluation of the causal relationships behind user behavior. This not only helps to reveal the root causes of behavioral prediction errors, but also provides a clear direction for model optimization, significantly improving the model's interpretability and decision support capabilities. By combining causal propensity scores with behavioral prediction models, it not only accurately predicts user behavior but also develops personalized optimization strategies based on causal relationships, achieving a closed loop from prediction to optimization and effectively improving the effectiveness of user behavior guidance. BRIEF DESCRIPTION OF THE DRAWINGS
[0017] Figure 1 Schematic diagram of the method of the present invention. DETAILED DESCRIPTION
[0018] like Figure 1 As shown, the present invention provides a technical solution: a user behavior prediction method based on causal propensity score, comprising the following steps:
[0019] Step S1: Collect the user's historical behavior information from the history database.
[0020] The historical database stores a wealth of user behavior data, and the collection process must adhere to the principles of comprehensiveness, accuracy, and completeness. Specifically, the collected data covers the following categories: Basic attribute information: This includes static characteristics such as the user's age, gender, region, occupation, education level, registration date, and account level. This information is fundamental to understanding the user's basic background. Interaction behavior information: This records various user interactions on the platform, such as page browsing trajectory (including page URLs viewed, dwell time, and order of visits), click behavior (the location and content of buttons, links, ads, etc. clicked), search behavior (search keywords, search frequency, and search time), and comments and feedback (comment content, ratings, and feedback). Transaction behavior information: For platforms involving transactions, user purchase behavior data must be collected, such as the name, specifications, price, purchase time, quantity, payment method, shipping address, and return history of the purchased goods or services. This also includes auxiliary transaction-related information such as shopping cart information and coupon usage. Social behavior information: If the platform has social functions, it is necessary to collect users' social interaction data, such as the content and objects of following, liking, sharing, and forwarding, the content of private message exchanges, and participation in social groups.
[0021] During the data collection process, we first accurately locate and filter data within the historical database based on the user's unique identifier (such as user ID, device ID, etc.). Using database query statements or data interfaces, we extract all relevant user behavior data within a specific timeframe (such as the last three months, six months, or one year) in chronological order. We also perform preliminary data cleaning to remove duplicate data, abnormal data (such as data with obviously illogical browsing times that are too short or too long), and records with excessive missing values to ensure data quality for subsequent processing.
[0022] Step S2: extracting behavioral features from the historical behavioral information, normalizing the extracted behavioral features, and outputting a normalized feature matrix.
[0023] The specific process of step S2 is as follows:
[0024] Step S2.1: Perform structured analysis on the historical behavior information to extract a set of basic behavior features.
[0025] Among them, the extracted basic behavioral feature set includes: behavior type features: mapping user operations to standardized behavior type codes (such as binary identifiers such as click = 001 and purchase = 010); interactive object features: vectorizing entity identifiers such as product IDs and page URLs (one-hot encoding / embedded vectors); time series features: extracting timestamps, time differences between adjacent behaviors, and behavior frequencies counted by period.
[0026] Step S2.2: Based on the basic behavior feature set, a behavior sequence sample is constructed using a sliding window technique.
[0027] Step S2.3: Construct multi-dimensional correlation features based on the behavior sequence samples and the historical behavior information.
[0028] Step S2.4: Perform nonlinear feature transformation on the multi-dimensional correlation features and output a high-order feature set.
[0029] Step S2.5: normalize the high-order feature set to obtain a normalized feature matrix.
[0030] The specific process of step S2.5 is as follows:
[0031] Step S2.51: Use the chi-square test and mutual information method to screen out strongly correlated features in the high-order feature set that are strongly correlated with the target behavior; strongly correlated features refer to high-order features that are screened out through statistical tests and feature importance assessments and are significantly correlated with the target behavior (such as whether the user purchases or clicks, etc.).
[0032] Step S2.52: Sort the strongly correlated features based on the random forest feature importance.
[0033] Step S2.53: Use Z-score to perform continuous feature scaling on the strongly correlated features, perform one-hot encoding on the categorical features, and output a normalized feature matrix.
[0034] The methods for obtaining category features usually include:
[0035] Directly extract defined category features from users' historical behavior information, such as product category codes, page section IDs, and operation terminal types. These features usually exist in the form of string or integer labels.
[0036] Convert the user's historical behavior information into category features based on pre-set rules; for example, map the sequence of "clicking on the product details page → adding to the shopping cart → successful payment" to the "conversion funnel stage". The conversion funnel stage decomposes the user's path from initial behavior to target behavior, and is used to quantitatively analyze the conversion efficiency in key processes. Divide the user's continuous behavior sequence into several key node stages, each stage representing a necessary step for the user to move towards the final goal (such as successful payment). The stage division must meet the following requirements: the subsequent stage must be triggered after the completion of the previous stage (such as "add to shopping cart" must be done before "payment"), each stage must have clear behavior log tags (such as button click events, API calls), and the stages must correspond to core business indicators (such as details page UV → add to cart rate → payment rate).
[0037] Step S3: Based on the normalized feature matrix, a behavior prediction model is established; the behavior prediction model parameters are adjusted through the back propagation algorithm and the optimizer, and the prediction error result is output.
[0038] The specific process of establishing a behavior prediction model based on the normalized feature matrix is as follows:
[0039] Step S3.11: Split the normalized feature matrix into training, validation, and test sets. Specifically, split the normalized feature matrix into training, validation, and test sets in an 8:1:1 ratio. The training set is used for model learning, the validation set is used for hyperparameter tuning, and the test set is used for final evaluation. Maintain a consistent distribution of samples across categories during this split to ensure data independence.
[0040] Step S3.12: Construct a multilayer perceptron consisting of an input layer, hidden layers, and an output layer. The number of neurons in the input layer should be the same as the feature dimension, and the number of neurons in the output layer should be determined based on the prediction task (e.g., 1 for binary classification, or the number of classes for multi-classification). Set the hidden layer to 2-3 layers, with the number of neurons in each layer decreasing in a pyramidal fashion (e.g., 128 → 64 → 32). Use the ReLU activation function, and use the Sigmoid function (for binary classification) or the Softmax function (for multi-classification) in the output layer.
[0041] Step S3.13: Configure the output layer of the multi-layer perceptron, including classification and regression tasks.
[0042] Step S3.14: Set the loss functions for the classification and regression tasks respectively, and use the Adam optimizer and L2 regularization to optimize the multilayer perceptron to obtain the initial behavior prediction model; the Adam optimizer learning rate is set to 0.001, and the early stopping strategy is used to prevent overfitting. The early stopping threshold is set to the validation set loss without a decrease for 10 consecutive rounds.
[0043] Step S3.15: Train the initial behavior prediction model using the training set; optimize the hyperparameters during the training of the initial behavior prediction model through random search; evaluate the initial behavior prediction models with different parameter combinations on the validation set, select the model parameter configuration with the lowest loss, and output the staged behavior prediction model; test the staged behavior prediction model using the test set to obtain the behavior prediction model.
[0044] The specific process of adjusting the behavior prediction model parameters through the back propagation algorithm and the optimizer and outputting the prediction error results is as follows:
[0045] Step S3.21: Input the normalized feature matrix of the current batch into the behavior prediction model, and process it through linear transformation and nonlinear activation function to obtain the final predicted output value of the normalized feature matrix of the current batch.
[0046] Step S3.22: Use the loss function to calculate the difference between the final predicted output value and the true label to obtain the normalized feature matrix loss value of the current batch.
[0047] Step S3.23: Based on the normalized feature matrix loss value of the current batch, apply the chain rule to reversely deduce layer by layer, calculate the gradient of the influence of the behavior prediction model parameters on the loss, and generate a trainable parameter gradient matrix.
[0048] Step S3.24: Based on the trainable parameter gradient matrix and the preset learning rate, the behavior prediction model parameters are updated through the Adam optimizer.
[0049] Step S3.25: After each training batch, calculate and record the updated behavior prediction model parameters; when the preset rounds of training are completed, use the validation set to evaluate the performance of the prediction model and screen out the best prediction model parameters (this process is based on the comprehensive performance after multiple batches of training and can indirectly be related to the loss optimization effect of each batch).
[0050] Step S3.26: Based on the selected optimal prediction model parameters, the final prediction error index is calculated using the test set, and the prediction error result is output.
[0051] Step S4: Analyze the causal relationship between the behavioral features based on the historical behavioral information and calculate a causal tendency score.
[0052] The specific process of step S4 is as follows:
[0053] Step S4.1: Based on historical behavior information, the specific manifestations and occurrence sequences of each corresponding behavioral feature are sorted out. Behavioral features with chronological order and logical associations are mapped to nodes to construct a feature association network. For example, if a user's "browse product details" behavior often occurs before the "add to cart" behavior, a directed edge connecting these two feature nodes is established in the network, forming a topological structure that reflects the potential associations between the features.
[0054] Step S4.2: Based on the feature association network and following the basic principles of causal inference, candidate pairs of behavioral feature nodes are screened for those with causal relationships. By statistically analyzing the co-occurrence frequency of feature pairs in historical data and the distribution of time intervals between occurrences, we can eliminate feature combinations that are merely correlated but not sequential. For example, if "clicking on a promotional ad" and "placing an order" exhibit a causal temporal sequence in 80% of cases, we list them as candidate causal pairs.
[0055] The basic principles of causal inference include temporal precedence, statistical correlation, and elimination of confounding. Temporal precedence means that the cause must occur before the effect, which is the basis for eliminating spurious correlations. Statistical correlation means that the cause and effect must have significant co-occurrence or statistical dependence, such as high co-occurrence frequency and correlation tests. Eliminating confounding means that the observed association cannot be explained by other confounding variables, and confounding factors such as user preferences and promotional intensity must be controlled or adjusted.
[0056] Step S4.3: Use a causal inference algorithm to quantify the strength of the causal relationship between the candidate pairs and obtain a standardized causal effect value. By controlling for the influence of other confounding variables, calculate the difference between the conditional probability of the outcome feature occurring when the causal feature occurs and the probability in the absence of the causal feature. For example, use a propensity score model to estimate the influence of the causal feature "users adding products to favorites" on the outcome feature "ultimate purchase" to obtain a standardized causal effect value.
[0057] Step S4.4: Convert the standardized causal effect value into a causal propensity score in the interval [0, 1]. A higher score indicates a more significant causal influence of the cause feature on the outcome feature. Each causal pair is also labeled with its directionality (e.g., the causal direction of A → B) and a confidence level, forming structured data containing the causal relationship between features and their corresponding scores. For example, the causal propensity score for "View Details → Add to Cart" is 0.78, with a confidence level of 92%, which serves as the basis for subsequent model error analysis.
[0058] The specific process of step S4.1 is as follows:
[0059] Step S4.11: Extract the timestamps and behavior types of user behaviors from historical behavior information and construct a chronological behavior sequence. Identify key attributes of behavioral events (such as user ID, behavior type, and behavior object) to form a structured time series dataset, providing a foundation for subsequent time series analysis.
[0060] Step S4.12: Based on the time-ordered behavior sequence, identify recurring patterns (frequent patterns) in user behavior and output a set of frequent behavior patterns.
[0061] Step S4.13: Based on the temporal distribution characteristics of the time-sorted behavior sequence, and referring to the concentrated period rules of high-frequency behaviors in the frequent behavior pattern set (for example, a certain type of frequent pattern often breaks out in a fixed period), time window division is performed (for example, for the concentrated period of high-frequency patterns, the window size or start and end points are adjusted), and the time window matrix is output to facilitate subsequent time series correlation analysis.
[0062] Step S4.14: Use an association rule mining algorithm (such as the Apriori algorithm) based on the time-ordered behavior sequence and the divided time window matrix, and focus on the high-frequency behavior combinations in the frequent behavior pattern set to mine the association relationship between user behaviors and output a set of behavior association rules; for example, the rule of "browse details ∧ view comments → add to shopping cart".
[0063] Step S4.15: Convert the behavior association rule set into a graph structure to obtain a feature association network; specifically, use the behavior types in the association rule set as nodes and the association rules in the association rule set as directed edges to obtain the feature association network.
[0064] The specific process of step S4.2 is as follows:
[0065] Step S4.21: Verify whether the connection behavior of each directed edge of the feature association network satisfies the temporal order (the cause behavior occurs before the result behavior), select the association pairs that conform to the temporal order (the cause behavior occurs strictly earlier than the result behavior), and output the temporally ordered association pair set.
[0066] Step S4.22: Perform a statistical significance test (such as a hypothesis test) on the set of time-ordered association pairs, and calculate the Pearson correlation coefficient to measure the strength of the association, filter out behavior pairs with no significant statistical correlation, and output a set of significantly correlated behavior pairs.
[0067] Step S4.23: Count the co-occurrence frequencies of each behavior pair in the set of significantly correlated behavior pairs in the historical data, screen out high-frequency co-occurring behavior combinations (i.e., behavior pairs that often appear together and have stable associations), and output the high-frequency co-occurring behavior pair set.
[0068] Step S4.24: For each subset (behavior pair) in the set of high-frequency co-occurring behavior pairs, analyze the time interval distribution of its occurrence, fit a probability distribution model (such as exponential distribution, normal distribution, etc.), and calculate the average time interval and confidence interval.
[0069] Step S4.25: Combine the average time interval, confidence interval, the temporal orderliness of the temporally ordered association pair set in step S4.21, the significant correlation of the significantly correlated behavior pair set in step S4.22, the co-occurrence frequency in step S4.23, and the time interval distribution in step S4.24 to comprehensively determine the causal possibility of the behavior pairs and generate candidate pairs with causal relationships.
[0070] The specific process of step S4.3 is as follows:
[0071] Step S4.31: Based on the normalized feature matrix, identify confounding variables that may affect the causal relationship of the candidate pairs; through feature importance analysis (such as random forest importance score), screen out potential confounding factors that are significantly correlated with both the causal variable and the outcome variable, and output the confounding variable mapping table (including variable name, importance score, and correlation direction).
[0072] Among them, cause variables and result variables are the core elements that constitute the causal relationship.
[0073] Step S4.32: For each candidate pair, a logistic regression model is constructed using the variables in the confounding variable mapping table as input features. The logistic regression model is trained to predict the probability of the user performing the cause behavior, and a propensity score calculation model is obtained.
[0074] Step S4.33: Based on the propensity score calculation model, a matching algorithm (such as nearest neighbor matching, kernel matching) is applied to generate matching samples of the treatment group (users who performed the cause behavior) and the control group (users who did not perform the cause behavior but had similar propensity scores).
[0075] Step S4.34: Estimate the causal effect on the matched sample, calculate the difference in the outcome variable between the treatment group and the control group, and obtain the average treatment effect and individual treatment effect.
[0076] Step S4.35: Standardize the values of the average treatment effect and the individual treatment effect to eliminate the dimensionality effect and output the standardized causal effect value.
[0077] The specific process of step S4.4 is as follows:
[0078] Step S4.41: Use the Z-score to normalize the standardized causal effect value, map it to the interval [0,1], and output the normalized causal effect vector; it is expressed as: ; ; Where, represents the standardized causal effect value; express score; represents the mean of the standardized causal effect value; represents the mean difference of the standardized causal effect values; represents the normalized causal effect vector of the output; express The maximum value in ; express The minimum value in .
[0079] Step S4.42: Estimate the standard error and confidence interval of the normalized causal effect vector through statistical methods; convert the confidence interval width into a confidence index to form a causal relationship confidence matrix containing the causal relationship.
[0080] Among them, the calculated confidence interval can be expressed as: ; Where, represents the confidence interval of the normalized causal effect vector; represents the raw estimate of the normalized causal effect vector; represents the standard error of the original estimate of the normalized causal effect vector; It represents the critical value of the 95% confidence interval under the standard normal distribution.
[0081] Among them, the confidence interval width is converted into a confidence index, which can be expressed as: ; Where, represents the confidence index; represents the exponential function; represents the adjustment parameter; Indicates the width of the confidence interval.
[0082] Step S4.43: Combine the causal relationship confidence matrix and use the weighted average method to generate an integrated causal score vector.
[0083] Among them, the causal relationship confidence matrix C is expressed as: , represents the first confidence indicator, represents the second confidence indicator, It represents the nth confidence index, and each element in the causal relationship confidence matrix C corresponds to the reliability of a causal pair.
[0084] Calculate the integration score for each causal pair : ; right Normalization is performed to ensure that the final score is in the interval [0,1], and the integrated causal score vector F is obtained.
[0085] Step S4.44: Convert the integrated causal score vector into structured knowledge and construct a causal propensity score knowledge graph.
[0086] Step S4.45: Use the cross-validation method to verify the causal propensity score knowledge graph and output the causal propensity score.
[0087] Step S5: Analyze the reasons why the behavior prediction model produces prediction errors based on the causal propensity score; when certain causal relationships are not captured by the behavior prediction model, adjust the corresponding behavior characteristics; update the behavior prediction model based on the adjusted behavior characteristics to obtain an optimized behavior prediction model.
[0088] SHAP values or LIME are used to explain the behavior prediction model's dependence on causal variables and identify under-learned causal paths. If certain causal variables are found to have significant influence but not captured by the original behavioral features, derived features (such as "inter-action entropy") are introduced through feature engineering. For user groups with high propensity scores but low prediction accuracy, targeted transfer learning or adversarial training are used to improve the robustness of the behavior prediction model.
[0089] Causal variables are variables that may influence outcomes, typically interventions or behavioral characteristics, including user behavior and system interventions. User behavior includes things like clicking on promotional ads, browsing product detail pages, and adding items to shopping carts. System interventions include things like sending promotional text messages and distributing coupons.
[0090] Step S6: Use the optimized behavior prediction model to predict user behavior and formulate an optimization strategy based on the causal relationship revealed by the causal propensity score.
[0091] Develop targeted marketing strategies (e.g., optimizing coupon timing) for users with high propensity scores (e.g., those susceptible to promotions). For users with broken causal paths (e.g., those with high activity but low conversion rates), use A / B testing to verify the effectiveness of interventions (e.g., adjusting recommendation algorithm weights). Combine causal effect decomposition (e.g., Do-Calculus) to predict user lifetime value (LTV) and prioritize resource allocation to high-potential users. Feedback on optimization strategy execution results (e.g., user response rate) to step S1 in real time, forming a closed loop of "data collection → causal analysis → strategy iteration."
[0092] While embodiments of the present invention have been shown and described, it will be appreciated by those skilled in the art that various changes, modifications, substitutions, and variations may be made to these embodiments without departing from the principles and spirit of the invention, and that the scope of the invention is defined by the appended claims and their equivalents.
Claims
1. A user behavior prediction method based on causal propensity score, characterized by: include: Step S1: Collecting user's historical behavior information from the history database; Step S2: extracting behavioral features from historical behavioral information, normalizing the extracted behavioral features, and outputting a normalized feature matrix; Step S3: Based on the normalized feature matrix, a behavior prediction model is established; the behavior prediction model parameters are adjusted through the back propagation algorithm and the optimizer, and the prediction error result is output; Step S4: Analyze the causal relationship between the behavioral characteristics based on the historical behavioral information and calculate the causal tendency score; Step S5: Analyze the reasons why the behavior prediction model produces prediction errors based on the causal propensity score; when certain causal relationships are not captured by the behavior prediction model, adjust the corresponding behavior characteristics; The behavior prediction model is updated according to the adjusted behavior characteristics to obtain an optimized behavior prediction model; Step S6: Use the optimized behavior prediction model to predict user behavior and formulate an optimization strategy based on the causal relationship revealed by the causal propensity score.
2. The user behavior prediction method based on causal propensity score according to claim 1, characterized in that: The specific process of step S4 is: Step S4.1: Based on historical behavior information, sort out the specific manifestations and occurrence sequence of each corresponding behavior feature, map the behavior features with chronological order and logical associations to nodes, and construct a feature association network; Step S4.2: Based on the feature association network and the basic principles of causal inference, candidate pairs with causal relationships are selected from all pairs of behavioral feature nodes; Step S4.3: Using a causal inference algorithm, quantify the causal relationship strength of the candidate pairs to obtain a standardized causal effect value; Step S4.4: Convert the standardized causal effect value into a causal propensity score within the set interval.
3. The user behavior prediction method based on causal propensity score according to claim 2, characterized in that: The specific process of step S4.1 is as follows: Step S4.11: Extract the timestamp and behavior type of the user behavior from the historical behavior information and construct a time-ordered behavior sequence; Step S4.12: Based on the time-ordered behavior sequence, identify recurring patterns in user behavior, i.e., frequent patterns, and output a set of frequent behavior patterns; Step S4.13: Based on the temporal distribution characteristics of the time-ordered behavior sequence and referring to the concentrated period of high-frequency behaviors in the frequent behavior pattern set, divide the time window and output the time window matrix; Step S4.14: Use an association rule mining algorithm to mine the associations between user behaviors based on the time-ordered behavior sequences and the partitioned time window matrix, focusing on high-frequency behavior combinations in the frequent behavior pattern set, and output a set of behavior association rules. Step S4.15: Convert the behavior association rule set into a graph structure. Get the feature association network.
4. The user behavior prediction method based on causal propensity score according to claim 3, characterized in that: The specific process of step S4.2 is: Step S4.21: Verify whether the connection behavior of each directed edge of the feature association network satisfies the temporal order, select the association pairs that meet the temporal order, and output the temporally ordered association pair set; Step S4.22: Perform a statistical significance test on the set of time-ordered correlation pairs and calculate the Pearson correlation coefficient to measure the strength of the correlation. Filter out the behavior pairs without significant statistical correlation and output the set of significantly correlated behavior pairs. Step S4.23: Count the co-occurrence frequencies of each behavior pair in the set of significantly correlated behavior pairs in the historical data, filter out the behavior combinations with high frequency co-occurrence, and output the set of high frequency co-occurrence behavior pairs; Step S4.24: For each subset of the high-frequency co-occurring behavior pairs, i.e., behavior pairs, analyze the time interval distribution of their occurrences, fit a probability distribution model, and calculate the average time interval and confidence interval; Step S4.25: Combine the average time interval, confidence interval, the temporal orderliness of the temporally ordered association pair set in step S4.21, the significant correlation of the significantly correlated behavior pair set in step S4.22, the co-occurrence frequency in step S4.23, and the time interval distribution in step S4.24 to comprehensively determine the causal possibility of the behavior pairs and generate candidate pairs with causal relationships.
5. The method for predicting user behavior based on causal propensity scores according to claim 4, characterized in that: The specific process of step S4.3 is: Step S4.31: Based on the normalized feature matrix, identify the confounding variables that affect the causal relationship of the candidate pairs; screen out potential confounding factors related to the causal variable and the outcome variable through feature importance analysis, and output the confounding variable mapping table; Step S4.32: For each candidate pair, using the variables in the confounding variable mapping table as input features, construct a logistic regression model, train the logistic regression model to predict the probability of the user performing the cause behavior, and obtain a propensity score calculation model; Step S4.33: Based on the propensity score calculation model, a matching algorithm is applied to generate matched samples for the treatment group and the control group; Step S4.34: Estimate the causal effect on the matched sample, calculate the difference in the outcome variable between the treatment group and the control group, and obtain the average treatment effect and individual treatment effect; Step S4.35: Standardize the values of the average treatment effect and the individual treatment effect, and output the standardized causal effect value.
6. The user behavior prediction method based on causal propensity score according to claim 5, characterized in that: The specific process of step S4.4 is as follows: Step S4.41: normalize the standardized causal effect value and output a normalized causal effect vector; Step S4.42: Estimate the standard error and confidence interval of the normalized causal effect vector using statistical methods; convert the confidence interval width into a confidence index to form a causal relationship confidence matrix containing the causal relationship; Step S4.43: Combine the causal confidence matrix and use the weighted average method to generate an integrated causal score vector; Step S4.44: Convert the integrated causal score vector into structured knowledge and construct a causal propensity score knowledge graph; Step S4.45: Use the cross-validation method to verify the causal propensity score knowledge graph and output the causal propensity score.
7. The method for predicting user behavior based on causal propensity scores according to claim 6, characterized in that: The specific process of step S2 is: Step S2.1: Performing structured analysis on the historical behavior information to extract a set of basic behavior features; Step S2.2: constructing a behavior sequence sample using a sliding window technique based on the basic behavior feature set; Step S2.3: Constructing multi-dimensional correlation features based on the behavior sequence samples and the historical behavior information; Step S2.4: performing nonlinear feature transformation on the multi-dimensional correlation features to output a high-order feature set; Step S2.5: normalize the high-order feature set to obtain a normalized feature matrix.
8. The method for predicting user behavior based on causal propensity scores according to claim 7, characterized in that: The specific process of step S2.5 is as follows: Step S2.51: Use the chi-square test and mutual information method to screen out the strongly correlated features with the target behavior in the high-order feature set; Step S2.52: Sort the strongly correlated features based on random forest feature importance; Step S2.53: Perform continuous feature scaling on the strongly correlated features, perform one-hot encoding on the categorical features, and output a normalized feature matrix; Category features are directly extracted from users' historical behavior information.
9. The user behavior prediction method based on causal propensity score according to claim 8, characterized in that: Based on the normalized feature matrix, the specific process of establishing a behavior prediction model is as follows: Step S3.11: Divide the normalized feature matrix into training set, validation set, and test set; Step S3.12: Construct a multilayer perceptron consisting of an input layer, a hidden layer, and an output layer; Step S3.13: Configure the output layer of the multilayer perceptron, including classification and regression tasks; Step S3.14: Set the loss functions for the classification task and the regression task respectively, and optimize the multilayer perceptron using the Adam optimizer and L2 regularization to obtain the initial behavior prediction model; Step S3.15: Train the initial behavior prediction model using the training set; optimize the hyperparameters during the training of the initial behavior prediction model through random search; evaluate the initial behavior prediction models with different parameter combinations on the validation set, select the model parameter configuration with the lowest loss, and output the staged behavior prediction model; test the staged behavior prediction model using the test set to obtain the behavior prediction model.
10. The method for predicting user behavior based on causal propensity scores according to claim 9, characterized in that: The specific process of adjusting the behavior prediction model parameters through the back propagation algorithm and optimizer and outputting the prediction error results is as follows: Step S3.21: Input the normalized feature matrix of the current batch into the behavior prediction model and process it through linear transformation and nonlinear activation function to obtain the final predicted output value of the normalized feature matrix of the current batch; Step S3.22: Use the loss function to calculate the difference between the final predicted output value and the true label to obtain the normalized feature matrix loss value of the current batch; Step S3.23: Based on the normalized feature matrix loss value of the current batch, apply the chain rule and reversely deduce layer by layer to calculate the gradient of the effect of the behavior prediction model parameters on the loss, and generate a trainable parameter gradient matrix; Step S3.24: updating the behavior prediction model parameters using the Adam optimizer according to the trainable parameter gradient matrix and the preset learning rate; Step S3.25: After each training batch, calculate and record the updated behavior prediction model parameters; when the preset rounds of training are completed, use the validation set to evaluate the performance of the prediction model and select the optimal prediction model parameters; Step S3.26: Based on the selected optimal prediction model parameters, the final prediction error index is calculated using the test set, and the prediction error result is output.
Citation Information
Patent Citations
Causal inference-based online shopping behavior analysis method and system
CN110245984A
Learning effect optimization method based on user behavior causal relationship in MOOC log data
CN111723973A
User behavior prediction method and system and computer equipment
CN113570204A
Social network comment text sentiment analysis method and system fusing user sentiment tendency
CN114443844A
User behavior prediction method and device
CN116227678A
Cited By
Lithium ion battery thermal runaway multistage early warning system and method and storage medium
CN120879019A
Prediction method for encrypted traffic privacy attack, electronic equipment and storage medium
CN121441652A
Prediction method for encrypted traffic privacy attack, electronic device and storage medium
CN121441652B