General customer portraying method based on decision tree algorithm
By constructing customer profiles based on decision tree algorithms, the problems of simple dimensions and high maintenance costs in traditional methods are solved. Clear and interpretable customer segments are generated, which are suitable for scenarios that require rapid response to business changes, and improve the accuracy of profiles and the operability of business applications.
Patent Information
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- SICHUAN RURAL COMMERCIAL UNITED BANK CO LTD
- Filing Date
- 2025-12-30
- Publication Date
- 2026-04-10
AI Technical Summary
Traditional customer profiling methods are simple in dimensions and rely on expert experience, which leads to decreased accuracy and information bias, making it difficult to respond quickly to business changes, and resulting in high maintenance costs.
Customer profiles are built using a decision tree algorithm. By defining business objectives and core tags, relevant data is obtained, a decision tree model is constructed, and the CART algorithm and parameter optimization are used to generate a visualized decision tree, identify key leaf nodes, and define customer segments.
It achieves a balance between accuracy and interpretability, generating clear and interpretable customer segments suitable for scenarios that require rapid response to dynamic business changes, thus improving the accuracy of profiles and the operability of business applications.
Smart Images

Figure CN121834533A_ABST
Abstract
Description
TECHNICAL FIELD
[0001] The present application relates to the technical field of algorithm, in particular to a general customer portrait method based on decision tree algorithm. BACKGROUND
[0002] The traditional method portrait dimension is simple, and is mostly summarized by experience rules. Too many dimensions increase the difficulty in explainability. In addition, limited portrait dimensions will inevitably lead to a decrease in portrait accuracy and even the possibility of information errors. Rules and statistical models rely on historical data, and it is difficult to reflect behavior changes in a timely manner. For example, the threshold of the portrait dimension often depends on expert experience, but with the development of social economy, the threshold adjustment is often not timely, resulting in portrait information deviation or even errors. Traditional portrait rules need to be formulated by experts, and are highly subjective and have high maintenance costs. SUMMARY
[0003] The purpose of the present application is to provide a general customer portrait method based on a decision tree algorithm, which has the advantage of effectively balancing the precision and explainability of the portrait.
[0004] To achieve the above purpose, the present application provides a general customer portrait method based on a decision tree algorithm, which uses a decision tree model to construct a personal customer portrait. The method comprises the following steps: step S1, determining the business target and core label of the target portrait; step S2, acquiring customer-related data and feature construction according to the business target and core label of the target portrait; step S3, constructing a decision tree model according to the customer-related data and feature construction; and step S4, constructing a personal customer portrait based on the customer-related data and feature construction results through the decision tree model.
[0005] Preferably, the step S1 comprises the following steps: step S11, determining the business target of the target portrait, wherein the business target comprises precision marketing, loss warning, customer group operation, and product recommendation; and step S12, determining the core label of the target portrait, wherein the core label comprises customer value level, loss risk, product preference category, and response to marketing activity tendency.
[0006] Preferably, the step S2 comprises the following steps: step S21, acquiring customer-related data according to the business target and core label of the target portrait, wherein the customer-related data comprises transaction records, behavior logs, customer attributes, and mobile banking browsing records; and step S22, performing feature construction according to the business target and core label of the target portrait, wherein the features comprise basic attributes, behavior features, and loyalty. The core action of S22 is "data processing", that is, the scattered raw data obtained in S21 is refined and transformed into "labeled information" that can directly describe the customer features, thereby laying a foundation for subsequent customer grouping and precision marketing.
[0007] Preferably, the step S3 comprises: a step S31 of dividing the customer-related data and the feature construction into a training set, a validation set and a test set based on a CART algorithm; and a step S32 of outputting a decision tree model.
[0008] Preferably, the step S31 comprises: using parameters including max_depth, taking values from 3 to 8; min_samples_split, taking values from an interval of 10 to 50; min_samples_leaf, ensuring that each portrait group has a sufficient number of customers; max_features, adopting a square root of the total number of features or a logarithm of the total number of features or a fixed number; criterion, adopting commonly used gini or entropy; and class_weight, making the model pay more attention to distinguishing features of a minority class.
[0009] Preferably, the step S4 comprises: a step S41 of visualizing the decision tree model by using graphviz and plot_tree (sklearn); a step S42 of identifying the customer-related data and the feature construction to obtain corresponding key leaf nodes; a step S43 of defining a portrait according to the key leaf nodes; and a step S44 of describing portrait features according to a result of the defined portrait.
[0010] Preferably, the step S43 comprises: defining a rule chain of a customer group as a path from a root node to a target leaf node; and comparing the entire decision tree customer portrait method to a “customer classification fruit tree”, with each node corresponding to a different part of the fruit tree, and the conversion process being like a growth process of the fruit tree from “tree roots” to “fruits”. The root node corresponds to customer data that has not been subjected to any screening, such as all bank customers. The intermediate nodes correspond to customer subgroups that have been subjected to one or more screenings and can continue to produce branched tree branches. The leaf nodes correspond to ordinary leaves, i.e., final customer groups that have been subjected to all screenings and cannot continue to branch. The key leaf nodes correspond to high-quality fruits, i.e., leaf nodes with a large enough sample size and high purity, which have actual business operation values. The target leaf nodes correspond to fruits to be picked, i.e., groups that meet business targets, which are customer portraits for finally realizing precision marketing operations.
[0011] Preferably, the step S44 comprises: when the decision tree splits nodes, the decision tree selects features with the most distinguishing feature responses of target variables, and these features are key dimensions of the portrait. Each path from the root node to the leaf node is a series of “IF-THEN” rules. Customers that meet all conditions on the path finally fall into the same leaf node. Customers in each leaf node have high homogeneity, and naturally form a customer segmentation group, i.e., a specific “portrait”.
[0012] Compared with the prior art, the universal customer portrait method based on the decision tree algorithm has the following beneficial effects:
[0013] First, when splitting nodes, the decision tree selects the features that can best distinguish the target variables (such as purchase behavior, risk of loss, value level, etc.) as nodes for classification. These features are the key dimensions of the portrait.
[0014] Second, each path from the root node to the leaf node is a series of "IF-THEN" rules. Customers who meet all the conditions on the path eventually fall into the same leaf node. Customers in each leaf node have high homogeneity, naturally forming a customer segmentation group, that is, a specific "portrait". The portrait is not a pile of single features, but a combination of key features. And the decision tree can automatically capture the interaction between features (such as "age" and "consumption frequency" affecting value).
[0015] Third, the customer portrait method based on the decision tree has significant advantages in business scenarios due to its unique algorithmic characteristics. This method can effectively balance the precision and interpretability of the portrait, and is particularly suitable for scenarios that require quick response to business dynamics (such as real-time marketing, risk control interception, etc.). BRIEF DESCRIPTION OF DRAWINGS
[0016] Figure 1 A flowchart of the universal customer portrait method based on the decision tree algorithm is provided. DETAILED DESCRIPTION
[0017] The following will be combined with the drawings of the embodiments of the present application Figure 1 The technical solutions, structural features, achieved purposes and effects of the embodiments of the present application will be described in detail.
[0018] It should be noted that the drawings are greatly simplified and use non-precise proportions, only to facilitate and clarify the purpose of assisting in explaining the embodiments of the present application, and are not used to limit the scope of the present application. Therefore, any modification, change of proportion relationship or size adjustment that does not affect the effects and purposes that can be achieved by the present application should still fall within the scope of the disclosed technology.
[0019] It should be noted that in the present application, the relationship terms such as first and second are only used to distinguish one entity or operation from another entity or operation, and do not necessarily require or imply any such actual relationship or order between these entities or operations. Moreover, the terms "include", "contain" or any other variants thereof are intended to cover non-exclusive inclusion, so that the process, method, article or equipment including a series of elements not only includes the elements listed explicitly, but also includes other elements not listed explicitly, or further includes the elements inherent to such process, method, article or equipment.
[0020] As shown in Figure 1 The present application proposes a general customer portrait method based on a decision tree algorithm. The core principle of constructing a personal customer portrait by using a decision tree model is to divide a customer group layer by layer by means of a rule path of a tree structure, and finally form a subdivided group (i.e. a leaf node) with distinct features and strong interpretability, each group representing a customer category. In the division process, the optimal split point is determined by indicators such as information gain, so as to automatically identify the key features that have the greatest impact on customer clustering, and based on these features, the customer portrait can be efficiently constructed.
[0021] The method comprises:
[0022] Step S1, determining the business target and core label of the target portrait;
[0023] Step S2, acquiring customer-related data and feature construction according to the business target and core label of the target portrait;
[0024] Step S3, constructing a decision tree model according to the customer-related data and feature construction;
[0025] Step S4, constructing a personal customer portrait based on the customer-related data and feature construction results by using the decision tree model.
[0026] Specifically, the step S1 comprises:
[0027] Step S11, determining the business target of the target portrait, wherein the business target comprises: precision marketing, loss warning, customer clustering operation, product recommendation;
[0028] Among them, precision marketing refers to recommending different things to people with different preferences, customized services, etc.; loss warning refers to analyzing customer behavior, such as "frequently bought" in the past, and "only looking at not buying" for a long time, and for such customers, whether to lose needs to be paid attention to; customer group operation refers to dividing customers into different categories according to characteristics, such as "frequently bought", "occasionally bought", "only looking at not bought", or "like cost-effective", "like high quality", after grouping, different marketing means are used for different customers; product recommendation refers to a specific means of precision marketing, that is, recommending things that customers like or need.
[0029] Step S12, the core label of the target image is determined, and the core label includes: customer value level, loss risk, product preference category, and response to marketing activity tendency;
[0030] Define the target image core "label" target variable (Y), the label variable must be clear, measurable, and strongly related to the business goal. This determines the growth direction of the tree. For example, customer value level (high / medium / low), loss risk (yes / no), product preference category (A / B / C), and response to marketing activity tendency (yes / no).
[0031] Among them, the measurable index used to accurately define the characteristics of the customer converts the text language into "digital language" for model analysis.
[0032] Customer value level: a standard for measuring how "valuable" a customer is, such as high-value customers who buy high-priced goods frequently over a long period of time; medium-value customers with average consumption ability and frequency; low-value customers who occasionally consume small amounts.
[0033] Loss risk: an indicator to determine whether a customer will "run away" and no longer cooperate, which is determined according to changes in customer behavior. Yes: such as buying every month, and no order for the past 3 months, such customers need to be retained in time; No: the customer's consumption and interaction habits are stable, and there is no indication of loss at the moment.
[0034] Product preference category: a label that clearly identifies which category of products a customer likes, based on the customer's historical purchase and browsing records. For example, a pet supply store can be divided into: A category is dog food / cat food, B category is pet snacks, and C category is pet toys; If a customer always buys A category, it means that his product preference is A category.
[0035] Response to marketing activity tendency: an indicator to determine whether a customer will actively participate in the company's marketing activities, looking at the customer's past feedback on the activities. Yes: such as always taking advantage of coupons, and placing orders when there are promotional activities, such customers are highly sensitive to marketing activities; No: no reaction to activities such as full price reduction, discount, and new product trial, and basically do not participate.
[0036] In particular, the step S2 comprises:
[0037] Step S21, according to the business target of the target portrait and the core label, obtaining customer related data, the customer related data comprising: transaction records, behavior logs, customer attributes, mobile bank browsing records.
[0038] Among them, the transaction record refers to all related data of the customer at the time of transaction in the enterprise. For example, in the bank scene: the customer's transfer amount, financial purchase record, credit card consumption frequency and amount, loan repayment situation, etc.
[0039] Behavior logs: record the "trace data" of the interaction process of customers and enterprises on various platforms (APP, applet, official website). For example: the frequency of customers logging in to the APP, the length of stay, the function entrances clicked, whether they have participated in marketing activities, etc.
[0040] Customer attributes: static data describing the "basic situation" of the customer, mainly including: age, gender, region, occupation, education, contact information, account opening time, etc.
[0041] Mobile bank browsing records: a subdivision of behavior logs, specifically referring to the browsing track of the customer in the mobile bank APP.
[0042] Step S22, according to the business target of the target portrait and the core label, performing feature construction, the features comprising: basic attributes (age, gender, region, occupation, registration channel, membership level, etc.), behavior features (consumption behavior, interaction behavior), loyalty.
[0043] The core action of S22 is "data processing", that is, refining and transforming the scattered raw data obtained in S21 into "labeled information" that can directly describe the characteristics of the customer, laying the foundation for subsequent customer segmentation and precision marketing.
[0044] Basic attributes: directly extract standardized information from the customer attribute data in S21. For example, from the customer's account opening data, extract features such as "age 28, male, Chengdu, occupation bank customer manager".
[0045] Behavior features: classify the scattered data of transaction records, behavior logs, and mobile bank browsing records in S21 into "consumption behavior" and "interaction behavior" two features. Consumption behavior: from transaction records, statistics "monthly consumption amount 5000 yuan, preference for purchasing stable financial products"; interaction behavior: from behavior logs and browsing records, summarize "login to mobile bank 3 times a week, often browse credit card benefits page".
[0046] Loyalty: Combine the previous consumption, interaction, retention data, and score or rank the customer's loyalty. For example, set the rule that high loyalty is high repeat rate ≥ 80% and average monthly login ≥ 4 times; low loyalty is no consumption record and has not logged in for half a year.
[0047] In addition, in the preferred embodiment, the step S22 further comprises: based on feature construction, the data is carefully cleaned and feature engineered according to time window, binning / discretization, standardization / normalization, and missing value processing to meet the subsequent profiling requirements.
[0048] Specifically, the step S3 comprises:
[0049] Step S31, based on the CART (Classification and Regression Trees) algorithm, the customer-related data and feature construction are divided into a training set (for tree building), a validation set (for parameter tuning to prevent overfitting), and a test set (for evaluating the final effect);
[0050] Among them, the use parameters include: max_depth (the maximum depth of the tree), if the depth is too shallow, the profile is too rough; if the depth is too deep, the profile is too fragmented and prone to overfitting, and balance between interpretability and granularity is needed, usually starting from 3-8 for trial. (2) min_samples_split (the minimum number of samples required for node splitting), this parameter is used to avoid creating "special rules" based on a small number of samples, such as behavior characteristics of only 2 or 3 customers. Usually take values from the interval of 10-50, increasing this value can prevent the creation of groups with too few samples. (3) min_samples_leaf (the minimum number of samples required for leaf nodes) ensures that each profile group has a sufficient number of customers. (4) max_features (the number of features considered when splitting nodes) such as the square root (sqrt) of the total number of features, the logarithm (log2) of the total number of features, or a fixed number, which can increase randomness. (5) criterion (splitting criterion) classification commonly uses gini (Gini coefficient) or entropy (entropy). (6) class_weight (class weight adjustment) if the target variable categories are imbalanced (such as few lost customers), the weight can be adjusted to allow the model to pay more attention to the distinguishing features of the minority class.
[0051] Step S32, output the decision tree model.
[0052] Specifically, the step S4 comprises:
[0053] Step S41, visualize the decision tree model using graphviz, plot_tree (sklearn);
[0054] Wherein, Graphviz is an independent open source graph visualization software; plot_tree (sklearn) is a built-in function of python machine learning library; scikit-learn (abbreviated as sklearn) is a built-in function.
[0055] Step S42, identify customer-related data and feature construction, and obtain the corresponding key leaf node;
[0056] Based on the visualized decision tree model in step S41, filter the key nodes meeting the business target from all leaf nodes. Pay attention to those leaf nodes with large sample size (meeting min_samples_leaf) and high purity (for classification, the samples in the node mainly belong to a certain class; for regression, the variance of the target value of the samples in the node is small).
[0057] For example, the first screening condition is that the sample size needs to meet the threshold of the min_samples_leaf parameter set in step S31, to ensure that the customer group has the business value of batch operation; the second condition is that the node purity needs to be high. For classification scenarios (such as customer value level judgment and loss risk identification), the core label (target variable) of the customers in the node needs to be highly concentrated (for example, the proportion of high-value customers in a node is ≥80%); for regression scenarios (such as predicting the consumption amount), the variance of the target variable value of the customers in the node needs to be small (that is, the difference of customer behavior or attribute characteristics is small), to ensure that the group characteristics are distinct and there is no ambiguity.
[0058] Analyze the sample proportion and target variable distribution of each important leaf node (for example, the proportion of high-value customers in the group is 90%, and the loss rate is as high as 40%).
[0059] Step S43, define the portrait according to the key leaf node;
[0060] The rule chain of the customer group is defined as the path from the root node to the target leaf node.
[0061] The whole decision tree customer portrait method is compared to a "customer classification fruit tree", each node corresponds to a different part of the fruit tree, and the conversion process is like the growth process of the fruit tree from "tree roots" to "fruits". The root node is the tree root, which corresponds to the customer data that has not been screened, such as all bank customers; the intermediate node is the trunk or branch, which corresponds to the customer sub-group that has been screened once or more times, and can continue to produce bifurcation branches; the leaf node is the ordinary leaf, that is, the final customer group after all screening, which cannot continue to branch; the key leaf node is the high-quality fruit, which corresponds to the leaf node with sufficient sample size and high purity, which has actual business operation value; the target leaf node is the fruit to be picked, which corresponds to the group that meets the business target, which is the customer portrait for the final realization of precision marketing operation. Give it a simple, image and business landing meaningful portrait name to ensure that business personnel can quickly associate the operation scene.
[0062] The features and split conditions used at each split point on the path are the core features of the portrait group. According to the core features of the group and the significant tendency of the target variable, give it a simple, image and business meaningful name.
[0063] For example: Credit card high-value customers: consumption limit > 10000 & have installment cash & age < 35; Credit card active customers: high consumption frequency & recent consumption is recent; Credit card silent customers: the last consumption is 60-90 days ago; High-value loss risk customers: cumulative consumption amount > 8000 yuan AND no consumption record in the last 90 days AND no mobile banking login in the last 30 days.
[0064] Step S44, define the portrait result and describe the portrait features:
[0065] In addition to the features on the core rule path, the typical performance of the group on other important features (such as mean, median, main category) also needs to be described. Using decision tree to design customer portrait is a "data-driven rule" process. Its advantages lie in automatically identifying key features, generating clear and interpretable customer segmentation rules, and revealing feature interactions. A successful portrait not only needs technical implementation, but also needs deep business understanding to define the target, build meaningful features, verify the value of the portrait and convert it into specific business actions. The clear rule chain makes the portrait generated by the decision tree easy to be understood and applied by the business team, which is the greatest value of the decision tree compared with "black box" models.
[0066] Specifically, the step S44 includes:
[0067] When splitting nodes, the decision tree will select the feature that can best distinguish the target variable (such as purchase behavior, loss risk, value level), which is the key dimension of the portrait.
[0068] Each path from the root node to a leaf node is a series of 'IF-THEN' rules. Customers satisfying all the conditions on the path will end up in the same leaf node. Customers in each leaf node are highly homogeneous, naturally forming a customer segment, i.e. a specific 'portrait'.
[0069] The rules generated by the decision tree are clear and intuitive (e.g. 'IF Age > 35 AND Recent Consumption < 30 days AND Cumulative Consumption > 5000 THEN High Value Active Customer'). Business users can understand the defining characteristics and behavior patterns of each customer segment without complex model knowledge.
[0070] The decision tree can automatically capture the interaction between features (e.g. 'Age' and 'Consumption Frequency' jointly affect value). The portrait is not a pile of single features, but a representation of key feature combinations.
[0071] Although the present application has been described in detail by the foregoing preferred embodiments, it should be recognized that the description given above is not intended to circumscribe the application. Various modifications and alterations of this application will become apparent to those skilled in the art, having the benefit of the above description. It is intended that all such modifications and alterations be considered as falling within the scope of the application as defined by the appended claims.
Claims
1. A general customer profiling method based on decision tree algorithm, characterized in that, The method for constructing a personal customer profile using a decision tree model includes: Step S1: Define the business objectives and core tags of the target profile; Step S2: Based on the business objectives and core tags of the target profile, obtain relevant customer data and feature construction. Step S3: Construct a decision tree model based on customer-related data and characteristics; Step S4: Using a decision tree model, construct a personal customer profile based on the customer-related data and characteristics.
2. The general customer profiling method based on decision tree algorithm according to claim 1, characterized in that, Step S1 includes: Step S11: Define the business objectives of the target profile, including: precision marketing, churn warning, customer segmentation and operation, and product recommendation. Step S12: Define the core tags of the target profile. The core tags include: customer value level, churn risk, product preference category, and tendency to respond to marketing activities.
3. The general customer profiling method based on decision tree algorithm according to claim 2, characterized in that, Step S2 includes: Step S21: Obtain customer-related data based on the business objectives and core tags of the target profile; the customer-related data includes: transaction records, behavior logs, customer attributes, and mobile banking browsing history; Step S22: Based on the business objectives and core tags of the target profile, feature construction is performed. The features include: basic attributes, behavioral characteristics, and loyalty. The core action of S22 is "data processing," which means refining and transforming the scattered raw data obtained by S21 into "tagged information" that can directly describe customer characteristics, laying the foundation for subsequent customer segmentation and precision marketing.
4. The general customer profiling method based on decision tree algorithm according to claim 3, characterized in that, Step S3 includes: Step S31: Based on the CART algorithm, customer-related data and features are divided into training set, validation set, and test set; Step S32: Output the decision tree model.
5. A general customer profiling method based on decision tree algorithm according to claim 4, characterized in that, Step S31 includes: The parameters used include: max_depth, which ranges from 3 to 8; min_samples_split, which ranges from 10 to 50; min_samples_leaf, which ensures that each profile group has a sufficient number of customers; max_features, which uses the square root of the total number of features, the logarithm of the total number of features, or a fixed number; criterion, which uses the commonly used Gini or Entropy; and class_weight, which makes the model focus more on the distinguishing features of the minority class.
6. A general customer profiling method based on decision tree algorithm according to claim 5, characterized in that, Step S4 includes: Step S41: Visualize the decision tree model using graphviz and plot_tree (sklearn); Step S42: Identify customer-related data and features to construct and obtain the corresponding key leaf nodes; Step S43: Define the profile based on the key leaf nodes; Step S44: Describe the portrait features based on the defined portrait results.
7. A general customer profiling method based on decision tree algorithm according to claim 6, characterized in that, Step S43 includes: defining the rule chain of the customer group as the path from the root node to the target leaf node; comparing the entire decision tree customer profiling method to a "customer classification fruit tree", with each node corresponding to a different part of the fruit tree, and the transformation process being like the growth process of the fruit tree from "root" to "fruit"; the root node is the root of the tree, corresponding to customer data that has not undergone any screening, such as all bank customers; the intermediate nodes are the trunk or branches, corresponding to customer subgroups that have undergone one or more screenings, and can continue to generate branching branches; the leaf nodes are ordinary leaves, that is, the final customer group that has undergone all screenings, and cannot continue to branch; the key leaf nodes are high-quality fruits, corresponding to leaf nodes with a sufficiently large sample size and high purity, which have practical business operation value; the target leaf nodes are the fruits to be picked, corresponding to the group that meets the business objectives, and are the customer profiles for ultimately achieving precise marketing operations.
8. A general customer profiling method based on decision tree algorithm according to claim 7, characterized in that, Step S44 includes: when splitting nodes, the decision tree selects the features that best distinguish the target variable, and these features are the key dimensions of the profile; each path from the root node to the leaf node is a series of 'IF-THEN' rules; customers who meet all the conditions on the path will eventually fall into the same leaf node; customers in each leaf node are highly homogeneous, naturally forming a customer segment group, that is, a specific "profile".