Product recommendation method and apparatus
By sorting user attribute information and constructing attribute sets, the use of decision trees in the random forest model is optimized, solving the problems of inaccurate classification and low efficiency of the random forest model in traffic product recommendation in the existing technology, and realizing more efficient and accurate product recommendation.
Patent Information
- Application Number
- CN202110541094.3
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2021-05-18
- Publication Date
- 2026-01-27
- Estimated Expiration
- 2041-05-18
AI Technical Summary
In existing traffic product recommendation methods, the random forest model suffers from inaccurate classification and high algorithm complexity due to the correlation between users' basic attribute information, which affects decision-making speed and recommendation effect.
By sorting the attribute information of target users, constructing an attribute set and extracting statistical features, and using this as input to a random forest model, combined with the confidence threshold control of decision trees, the use of decision trees is optimized to improve recommendation accuracy and efficiency.
The correlation of input data to random forests is reduced, which improves the accuracy and efficiency of product recommendations. The number of decision trees is reduced, which improves the accuracy and speed of recommendations.
Smart Images

Figure CN115374345B_ABST
Abstract
Description
Technical Field
[0001] This invention relates to the field of data mining technology, and in particular to a product recommendation method and apparatus. Background Technology
[0002] With the widespread adoption of 4G and 5G, decreasing data tariffs, and the ubiquitous use of smartphones, data usage has surpassed voice call needs, and many call scenarios can now be handled via data. Current product recommendation methods used by operators to address customer data demands are severely inadequate to meet the rapidly increasing demand.
[0003] Currently, existing methods for recommending traffic products include clustering methods, random forest methods, Bayesian methods, and neural network-based methods. Among them, the random forest method, based on the existing decision tree theory, combines multiple decision tree classification models into a composite classification model, also known as a forest. Moreover, the data samples relied upon by each individual decision tree are independent and identically distributed, and the classification result is finally determined by the joint voting of all decision trees.
[0004] When using random forests for product recommendations, raw user attributes are directly used as input. Generally, user attributes have a certain degree of correlation, but training a decision tree requires attributes to be independent. The impact of correlated user attributes on the accuracy of the decision tree changes exponentially, leading to inaccurate classification and poor recommendation performance in random forests. Furthermore, as the number of user attributes increases, the algorithmic complexity of random forests increases exponentially, further affecting decision-making speed. Summary of the Invention
[0005] This invention provides a product recommendation method and apparatus to address the shortcomings of inaccurate and inefficient product recommendations in the prior art, thereby improving the accuracy and efficiency of product recommendations.
[0006] This invention provides a product recommendation method, comprising:
[0007] The attribute information of the target user is sorted, the attribute information in the middle position of the sorting result is obtained, and the attribute information before and after the middle position in the sorting result is divided into the same number of groups.
[0008] Based on any two sets of attribute information symmetrical about the intermediate position and the attribute information located at the intermediate position, construct an attribute set and extract the statistical features of each attribute set;
[0009] The statistical features of all attribute sets are used as input to the random forest model, and the output is the products recommended to the target user.
[0010] The random forest model is trained using the attribute information of the first sample user as training samples and the products that the first sample user has historically queried or used as labels.
[0011] According to the product recommendation method provided by the present invention, the step of using the statistical features of all attribute sets as input to a random forest model and outputting products recommended to the target user includes:
[0012] Calculate the confidence level of the probability of each currently used decision tree in the random forest model voting for a product within a preset confidence interval;
[0013] If the confidence level is greater than a first preset threshold, or less than or equal to 1 minus the first preset threshold, the product recommended to the target user is obtained based on the currently used decision tree.
[0014] According to a product recommendation method provided by the present invention, the probability of each decision tree currently used in the random forest model voting for a product is obtained by the following formula:
[0015]
[0016]
[0017] Where P is the probability distribution corresponding to each product, p is the probability that each decision tree recommends the product, h is the number of classifiers that recommend the product, α is the number of decision trees currently in use, a is the minimum value within the preset confidence interval, and n is an integer.
[0018] According to a product recommendation method provided by the present invention, the step of obtaining products to recommend to the target user based on the currently used decision tree includes:
[0019] Calculate the average confidence level of the probability of each product being voted for by all currently used decision trees within a predefined confidence interval;
[0020] The products with the highest average confidence level are selected as the products recommended to the target user.
[0021] According to a product recommendation method provided by the present invention, before taking the statistical features of all attribute sets as input to a random forest model and outputting products recommended to the target user, the method further includes:
[0022] The attribute information of the first sample user is sorted, and the attribute information located in the middle position in the sorting result corresponding to the first sample user is obtained. The attribute information before and after the middle position in the sorting result corresponding to the first sample user is divided into the same number of groups.
[0023] Based on any two sets of attribute information symmetrical about the middle position corresponding to the first sample user and the attribute information located at the middle position, construct the attribute set corresponding to the first sample user, and extract the statistical features of each attribute set corresponding to the first sample user.
[0024] Using the statistical features of the attribute sets corresponding to the first sample users, a decision tree is constructed, and the random forest model is built based on the decision tree.
[0025] According to a product recommendation method provided by the present invention, the random forest model is tested using the attribute information of a second sample user as a test sample and the products historically queried by the second sample user as labels, so as to obtain the accuracy of the products recommended to the second sample user.
[0026] If the accuracy is less than the second preset threshold, the attribute information of the first sample user is reordered and the random forest model is built and tested again until the accuracy of the product recommended to the second sample user is greater than or equal to the second preset threshold.
[0027] Accordingly, the step of using the statistical features of all attribute sets as input to the random forest model and outputting products recommended to the target user includes:
[0028] The statistical features of all attribute sets corresponding to the target user are used as input to a random forest model with an accuracy greater than or equal to the preset threshold, and the output is the product recommended to the target user.
[0029] According to a product recommendation method provided by the present invention, the attribute information of the target user includes the basic information of the target user and the historical query information of the target user.
[0030] The present invention also provides a product recommendation device, comprising:
[0031] The grouping module is used to sort the attribute information of the target user, obtain the attribute information located in the middle position of the sorting result, and divide the attribute information before and after the middle position in the sorting result into the same number of groups.
[0032] The extraction module is used to construct an attribute set based on any two sets of attribute information symmetrical about the intermediate position and the attribute information located at the intermediate position, and to extract the statistical features of each attribute set;
[0033] The prediction module is used to take the statistical features of all attribute sets as input to the random forest model and output products recommended to the target user.
[0034] The random forest model is trained using the attribute information of the first sample user as training samples and the products that the first sample user has historically queried or used as labels.
[0035] The present invention also provides an electronic device, including a memory, a processor, and a computer program stored in the memory and executable on the processor, wherein the processor executes the program to implement the steps of any of the product recommendation methods described above.
[0036] The present invention also provides a non-transitory computer-readable storage medium having a computer program stored thereon, which, when executed by a processor, implements the steps of the product recommendation method as described above.
[0037] The product recommendation method and apparatus provided by this invention replace the original user information with statistical features of attribute sets with a certain degree of correlation as the input of random forest. On the one hand, this greatly reduces the amount of data input to random forest and improves the efficiency of product recommendation; on the other hand, it reduces the correlation of random forest input data and improves the accuracy of product recommendation. Attached Figure Description
[0038] To more clearly illustrate the technical solutions in this invention or the prior art, the drawings used in the description of the embodiments or the prior art will be briefly introduced below. Obviously, the drawings described below are some embodiments of this invention. For those skilled in the art, other drawings can be obtained from these drawings without creative effort.
[0039] Figure 1 This is one of the flowcharts illustrating the product recommendation method provided by the present invention;
[0040] Figure 2 This is a flowchart illustrating the feature attribute extraction method based on central structure in the product recommendation method provided by the present invention;
[0041] Figure 3 This is a schematic diagram of the product push process in the product recommendation method provided by the present invention;
[0042] Figure 4 This is a schematic diagram of the structure of the improved random forest model in the product recommendation method provided by the present invention;
[0043] Figure 5 This is a schematic diagram of the training process of the improved random forest model in the product recommendation method provided by the present invention;
[0044] Figure 6 This is the second flowchart illustrating the product recommendation method provided by the present invention;
[0045] Figure 7This is a schematic diagram of the product recommendation device provided by the present invention;
[0046] Figure 8 This is a schematic diagram of the structure of the electronic device provided by the present invention. Detailed Implementation
[0047] To make the objectives, technical solutions, and advantages of this invention clearer, the technical solutions of this invention will be clearly and completely described below with reference to the accompanying drawings. Obviously, the described embodiments are only some, not all, of the embodiments of this invention. All other embodiments obtained by those skilled in the art based on the embodiments of this invention without creative effort are within the scope of protection of this invention.
[0048] The following is combined with Figure 1 The product recommendation method of the present invention includes: step 101, sorting the attribute information of the target user, obtaining the attribute information located in the middle position in the sorting result, and dividing the attribute information located before and after the middle position in the sorting result into the same number of groups;
[0049] The target user is the user who needs product recommendations. The target user's attribute information, such as name, age, and online behavior, is not limited in this embodiment.
[0050] Optionally, before obtaining product recommendations from target users, attribute information of the target users can be collected and preprocessed. Due to the limitations of the random forest classifier, non-numerical attribute data needs to be quantified, and continuous numerical data needs to be discretized.
[0051] Non-numerical data may be symbols, states, or categories. It can have two or more states. For example, there are M types of job positions, such as technical, management, and service positions. These can be represented by a set of integers, such as 1, 2, ..., M. These integers are only used for data processing and do not represent any specific order.
[0052] For continuous attributes, such as age being old, middle-aged, and youth, let's assume that those under 40 are youth, represented by the number 1; those between 40 and 60 are middle-aged, represented by the number 2; and those over 60 are old, represented by the number 3.
[0053] The ranking of the target user's attribute information is consistent with the ranking of the attribute information of the first sample user used by the optimal random forest model obtained through training.
[0054] like Figure 2 As shown, assume the target user has m attribute information. Each attribute is given a unique sequence number based on its order, denoted as (1), (2), ..., (m). Define a(m) Let a be the attribute label corresponding to the sequence number (m). Let the attribute labels of (1), (2), ..., (m) be a respectively. (1) ,...,a (m) .
[0055] Step 102 is used to construct an attribute set based on any two sets of attribute information symmetrical about the intermediate position and the attribute information located at the intermediate position, and to extract the statistical features of each attribute set.
[0056] attribute labels in the middle position Starting from the left and right, the attribute is expanded synchronously with a step size of k. This yields the attribute set corresponding to the following ω group of attribute labels. This method of constructing attribute sets is called central structuring. The function represents rounding down.
[0057]
[0058] For attribute collection And all its quantized attribute values, firstly, the attribute value e of each group is normalized, such as Figure 2 As shown in the third line of the document.
[0059] definition For each set of attributes, a statistical characteristic of the attribute values is used as the value of the feature attribute. This statistical characteristic can be the mean. This results in ω feature attributes, denoted as S1, S2, ..., S... ω .
[0060] Step 103: Use the statistical features of all attribute sets as input to the random forest model, and output the products recommended to the target user.
[0061] In classification prediction using a random forest model, after all decision trees in the random forest model have made their decisions, the probability of each category being selected is calculated. The probabilities of each category being selected are then sorted in descending order, and the top λ categories are selected as the prediction results based on user needs. Typically, λ takes values of 1, 4, 9, and 16.
[0062] Optionally, the products recommended to the target users may be data products or communication tariff products.
[0063] The random forest model is trained using the attribute information of the first sample user as training samples and the products that the first sample user has historically queried or used as labels.
[0064] This embodiment replaces the original user information with statistical features of attribute sets with a certain degree of correlation as the input of the random forest. On the one hand, this greatly reduces the amount of data input to the random forest and improves the efficiency of product recommendation; on the other hand, it reduces the correlation of the input data of the random forest and improves the accuracy of product recommendation.
[0065] Based on the above embodiments, the step of using the statistical characteristics of all attribute sets as input to the random forest model and outputting products recommended to the target user in this embodiment includes: calculating the confidence level of the probability of each decision tree currently used in the random forest model voting for a product within a preset confidence interval;
[0066] If the conclusions reached by the random forest using α decision tree classifiers are the same as those reached by all decision tree classifiers, then the push consistency is considered satisfied.
[0067] The random forest model is used to decide which product to recommend. Since the product to be recommended has a binary nature, if the random forest model recommends the current product, it is called a positive sample; if the random forest model does not recommend the product, it is called a negative sample.
[0068] For α decision tree classifiers in a random forest model, if each classifier independently determines whether a product is a positive sample with a probability p (unknown beforehand and to be estimated), then the probability that there are h positive samples in the observations follows a binomial distribution:
[0069]
[0070] When the number of votes h and the number of trials α are known, the distribution of p calculated using Bayes' formula is as follows:
[0071]
[0072] Where P(p|α)=P(p), this is an uninformative prior distribution of p, therefore, by simplifying formula (2), we get:
[0073]
[0074] Substituting formula (1) into formula (3), we obtain the joint prior β distribution of the binomial as:
[0075]
[0076] In formula (4), the distribution of the random variable p is calculated using probability calculations to ensure the consistency of the positive sample results, and K represents the vertex of the binomial. The confidence level of the probability of each decision tree voting for a product is calculated within a pre-set confidence interval.
[0077] If the confidence level is greater than a first preset threshold, or less than or equal to 1 minus the first preset threshold, the product recommended to the target user is obtained based on the currently used decision tree.
[0078] The first preset threshold depends on the required recommendation accuracy. If the confidence level exceeds the first preset threshold, or falls below 1 minus the first preset threshold, the startup of subsequent classifiers is terminated. Products recommended to the target user are determined based on the votes of the enabled decision trees, thereby effectively improving recommendation efficiency.
[0079] Based on the above embodiments, the probability of each decision tree currently used in the random forest model in this embodiment voting for a product is obtained by the following formula:
[0080]
[0081]
[0082] Where P is the probability distribution corresponding to each product, p is the probability that each decision tree recommends the product, h is the number of classifiers that recommend the product, α is the number of decision trees currently in use, a is the minimum value within the preset confidence interval, and n is an integer.
[0083] P(p≥a|h,α) is the basis for whether the classifier of the random forest model pushes products. When the preset confidence interval is [0.5,1], a is 0.5.
[0084] In order to improve the slow classification prediction speed of random forest, this embodiment dynamically decides whether to activate the next classifier based on whether the currently activated decision tree classifier has reached a preset threshold condition. This can effectively reduce the number of decision tree classifiers in the random forest model and speed up the classification prediction speed of random forest.
[0085] Based on the above embodiments, the method of obtaining products recommended to the target user based on the currently used decision trees in this embodiment includes: calculating the average confidence level of the probability of all currently used decision trees voting for each product within a preset confidence interval; and selecting a preset number of products with the highest average confidence level as products recommended to the target user.
[0086] Specifically, the confidence scores of votes cast for each product by all used decision trees are averaged. Recommending the top pre-defined number of products with the highest average confidence scores to the target user effectively improves recommendation efficiency while meeting accuracy requirements.
[0087] The product push process is as follows: Figure 3 As shown, it includes the following steps:
[0088] 1. Extract and quantify the target user's basic attributes and historical query records.
[0089] 2. Extract user attribute information from the optimal random forest model obtained through training, and input it into the optimal random forest model to obtain the confidence level of the products that the target user is interested in being selected by each decision tree. Then, sort the mean confidence level in descending order, and select the identifiers of the top λ products as the prediction results according to the number of recommended products displayed by the user.
[0090] 3. Based on the product identifier, retrieve the product corresponding to the product from the relevant table and display the product on the query interface.
[0091] Product matching involves matching the product identifiers with the results predicted by a random forest classifier and the table containing the product. Product push is the process of pushing the products that the user needs to the user after product matching.
[0092] Based on the above embodiments, in this embodiment, before the statistical features of all attribute sets are used as input to the random forest model and the product recommended to the target user is output, the method further includes: sorting the attribute information of the first sample user, obtaining the attribute information located in the middle position in the sorting result corresponding to the first sample user, and dividing the attribute information before and after the middle position in the sorting result corresponding to the first sample user into the same number of groups.
[0093] Based on any two sets of attribute information symmetrical about the middle position corresponding to the first sample user and the attribute information located at the middle position, construct the attribute set corresponding to the first sample user, and extract the statistical features of each attribute set corresponding to the first sample user.
[0094] Using the statistical features of the attribute sets corresponding to the first sample users, a decision tree is constructed, and the random forest model is built based on the decision tree.
[0095] Specifically, compared to the original extracted user attribute information, the correlation between feature attributes based on center-structured methods is significantly reduced, resulting in significantly better classification performance for the random forest model. The improved random forest model, such as... Figure 4 As shown.
[0096] The construction of the improved random forest model includes the following steps:
[0097] 1. Data sampling based on the Bagging method. For random forests, the Bagging method is used to randomly sample N samples with replacement from the original training set X to form a sample set X1. Sample sets X2...Xα are constructed using the same method. While meeting the user's accuracy requirements, the smaller the value of α, the better. These sample sets are used to construct the training sample sets for each decision tree.
[0098] 2. Forest Construction. For each decision tree in the random forest model, randomly select... Each feature attribute variable forms a feature subspace. Then, the splitting value for each feature attribute is calculated based on information gain, and the optimal result is used as the splitting criterion for that node. Following this method, a decision tree is constructed on each sample subspace. Each decision tree grows without pruning, and finally, all decision trees are combined into a random forest model.
[0099] 3. Classification Prediction. When using the random forest model to predict the classification of test samples, each decision tree classifier votes on the test sample, then all the voting results are aggregated, and finally, a majority voting strategy is used to determine the final classification result of the test sample.
[0100] Based on the above embodiments, in this embodiment, after constructing the random forest model according to the decision tree, the method further includes: using the attribute information of the second sample user as a test sample and the products historically queried by the second sample user as labels to test the random forest model and obtain the accuracy of the products recommended to the second sample user;
[0101] If the accuracy is less than the second preset threshold, the attribute information of the first sample user is reordered and the random forest model is built and tested again until the accuracy of the product recommended to the second sample user is greater than or equal to the second preset threshold.
[0102] Accordingly, the step of using the statistical features of all attribute sets as input to a random forest model and outputting products recommended to the target user includes: using the statistical features of all attribute sets corresponding to the target user as input to a random forest model with a precision greater than or equal to the preset threshold, and outputting products recommended to the target user.
[0103] Specifically, the training process of the improved random forest model is as follows: Figure 5 As shown, it includes the following steps:
[0104] A detailed flowchart of the improved random forest training process is provided below, outlining the specific steps:
[0105] 1. Initialize the random forest model, which mainly includes the selection of training samples and test samples, and the determination of the number of decision trees.
[0106] 2. Initialize the attribute sequence number of the sample data.
[0107] 3. Feature attribute extraction based on center-structured approach. First, attribute labels are determined based on the attribute sequence numbers of the samples. Then, the feature attributes of the samples are solved using the center-structured approach.
[0108] 4. Determine the number of decision trees, randomly select feature attributes and training samples for each decision tree, and form a forest after all decision trees are built.
[0109] 5. Test the random forest model using the test sample set and determine whether the current random forest model is optimal. If it is not optimal, rearrange the attribute sequence numbers and return to step 2. If it is optimal, determine the optimal random forest model as the random forest model for recommending products.
[0110] This embodiment classifies and makes decisions on test samples based on the currently trained optimal random forest model, and then calculates the accuracy of the decision results, i.e., the proportion of correctly decided attribute categories. Whether to retrain the random forest is determined by whether the current calculated decision accuracy is the optimal solution. If the current classification accuracy reaches the highest level, the attribute sorting method corresponding to the current basic attribute sequence number is determined as the optimal sorting method, and the current forest model is the optimal model. If the current decision accuracy does not reach the highest level, the basic attributes are re-sorted, and the random forest model is trained again.
[0111] Based on the above embodiments, the attribute information of the target user in this embodiment includes the basic information of the target user and the historical query information of the target user.
[0112] Optionally, the user's basic information can be extracted using the user ID as a unique identifier. This includes the user's name, age, job title, position, department, network access channel, sales outlet, service plan tier, average monthly spending, average monthly data usage, and detailed feature information such as data usage behavior, targeted data usage behavior, and the percentage of data usage consumed. The user's basic information is stored in the user basic information table, as shown in Table 1.
[0113] Table 1. Sample of User Basic Information Table
[0114]
[0115] Simultaneously, user historical query records are extracted using user IDs to construct user query behavior structure data, which is then stored in the user query history information table, as shown in Table 2. This table includes information such as query time.
[0116] Table 2: Sample of User Historical Query Information
[0117]
[0118] Using the user ID as the connection attribute, the user basic information table and the historical query information table are merged to obtain a comprehensive information table, as shown in Table 3. The user ID number serves as a record identifier and is not used as an attribute in the category. The complete product recommendation flowchart of this embodiment is shown below. Figure 6 As shown.
[0119] Table 3. Sample of Comprehensive Information Table
[0120]
[0121] The product recommendation device provided by the present invention is described below. The product recommendation device described below can be referred to in correspondence with the product recommendation method described above.
[0122] like Figure 7 As shown, the device includes a grouping module 701, an extraction module 702, and a prediction module 703, wherein:
[0123] The grouping module 701 is used to sort the attribute information of the target user, obtain the attribute information located in the middle position in the sorting result, and divide the attribute information located before and after the middle position in the sorting result into the same number of groups.
[0124] The extraction module 702 is used to construct an attribute set based on any two sets of attribute information symmetrical about the intermediate position and the attribute information located at the intermediate position, and to extract the statistical features of each attribute set;
[0125] The prediction module 703 is used as the statistical features of all attribute sets as input to the random forest model and outputs products recommended to the target user.
[0126] The random forest model is trained using the attribute information of the first sample user as training samples and the products that the first sample user has historically queried or used as labels.
[0127] This embodiment replaces the original user information with statistical features of attribute sets with a certain degree of correlation as the input of the random forest. On the one hand, this greatly reduces the amount of data input to the random forest and improves the efficiency of product recommendation; on the other hand, it reduces the correlation of the input data of the random forest and improves the accuracy of product recommendation.
[0128] Based on the above embodiments, the prediction module in this embodiment is used to: calculate the confidence level of the probability of each currently used decision tree in the random forest model voting for a product within a preset confidence interval; and, if the confidence level is greater than a first preset threshold, or less than or equal to 1 minus the first preset threshold, obtain the product recommended to the target user based on the currently used decision trees.
[0129] Based on the above embodiments, the probability of each decision tree currently used in the random forest model in this embodiment voting for a product is obtained by the following formula:
[0130]
[0131]
[0132] Where P is the probability distribution corresponding to each product, p is the probability that each decision tree recommends the product, h is the number of classifiers that recommend the product, α is the number of decision trees currently in use, a is the minimum value within the preset confidence interval, and n is an integer.
[0133] Based on the above embodiments, the prediction module in this embodiment is used to: calculate the average confidence level of the probability of all currently used decision trees voting for each product within a preset confidence interval; and select the products with the highest preset number of average confidence levels as the products recommended to the target user.
[0134] Based on the above embodiments, this embodiment further includes a construction module, used to sort the attribute information of the first sample user, obtain the attribute information located in the middle position of the sorting result corresponding to the first sample user, divide the attribute information before and after the middle position in the sorting result corresponding to the first sample user into the same number of groups; construct the attribute set corresponding to the first sample user based on any two groups of attribute information symmetrical about the middle position corresponding to the first sample user and the attribute information located in the middle position, extract the statistical features of each attribute set corresponding to the first sample user; construct a decision tree using the statistical features of each attribute set corresponding to the first sample user, and construct the random forest model based on the decision tree.
[0135] Based on the above embodiments, this embodiment further includes an optimization module, used to test the random forest model using the attribute information of the second sample user as a test sample and the products historically queried by the second sample user as labels, to obtain the accuracy of the products recommended to the second sample user; if the accuracy is less than a second preset threshold, the attribute information of the first sample user is reordered and the random forest model is rebuilt and tested until the accuracy of the products recommended to the second sample user is greater than or equal to the second preset threshold; correspondingly, the prediction module is used to: take the statistical features of all attribute sets corresponding to the target user as input to the random forest model with an accuracy greater than or equal to the preset threshold, and output the products recommended to the target user.
[0136] Based on the above embodiments, the attribute information of the target user in this embodiment includes the basic information of the target user and the historical query information of the target user.
[0137] Figure 8 An example is a schematic diagram of the physical structure of an electronic device, such as... Figure 8 As shown, the electronic device may include a processor 810, a communication interface 820, a memory 830, and a communication bus 840, wherein the processor 810, the communication interface 820, and the memory 830 communicate with each other through the communication bus 840. The processor 810 can call logical instructions in the memory 830 to execute a product recommendation method. The method includes: sorting the attribute information of the target user, obtaining the attribute information located in the middle position of the sorting result, dividing the attribute information before and after the middle position in the sorting result into the same number of groups; constructing an attribute set based on any two groups of attribute information symmetrical about the middle position and the attribute information located in the middle position, and extracting statistical features of each attribute set; using the statistical features of all attribute sets as input to a random forest model, and outputting products recommended to the target user.
[0138] Furthermore, the logical instructions in the aforementioned memory 830 can be implemented as software functional units and, when sold or used as independent products, can be stored in a computer-readable storage medium. Based on this understanding, the technical solution of the present invention, essentially, or the part that contributes to the prior art, or a part of the technical solution, can be embodied in the form of a software product. This computer software product is stored in a storage medium and includes several instructions to cause a computer device (which may be a personal computer, server, or network device, etc.) to execute all or part of the steps of the methods described in the various embodiments of the present invention. The aforementioned storage medium includes various media capable of storing program code, such as USB flash drives, portable hard drives, read-only memory (ROM), random access memory (RAM), magnetic disks, or optical disks.
[0139] On the other hand, the present invention also provides a computer program product, the computer program product comprising a computer program stored on a non-transitory computer-readable storage medium, the computer program comprising program instructions, wherein when the program instructions are executed by a computer, the computer is able to execute the product recommendation method provided by the above methods, the method comprising: sorting the attribute information of the target user, obtaining the attribute information located in the middle position of the sorting result, dividing the attribute information before and after the middle position in the sorting result into the same number of groups; constructing an attribute set based on any two groups of attribute information symmetrical about the middle position and the attribute information located in the middle position, extracting statistical features of each attribute set; using the statistical features of all attribute sets as input to a random forest model, and outputting products recommended to the target user.
[0140] In another aspect, the present invention also provides a non-transitory computer-readable storage medium storing a computer program thereon, which, when executed by a processor, implements the product recommendation methods provided above. The method includes: sorting the attribute information of the target user; obtaining the attribute information located in the middle position of the sorting result; dividing the attribute information before and after the middle position in the sorting result into the same number of groups; constructing an attribute set based on any two groups of attribute information symmetrical about the middle position and the attribute information located in the middle position; extracting statistical features of each attribute set; and using the statistical features of all attribute sets as input to a random forest model, outputting products recommended to the target user.
[0141] The device embodiments described above are merely illustrative. The units described as separate components may or may not be physically separate. The components shown as units may or may not be physical units; that is, they may be located in one place or distributed across multiple network units. Some or all of the modules can be selected to achieve the purpose of this embodiment according to actual needs. Those skilled in the art can understand and implement this without any creative effort.
[0142] Through the above description of the embodiments, those skilled in the art can clearly understand that each embodiment can be implemented by means of software plus necessary general-purpose hardware platforms, and of course, it can also be implemented by hardware. Based on this understanding, the above technical solutions, in essence or the part that contributes to the prior art, can be embodied in the form of a software product. This computer software product can be stored in a computer-readable storage medium, such as ROM / RAM, magnetic disk, optical disk, etc., and includes several instructions to cause a computer device (which may be a personal computer, server, or network device, etc.) to execute the methods described in the various embodiments or some parts of the embodiments.
[0143] Finally, it should be noted that the above embodiments are only used to illustrate the technical solutions of the present invention, and not to limit them; although the present invention has been described in detail with reference to the foregoing embodiments, those skilled in the art should understand that modifications can still be made to the technical solutions described in the foregoing embodiments, or equivalent substitutions can be made to some of the technical features; and these modifications or substitutions do not cause the essence of the corresponding technical solutions to deviate from the spirit and scope of the technical solutions of the embodiments of the present invention.
Claims
1. A product recommendation method, characterized in that, include: The attribute information of the target user is sorted, the attribute information in the middle position of the sorting result is obtained, and the attribute information before and after the middle position in the sorting result is divided into the same number of groups. Based on any two sets of attribute information symmetrical about the intermediate position and the attribute information located at the intermediate position, construct an attribute set and extract the statistical features of each attribute set; The statistical features of all attribute sets are used as input to the random forest model, and the output is the products recommended to the target user. The random forest model is trained using the attribute information of a first sample user as training samples and the products historically queried or used by the first sample user as labels. The step of using the statistical features of all attribute sets as input to the random forest model and outputting recommended products to the target user includes: Calculate the confidence level of the probability of each currently used decision tree in the random forest model voting for a product within a preset confidence interval; If the confidence level is greater than a first preset threshold, or less than or equal to 1 minus the first preset threshold, the product recommended to the target user is obtained based on the currently used decision tree; The step of obtaining recommended products for the target user based on the currently used decision tree includes: Calculate the average confidence level of the probability of each product being voted for by all currently used decision trees within a predefined confidence interval; The products with the highest average confidence level are selected as the products recommended to the target user.
2. The product recommendation method according to claim 1, characterized in that, The probability that each decision tree currently used in the random forest model votes for a product is obtained using the following formula: ; ; Where P represents the probability distribution for each product. p The probability of recommending this product for each decision tree. h To recommend the number of classifiers for this product, denoted as the number of decision trees currently in use, 'a' as the minimum value within the preset confidence interval, and 'n' as an integer.
3. The product recommendation method according to any one of claims 1-2, characterized in that, Before using the statistical features of all attribute sets as input to the random forest model and outputting products recommended to the target user, the method further includes: The attribute information of the first sample user is sorted, and the attribute information located in the middle position in the sorting result corresponding to the first sample user is obtained. The attribute information before and after the middle position in the sorting result corresponding to the first sample user is divided into the same number of groups. Based on any two sets of attribute information symmetrical about the middle position corresponding to the first sample user and the attribute information located at the middle position, construct the attribute set corresponding to the first sample user, and extract the statistical features of each attribute set corresponding to the first sample user. Using the statistical features of the attribute sets corresponding to the first sample users, a decision tree is constructed, and the random forest model is built based on the decision tree.
4. The product recommendation method according to claim 3, characterized in that, After constructing the random forest model based on the decision tree, the method further includes: Using the attribute information of the second sample user as the test sample and the products historically queried by the second sample user as the labels, the random forest model is tested to obtain the accuracy of the products recommended to the second sample user. If the accuracy is less than the second preset threshold, the attribute information of the first sample user is reordered and the random forest model is built and tested again until the accuracy of the product recommended to the second sample user is greater than or equal to the second preset threshold. Accordingly, the step of using the statistical features of all attribute sets as input to the random forest model and outputting products recommended to the target user includes: The statistical features of all attribute sets corresponding to the target user are used as input to a random forest model with an accuracy greater than or equal to the preset threshold, and the output is the product recommended to the target user.
5. The product recommendation method according to any one of claims 1-2, characterized in that, The target user's attribute information includes the target user's basic information and the target user's historical query information.
6. A product recommendation device, characterized in that, include: The grouping module is used to sort the attribute information of the target user, obtain the attribute information located in the middle position of the sorting result, and divide the attribute information before and after the middle position in the sorting result into the same number of groups. The extraction module is used to construct an attribute set based on any two sets of attribute information symmetrical about the intermediate position and the attribute information located at the intermediate position, and to extract the statistical features of each attribute set; The prediction module is used to take the statistical features of all attribute sets as input to the random forest model and output products recommended to the target user. The random forest model is trained using the attribute information of the first sample user as the training sample and the products that the first sample user has historically queried or used as labels. The step of using the statistical features of all attribute sets as input to a random forest model and outputting products recommended to the target user includes: Calculate the confidence level of the probability of each currently used decision tree in the random forest model voting for a product within a preset confidence interval; If the confidence level is greater than a first preset threshold, or less than or equal to 1 minus the first preset threshold, the product recommended to the target user is obtained based on the currently used decision tree; The step of obtaining recommended products for the target user based on the currently used decision tree includes: Calculate the average confidence level of the probability of each product being voted for by all currently used decision trees within a predefined confidence interval; The products with the highest average confidence level are selected as the products recommended to the target user.
7. An electronic device comprising a memory, a processor, and a computer program stored in the memory and executable on the processor, characterized in that, When the processor executes the program, it implements the steps of the product recommendation method as described in any one of claims 1 to 5.
8. A non-transitory computer-readable storage medium having a computer program stored thereon, characterized in that, When the computer program is executed by a processor, it implements the steps of the product recommendation method as described in any one of claims 1 to 5.
Citation Information
Patent Citations
Method for detecting Android malicious software by means of random forest classifier in real time
CN107153789A
System and method for sequencing database-based content recommendation
US20190065597A1