Product recommendation method and device, equipment and storage medium
By obtaining user information to generate preference values and rating matrices, and using collaborative filtering and random forest models for personalized recommendations, we solve the problem of lack of targeting and accuracy in existing product recommendation mechanisms, achieve efficient personalized recommendations, and improve user stickiness and operational effectiveness.
Patent Information
- Application Number
- CN202411866970.X
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2024-12-18
- Publication Date
- 2025-09-19
AI Technical Summary
The existing product recommendation mechanism lacks specificity, resulting in waste of resources and low user response rate, and the proportion of users converted into loyal customers is low. The existing push strategy cannot achieve precision and personalization.
By obtaining user information, generating preference values and rating matrices, using collaborative filtering models and random forest models to screen key features, and constructing rating matrices, personalized recommendations are achieved.
It improves the accuracy and personalization of recommendations, reduces push costs, and significantly improves user stickiness and operational effectiveness.
Smart Images

Figure CN120670649A_ABST
Abstract
Description
Technical Field
[0001] The present disclosure relates to the field of artificial intelligence, and more specifically to a product recommendation method, apparatus, device, and storage medium. Background Art
[0002] With the deepening of digital operations, product recommendations have become a crucial bridge between users and organizations. Precisely recommending content and services of interest to users through targeted product push is key to increasing user engagement, engagement, and loyalty. Recommendation systems, a key technology in the field of artificial intelligence, analyze user behavior data and preferences to accurately deliver personalized content and have been widely adopted in various online service scenarios. However, effectively improving the accuracy of recommended activity push based on recommendation systems remains a key research and application area.
[0003] In existing technologies, the push mechanisms of many products have significant flaws. First, push strategies lack specificity, often adopting a broad coverage approach, resulting in wasted resources and excessively high push costs. Second, the push content is not sufficiently aligned with user needs, resulting in low user response rates and infrequent product visits. Furthermore, even when users visit the relevant activity areas, the conversion rate to long-term loyal customers is low, resulting in suboptimal operational results. These issues indicate that existing push mechanisms still have significant room for improvement in terms of precision and personalization, and require the introduction of more scientific recommendation algorithms and data mining methods for optimization. Summary of the Invention
[0004] In view of the above problems, the present disclosure provides a product recommendation method, apparatus, device, medium and program product for improving the accuracy of product recommendations.
[0005] According to a first aspect of the present disclosure, a product recommendation method is provided, comprising: obtaining user information of a plurality of users, the user information including at least a plurality of user features of the users; generating a preference value of each user for each candidate product based on the number of visits and the visit time of each user to each candidate product; constructing a rating matrix corresponding to a target user based on the user features corresponding to each user and the preference value of each user for each candidate product, wherein the target user is at least one of the plurality of users, and the rating matrix represents the probability that each target user prefers to visit each candidate product; and predicting at least one recommended product for the target user from each candidate product based on the rating matrix and a preset collaborative filtering model.
[0006] According to an embodiment of the present disclosure, a preference value of each user for each candidate product is generated, including: dividing multiple time ranges based on a preset division strategy, wherein the tail node of at least one time range is the current time point, and each time range corresponds to a unique weight; counting the number of visits of the user within each time range; and calculating the preference value based on the number of visits within each time range and the weight corresponding to each time range.
[0007] According to an embodiment of the present disclosure, a rating matrix corresponding to a target user is constructed, including: training multiple prediction models based on preference values and user characteristics, with the prediction models corresponding one-to-one to candidate products; generating a rating value for each target user visiting each candidate product based on the prediction model; and constructing a rating matrix based on the rating values.
[0008] According to an embodiment of the present disclosure, multiple prediction models are trained, including: based on preset evaluation rules, screening out multiple target features from multiple user features, the target features being user features whose importance meets preset importance conditions; based on preference values, determining the access tendency of each user for candidate products, the access tendency being one of preference for visit and dislike for visit; using the user's multiple target features and access tendencies as training data, training multiple prediction models until each prediction model meets the preset conditions.
[0009] According to an embodiment of the present disclosure, determining each user's access tendency to candidate products includes: for each user, performing the following operations to obtain the user's access tendency to candidate products: calculating the average of the user's preference values for each candidate product; when the user's preference value for the candidate product is greater than or equal to the average, determining the user's access tendency to the candidate product as a favorable visit; when the user's preference value for the candidate product is less than the average, determining the user's access tendency to the candidate product as a unfavorable visit.
[0010] According to an embodiment of the present disclosure, multiple prediction models are trained using multiple target features and access tendencies of users as training data until each prediction model meets preset conditions, including: using multiple target features of users as sample input data of the prediction model to train the prediction model, the output of the prediction model is the predicted value of the user's access tendency for the corresponding candidate product, and the probability corresponding to the predicted value; according to the access tendency and the predicted value of the access tendency, the parameters of the prediction model are adjusted until the error between the predicted value and the access tendency of the prediction model is less than a preset error threshold.
[0011] According to an embodiment of the present disclosure, a plurality of target features are screened out from a plurality of user features, including: training a plurality of random forest models based on the plurality of user features of each user until each random forest model meets a preset condition, and the random forest model and the candidate product correspond one to one; generating the importance of each user feature in each random forest model based on each random forest model; and screening a plurality of target features that meet the preset importance condition from each user feature based on the importance.
[0012] According to an embodiment of the present disclosure, at least one recommended product for a target user is predicted based on a rating matrix, including: determining at least one similar user for each target user based on a collaborative filtering model according to the rating matrix; calculating the rating of each candidate product by the target user based on the ratings of the similar users for each candidate product; and selecting the candidate products whose ratings meet preset rating requirements as recommended products for the target user.
[0013] According to an embodiment of the present disclosure, a rating matrix is constructed based on the rating values, including: representing the rows of the rating matrix with target users, representing the columns of the rating matrix with candidate products, and constructing the rating matrix with the rating values of the target users for the candidate products as the corresponding values of the rows and columns.
[0014] According to an embodiment of the present disclosure, obtaining user information of multiple users includes: obtaining authorization for information collection from each user; and obtaining user information of the multiple users after obtaining the authorization.
[0015] A second aspect of the present disclosure provides a product recommendation device, including: an acquisition module for acquiring user information of multiple users, where the user information includes at least multiple user features of the users; a generation module for generating a preference value of each user for each candidate product based on the number of visits and visit time of each user to each candidate product; a construction module for constructing a rating matrix corresponding to a target user based on the user features corresponding to each user and the preference value of each user for each candidate product, where the target user is at least one of the multiple users, and the rating matrix represents the probability that each target user prefers to visit each candidate product; and a prediction module for predicting at least one recommended product for the target user from each candidate product based on a preset collaborative filtering model and the rating matrix.
[0016] A third aspect of the present disclosure provides an electronic device, comprising: one or more processors; and a memory for storing one or more computer programs, wherein the one or more processors execute the one or more computer programs to implement the steps of the above method.
[0017] The fourth aspect of the present disclosure further provides a computer-readable storage medium having a computer program or instructions stored thereon, which implements the steps of the above method when the computer program or instructions are executed by a processor.
[0018] The fifth aspect of the present disclosure further provides a computer program product, comprising a computer program or instructions, which implement the steps of the above method when executed by a processor.
[0019] According to the embodiments of the present disclosure, the product recommendation method provided by the present disclosure has at least one of the following beneficial effects: on the one hand, since the present invention adopts an innovative product scoring mechanism and a user access mark generation method, the number of user visits and the access time are quantified into operational data and input into the scoring matrix, thereby being able to accurately characterize the user's interest preferences in activities and special zones, thereby improving the accuracy of recommendations; on the other hand, since the random forest model is used to screen key features, and the user similarity is calculated in combination with the user-based collaborative filtering model, personalized recommendations are made to users, thereby achieving differentiation in product push, reducing push costs, and significantly improving user stickiness and product operation effects. BRIEF DESCRIPTION OF THE DRAWINGS
[0020] The above contents and other objects, features and advantages of the present disclosure will become more apparent through the following description of the embodiments of the present disclosure with reference to the accompanying drawings, in which:
[0021] Figure 1 The following schematically illustrates an application scenario of the product recommendation method according to an embodiment of the present disclosure;
[0022] Figure 2 The following schematically shows a flow chart of a product recommendation method according to an embodiment of the present disclosure;
[0023] Figure 3 Schematically shows a flow chart of generating preference values according to an embodiment of the present disclosure;
[0024] Figure 4 Schematically shows a flowchart of constructing a scoring matrix according to an embodiment of the present disclosure;
[0025] Figure 5 Schematically shows a flow chart of training a prediction model according to an embodiment of the present disclosure;
[0026] Figure 6 Schematically shows a flow chart for determining access tendency according to an embodiment of the present disclosure;
[0027] Figure 7 Schematically shows a flow chart of training a prediction model according to an embodiment of the present disclosure;
[0028] Figure 8 Schematically shows a flow chart for screening target features according to an embodiment of the present disclosure;
[0029] Figure 9Schematically shows a flowchart of predicting and recommending products according to an embodiment of the present disclosure;
[0030] Figure 10 Schematically shows a structural block diagram of a product recommendation device according to an embodiment of the present disclosure; and
[0031] Figure 11 A block diagram of an electronic device suitable for implementing a product recommendation method according to an embodiment of the present disclosure is schematically shown. DETAILED DESCRIPTION
[0032] Hereinafter, embodiments of the present disclosure will be described with reference to the accompanying drawings. However, it should be understood that these descriptions are merely exemplary and are not intended to limit the scope of the present disclosure. In the detailed description below, for ease of explanation, many specific details are set forth to provide a comprehensive understanding of the embodiments of the present disclosure. However, it is apparent that one or more embodiments may also be implemented without these specific details. In addition, in the following description, descriptions of well-known structures and technologies are omitted to avoid unnecessary confusion of the concepts of the present disclosure.
[0033] The terms used herein are only for describing specific embodiments and are not intended to limit the present disclosure. The terms "comprise," "include," etc. used herein indicate the presence of the features, steps, operations, and / or components, but do not exclude the presence or addition of one or more other features, steps, operations, or components.
[0034] All terms used herein (including technical and scientific terms) have the meanings commonly understood by those skilled in the art unless otherwise defined. It should be noted that the terms used herein should be interpreted as having a meaning consistent with the context of this specification and should not be interpreted in an idealized or overly rigid manner.
[0035] When expressions such as "at least one of A, B, and C, etc." are used, they should generally be interpreted in accordance with the meaning commonly understood by those skilled in the art (for example, "a system having at least one of A, B, and C" should include but is not limited to a system having A alone, B alone, C alone, A and B, A and C, B and C, and / or A, B, C, etc.).
[0036] In the technical solutions disclosed herein, the user information (including but not limited to user personal information, user image information, user device information, such as location information, etc.) and data (including but not limited to data used for analysis, stored data, displayed data, etc.) involved are all information and data authorized by the user or fully authorized by all parties, and the collection, storage, use, processing, transmission, provision, disclosure and application of the relevant data comply with relevant laws, regulations and standards, take necessary confidentiality measures, do not violate public order and good morals, and provide corresponding operation entrances for users to choose to authorize or refuse.
[0037] In scenarios where personal information is used for automated decision-making, the methods, devices, and systems provided by the embodiments of the present disclosure all provide users with corresponding operation portals for them to choose to agree or reject the automated decision-making results; if the user chooses to reject, the expert decision-making process will be entered. The expression "automated decision-making" here refers to the activity of automatically analyzing and evaluating an individual's behavioral habits, interests and hobbies, or economic, health, credit status, etc. through computer programs and making decisions. The expression "expert decision-making" here refers to the activity of making decisions by people who specialize in a certain field, have specialized experience, knowledge, and skills, and have reached a certain level of professionalism.
[0038] Figure 1 The following schematically illustrates an application scenario of the product recommendation method according to an embodiment of the present disclosure.
[0039] like Figure 1 As shown, the application scenario 100 according to this embodiment may include a first terminal device 101, a second terminal device 102, a third terminal device 103, a network 104, and a server 105. The network 104 is used as a medium for providing a communication link between the first terminal device 101, the second terminal device 102, the third terminal device 103, and the server 105. The network 104 may include various connection types, such as wired or wireless communication links or optical fiber cables.
[0040] A user may use a first terminal device 101, a second terminal device 102, or a third terminal device 103 to interact with a server 105 via a network 104 to receive or send messages, etc. Various communication client applications may be installed on the first terminal device 101, the second terminal device 102, or the third terminal device 103, such as shopping applications, web browser applications, search applications, instant messaging tools, email clients, social platform software, etc. (for example only).
[0041] The first terminal device 101 , the second terminal device 102 , and the third terminal device 103 may be various electronic devices having display screens and supporting web browsing, including but not limited to smart phones, tablet computers, laptop computers, desktop computers, and the like.
[0042] The server 105 may be a server that provides various services, such as a background management server (for example only) that supports websites browsed by users using the first terminal device 101, the second terminal device 102, and the third terminal device 103. The background management server may analyze and process received data such as user requests, and feed back processing results (e.g., web pages, information, or data obtained or generated based on user requests) to the terminal devices.
[0043] It should be noted that the product recommendation method provided in the embodiment of the present disclosure can generally be executed by the server 105. Accordingly, the product recommendation device provided in the embodiment of the present disclosure can generally be set in the server 105. The product recommendation method provided in the embodiment of the present disclosure can also be executed by a server or server cluster that is different from the server 105 and can communicate with the first terminal device 101, the second terminal device 102, the third terminal device 103 and / or the server 105. Accordingly, the product recommendation device provided in the embodiment of the present disclosure can also be set in a server or server cluster that is different from the server 105 and can communicate with the first terminal device 101, the second terminal device 102, the third terminal device 103 and / or the server 105.
[0044] It should be understood that Figure 1 The number of terminal devices, networks and servers in the embodiment is merely illustrative. Any number of terminal devices, networks and servers may be provided as required.
[0045] The following will be based on Figure 1 The scene described by Figures 2 to 6 The product recommendation method of the disclosed embodiment is described in detail.
[0046] Figure 2 The flowchart of the product recommendation method according to an embodiment of the present disclosure is schematically shown.
[0047] like Figure 2 As shown, the product recommendation of this embodiment includes operations S210 to S230.
[0048] In operation S210, user information of multiple users is obtained. The user information includes at least multiple user characteristics of the users. User information can be obtained from a variety of data channels, including but not limited to user registration information, behavior logs, and other data sets that can reflect user habits and preferences. User characteristics are a collection of multidimensional attributes related to the user, and may include age, gender, geographic location, consumption habits, device type, etc.
[0049] In an embodiment of the present disclosure, before obtaining user information, the user's consent or authorization may be obtained. For example, a request to obtain user information may be issued to the user. If the user agrees or authorizes to obtain the user information, the user information of multiple users is obtained.
[0050] According to an embodiment of the present disclosure, operation S210 may include operations S211 and S212. In operation S211, authorization for information collection from each user is obtained; in operation S212, user information of multiple users is obtained after obtaining authorization.
[0051] In operation S220, a preference value for each candidate product is generated based on the number of visits and visit duration of each user. When generating the preference value for each candidate product, the user's visit behavior for each candidate product is analyzed, specifically including statistics on the number of visits and visit duration, to quantify the user's interest in each candidate product. The number of visits reflects the frequency of the user's behavior, while the visit duration reflects the user's actual interest in the candidate product.
[0052] In operation S230, a scoring matrix corresponding to a target user is constructed based on the user characteristics corresponding to each user and the user's preference values for each candidate product. The target user is at least one of the multiple users. The scoring matrix represents the probability that each target user will prefer to visit each candidate product. The core significance of the scoring matrix is that it mathematically represents the relationship between users and candidate products. The rows and columns of the matrix represent users and candidate products, respectively, and the values in the matrix represent the probability that the user will prefer the candidate product, providing a standardized data input format for model calculations.
[0053] In operation S240, based on a preset collaborative filtering model and the rating matrix, at least one recommended product for the target user is predicted from each candidate product. The collaborative filtering model is pre-trained, and the training process is not detailed here. The model input is the rating matrix, and the model output is the similarity between each user in the rating matrix. Based on the similarity, a certain number of similar users are selected, and the target user's preferred products are predicted based on these similar users, and then the product recommendations are made.
[0054] According to the disclosed embodiments, a precise and efficient product recommendation method is implemented by combining user information, user access behavior data, and a collaborative filtering model. Obtaining user information provides multidimensional data support for the recommendation process. Generating preference values based on visit count and time dynamically quantifies user interests. Constructing a rating matrix effectively characterizes the relationship between users and candidate products. The collaborative filtering model automatically discovers potential interests and recommends results through the rating matrix, improving the accuracy and personalization of recommendations.
[0055] Figure 3 The flowchart of generating preference values according to an embodiment of the present disclosure is schematically shown.
[0056] like Figure 3 As shown, operation S220 may include operations S310 to S330.
[0057] In operation S310, a plurality of time ranges are divided based on a preset division strategy, wherein the end node of at least one time range is the current time point, and each time range has a unique weight.
[0058] In operation S320, the number of visits by users in each time range is counted;
[0059] In operation S330 , a preference value is calculated based on the number of visits within each time range and the weight corresponding to each time range.
[0060] The calculation formula of preference value can be:
[0061]
[0062] Among them, R represents the user's preference value for a candidate product, I is the number of time ranges, and N i is the number of times the user visits the candidate product in the i-th time range, W i is the weight corresponding to the i-th time range.
[0063] When dividing multiple time ranges based on a preset partitioning strategy, the settings for each time range can be flexibly adjusted to suit specific application scenarios, for example, by dividing the time range into the past 7 days, 8-14 days, 15-30 days, and so on. This partitioning captures the temporal distribution of user behavior, thereby better reflecting the dynamic changes in user interests. The unique weight corresponding to each time range can be set based on actual business needs. Generally, behaviors closer to the current time have higher weights to reflect the stronger influence of recent behavior on user preferences. For example, if a user accesses a product within 7 days of today: weight = 0.3; if a user accesses a product within 8-14 days of today: weight = 0.2; if a user accesses a product within 15-30 days of today: weight = 0.1; and if a user accesses a product more than 30 days ago, the weight is 0.
[0064] For example, if a user visited product 1 twice within 7 days from today, visited product 1 three times within 8-14 days from today, and visited product 1 five times within 15-30 days from today, then the user's preference value for product 1 is 2*0.3+3*0.2+5*0.1=1.7.
[0065] According to the embodiments of the present disclosure, the time characteristics of user behavior data are integrated into the calculation of preference values through flexible division of time ranges and scientific setting of weights, so that the influence of users' recent behavior and historical behavior can be dynamically balanced, thereby more accurately portraying users' interest in candidate products and providing more reliable and scientific preference value support for subsequent recommendations.
[0066] Figure 4 The flowchart of constructing a scoring matrix according to an embodiment of the present disclosure is schematically shown.
[0067] like Figure 4 As shown, operation S230 may include operations S410 to S430.
[0068] In operation S410 , multiple prediction models are trained based on the preference values and user characteristics, with the prediction models corresponding to the candidate products one by one;
[0069] In operation S420 , based on the prediction model, a score value is generated for each target user visiting each candidate product;
[0070] In operation S430 , a scoring matrix is constructed based on the scoring values.
[0071] According to an embodiment of the present disclosure, operation S430 may include: representing the rows of the rating matrix with target users, representing the columns of the rating matrix with candidate products, and constructing the rating matrix with the rating values of the target users for the candidate products as the corresponding values of the rows and columns.
[0072] For example, the scoring matrix can look like this:
[0073]
[0074] Based on preference values and user characteristics, a prediction model is trained for each candidate product. During training, user preference values serve as target variables and user characteristics as input variables. Model parameters are continuously adjusted to ensure that predictions more closely align with actual user preferences. When constructing the prediction model, preference values are calculated taking into account the frequency and time distribution of user visits to candidate products, accurately reflecting user interest. This allows for precise predictions based on user preference values and characteristics, and constructs a comprehensive and structured rating matrix. This provides efficient input data for recommending candidate products to target users, while also improving the accuracy of user rating calculations and the relevance of model predictions.
[0075] Figure 5 The flowchart of training a prediction model according to an embodiment of the present disclosure is schematically shown.
[0076] like Figure 5 As shown, operation S410 may include operations S510 to S530.
[0077] In operation S510, based on preset evaluation rules, multiple target features are selected from multiple user features. Target features are user features whose importance meets preset importance criteria. Based on preset evaluation rules (such as feature importance scores), target features with a significant impact on the user's tendency to visit candidate products are selected from the user's multi-dimensional features to reduce feature redundancy and improve model efficiency. The importance scores of each user feature are sorted and a set of features that meet the criteria is selected. These target features may include basic user information, behavioral data, and historical visit records.
[0078] In operation S520, based on the preference values, each user's access tendency for the candidate products is determined. The access tendency is either a preference for visiting or a dislike for visiting. By processing the user's preference values, each user's preference for the candidate products is classified into two types of access tendencies: "favorable visit" and "disfavorable visit," thereby clarifying the user's interest in the candidate products. Specifically, the access tendency can be represented by an access flag. When the user's access tendency is favorable, the access flag = 1; when the user's access tendency is disfavored, the access flag = 0. Based on the aforementioned acquisition of user characteristics, the user number, user characteristics, and the user's access flag for each candidate product can be combined to create multiple data tables, with each data table corresponding to the candidate products.
[0079] In operation S530, a plurality of prediction models are trained using the user's multiple target features and access tendencies as training data until each prediction model meets a preset condition.
[0080] According to the embodiments of the present disclosure, the complexity of model calculation is reduced and the effectiveness of features is improved by screening target features; user access tendencies are used as labeled data to train the prediction model, which improves the accuracy and applicability of the model in predicting user behavior, thereby significantly enhancing the performance of the recommendation system in user preference modeling and recommendation accuracy.
[0081] Figure 6 The flowchart of determining access tendency according to an embodiment of the present disclosure is schematically shown.
[0082] like Figure 6 As shown, operation S520 may include performing operations S610 to S620 for each user.
[0083] For each user, perform the following operations to obtain the user's access tendency for candidate products:
[0084] In operation S610, an average of the user's preference values for each candidate product is calculated;
[0085] In operation S620, the user's access preference for the candidate product is determined based on the average value and the preference value. Specifically, if the user's preference value for the candidate product is greater than or equal to the average value, the user's access tendency for the candidate product is determined to be favorable; if the user's preference value for the candidate product is less than the average value, the user's access tendency for the candidate product is determined to be unfavorable.
[0086] Specifically, for each product, we take the average preference value a for all users with a positive product preference. Users with a product preference value greater than or equal to a are considered to like the activity, and their visit flag is 1. Users with a product preference value less than a are considered to dislike the activity, and their visit flag is 0. By calculating the average user preference value and combining it with the preference value to categorize visit trends, we effectively quantify user interest in candidate products and ensure accurate classification of user behavior data. This classification method can reduce the interference of noise data in subsequent classification and prediction models, improving the accuracy of user interest tags and the precision of the recommendation system.
[0087] Figure 7 The flowchart of training a prediction model according to an embodiment of the present disclosure is schematically shown.
[0088] like Figure 7 As shown, operation S530 may include operations S710 to S720.
[0089] In operation S710, the prediction model is trained using multiple target features of the user as sample input data of the prediction model. The output of the prediction model is the predicted value of the user's access tendency to the corresponding candidate product and the probability corresponding to the predicted value.
[0090] In operation S720 , parameters of the prediction model are adjusted according to the access tendency and the predicted value of the access tendency until the error between the predicted value of the prediction model and the access tendency is less than a preset error threshold.
[0091] Based on the aforementioned embodiment, where a data table for each candidate product is generated, the data table for each candidate product is labeled with an access flag and the user's target features are used as the final input features. Multiple classification prediction models are then employed to train each model, adjust model parameters, and improve model performance, ultimately yielding a trained prediction model for each candidate product. According to the disclosed embodiment, the prediction model can be a binary classification model.
[0092] The probability corresponding to the predicted value is the probability that the user visits the corresponding candidate product. In the subsequent process of constructing the scoring matrix, this probability value is normalized and filled into the scoring matrix as the scoring value.
[0093] Figure 8The flowchart of screening target features according to an embodiment of the present disclosure is schematically shown.
[0094] like Figure 8 As shown, operation S510 may include operations S810 to S830.
[0095] In operation S810, multiple random forest models are trained based on multiple user features of each user until each random forest model meets a preset condition and the random forest model corresponds to the candidate product one by one;
[0096] In operation S820, based on each random forest model, the importance of each user feature in each random forest model is generated;
[0097] In operation S830 , based on the importance, a plurality of target features that meet a preset importance condition are screened out from the various user features.
[0098] Specifically, due to the large number of user feature dimensions, it is necessary to filter out the features that have the greatest impact on the target variable. Each user's user features, their preferences for each candidate product, and their access trends are used as sample data. Based on the candidate products as the basis for classification, the sample data is divided into multiple groups of sample data corresponding to the candidate products. Each group of sample data includes a training set and a test set. For each candidate product, a random forest model is constructed using the training set data. The random forest model is an ensemble model consisting of multiple decision trees, each of which is built based on a different random sample and feature subset. After training, the model parameters are fine-tuned based on the test set to obtain a random forest model corresponding to each candidate product.
[0099] During training, the random forest model records the contribution of each feature to all node splits in the tree (e.g., reduction in the Gini index or other metrics). Therefore, after training is complete, we can directly extract these accumulated statistics from the model and calculate feature importance without performing predictions or generating output. The preferred metric for determining importance is Gini importance.
[0100] On this basis, based on the random forest model corresponding to a candidate product, we can obtain the degree of influence of each user feature on the candidate product, and select multiple features with the greatest influence, that is, the greatest importance, as target features.
[0101] Figure 9 The flowchart of predicting and recommending products according to an embodiment of the present disclosure is schematically shown.
[0102] like Figure 9 As shown, operation S240 may include operations S910 to S930.
[0103] In operation S910, at least one similar user is determined for each target user based on the scoring matrix and the collaborative filtering model. To determine the similar users for each target user, the system calculates the similarity between users based on the scoring matrix using the collaborative filtering model. For example, cosine similarity can be used as a similarity calculation method. By calculating the score vectors of each user in the scoring matrix, the system selects the users with the highest similarity as the similar users of the target user.
[0104] In operation S920, the target user's rating for each candidate product is calculated based on the ratings of similar users for each candidate product. Based on the ratings of the target user's similar users for each candidate product, the target user's rating for the candidate product is calculated according to the prediction rules of the collaborative filtering model. For example, the target user's preference for the candidate product is predicted based on a weighted average of the similarity between the similar users' ratings and the target user's similarity.
[0105] In operation S930, candidate products whose scores meet the preset rating requirements are selected as recommended products for the target user. The target user's ratings of the candidate products are compared with the preset rating requirements, and candidate products that meet the preset rating requirements are selected as recommended products for the target user. Finally, a personalized recommendation list is generated for each target user.
[0106] Based on the above product recommendation method, the present disclosure also provides a product recommendation device. Figure 10 The device is described in detail.
[0107] Figure 10 The structural block diagram of the product recommendation device according to an embodiment of the present disclosure is schematically shown.
[0108] like Figure 10 As shown, the product recommendation device 1000 of this embodiment includes a first acquisition module 1010 , a first generation module 1020 , a first construction module 1030 and a first prediction module 1040 .
[0109] The first acquisition module 1010 is used to acquire user information of multiple users, where the user information includes at least multiple user features of the users. In one embodiment, the first acquisition module 1010 can be used to perform the operation S210 described above, which will not be repeated here.
[0110] The first generating module 1020 is used to generate the preference value of each user for each candidate product based on the number of visits and visit time of each user to each candidate product. In one embodiment, the first generating module 1020 can be used to perform the operation S220 described above, which will not be repeated here.
[0111] First construction module 1030 is configured to construct a rating matrix corresponding to a target user based on the user characteristics corresponding to each user and each user's preference for each candidate product. The target user is at least one of the multiple users, and the rating matrix represents the probability that each target user will prefer to visit each candidate product. In one embodiment, first construction module 1030 can be configured to perform operation S230 described above, and will not be further described here.
[0112] The first prediction module 1040 is used to predict at least one recommended product for the target user from each candidate product based on a preset collaborative filtering model and a rating matrix. In one embodiment, the prediction module 1040 can be used to perform the operation S240 described above, which will not be repeated here.
[0113] According to an embodiment of the present disclosure, the first generating module may include a dividing module, a statistics module and a first calculating module.
[0114] The partitioning module is used to partition multiple time ranges based on a preset partitioning strategy, wherein the tail node of at least one time range is the current time point, and each time range has a unique weight. In one embodiment, the partitioning module can be used to perform the operation S310 described above, which will not be repeated here.
[0115] The statistics module is used to count the number of visits by users within various time ranges. In one embodiment, the statistics module can be used to perform the operation S320 described above, which will not be described in detail here.
[0116] The first calculation module is used to calculate the preference value based on the number of visits within each time range and the weight corresponding to each time range. In one embodiment, the calculation module can be used to perform the operation S330 described above, which will not be repeated here.
[0117] According to an embodiment of the present disclosure, the first building block may include a first training block, a second generating block, and a second building block.
[0118] The first training module is used to train multiple prediction models based on preference values and user characteristics, and the prediction models correspond to candidate products one by one. In one embodiment, the first training module can be used to perform the operation S410 described above, which will not be repeated here.
[0119] The second generating module is used to generate a score value for each target user visiting each candidate product based on the prediction model. In one embodiment, the second generating module can be used to perform the operation S420 described above, which will not be repeated here.
[0120] The second building module is used to build a scoring matrix based on the scoring values. In one embodiment, the second building module can be used to perform the operation S430 described above, which will not be repeated here.
[0121] According to an embodiment of the present disclosure, the first training module may include a screening module, a first determination module, and a second training module.
[0122] The screening module is used to screen multiple target features from multiple user features based on preset evaluation rules, where the target features are user features whose importance meets preset importance conditions. In one embodiment, the screening module can be used to perform the operation S510 described above, which will not be repeated here.
[0123] The first determining module is used to determine the access tendency of each user for the candidate product based on the preference value, where the access tendency is one of a preference for access and a dislike for access. In one embodiment, the first determining module can be used to perform the operation S520 described above, which will not be repeated here.
[0124] The second training module is used to train multiple prediction models using the user's multiple target features and access trends as training data until each prediction model meets the preset conditions. In one embodiment, the second training module can be used to perform the operation S530 described above, which will not be repeated here.
[0125] According to an embodiment of the present disclosure, the first determination module may include a second calculation module and a determination execution module.
[0126] The second calculation module is used to calculate the average of the user's preference values for each candidate product. In one embodiment, the second calculation module can be used to perform the operation S610 described above, which will not be repeated here.
[0127] The determination execution module is configured to determine that the user's access tendency for the candidate product is favorable if the user's preference value for the candidate product is greater than or equal to the average value; and to determine that the user's access tendency for the candidate product is unfavorable if the user's preference value for the candidate product is less than the average value. In one embodiment, the determination execution module may be configured to execute operation S620 described above, which will not be further described herein.
[0128] According to an embodiment of the present disclosure, the second training module may include a third training module and an adjustment module.
[0129] The second training module is configured to train the prediction model using the user's multiple target features as sample input data. The prediction model outputs a predicted value of the user's visit tendency for the corresponding candidate product and the probability corresponding to the predicted value. In one embodiment, the second training module can be used to perform operation S710 described above and will not be further described here.
[0130] The adjustment module is configured to adjust parameters of the prediction model based on the access propensity and the predicted value of the access propensity until the error between the predicted value of the prediction model and the access propensity is less than a preset error threshold. In one embodiment, the adjustment module may be configured to perform operation S720 described above, which will not be further described herein.
[0131] According to an embodiment of the present disclosure, the screening module may include a third training module, a third generation module, and a screening execution module.
[0132] The third training module is used to train multiple random forest models based on multiple user features of each user until each random forest model meets preset conditions and a one-to-one correspondence between the random forest model and the candidate product is established. In one embodiment, the third training module can be used to perform operation S810 described above and will not be repeated here.
[0133] The third generating module is used to generate the importance of each user feature in each random forest model based on each random forest model. In one embodiment, the third generating module can be used to perform the operation S820 described above, which will not be repeated here.
[0134] The screening execution module is used to screen out multiple target features that meet preset importance conditions from various user features based on importance. In one embodiment, the screening execution module can be used to perform the operation S830 described above, which will not be repeated here.
[0135] According to an embodiment of the present disclosure, the first prediction module may include a second determination module, a third calculation module, and a recommended product determination module.
[0136] The second determination module is used to determine at least one similar user for each target user based on the scoring matrix and the collaborative filtering model. In one embodiment, the second determination module can be used to perform the operation S910 described above, which will not be repeated here.
[0137] The third calculation module is used to calculate the target user's score for each candidate product based on the similar users' score for each candidate product. In one embodiment, the third calculation module can be used to perform the operation S920 described above, which will not be repeated here.
[0138] The recommended product determination module is used to select candidate products whose scores meet the preset score requirements as recommended products for the target user. In one embodiment, the recommended product determination module can be used to perform the operation S930 described above, which will not be repeated here.
[0139] According to embodiments of the present disclosure, any multiple modules among the first acquisition module 1010, the first generation module 1020, the first construction module 1030, and the first prediction module 1040 may be combined into a single module, or any one of these modules may be split into multiple modules. Alternatively, at least part of the functionality of one or more of these modules may be combined with at least part of the functionality of other modules and implemented in a single module. According to embodiments of the present disclosure, at least one of the first acquisition module 1010, the first generation module 1020, the first construction module 1030, and the first prediction module 1040 may be at least partially implemented as a hardware circuit, such as a field programmable gate array (FPGA), a programmable logic array (PLA), a system on a chip, a system on a substrate, a system on a package, an application-specific integrated circuit (ASIC), or may be implemented in hardware or firmware through any other reasonable means of circuit integration or packaging, or may be implemented in any one of software, hardware, and firmware, or any suitable combination of these. Alternatively, at least one of the first acquisition module 1010 , the first generation module 1020 , the first construction module 1030 , and the first prediction module 1040 may be at least partially implemented as a computer program module, which may perform corresponding functions when executed.
[0140] Figure 11 A block diagram of an electronic device suitable for implementing a product recommendation method according to an embodiment of the present disclosure is schematically shown.
[0141] like Figure 11 As shown, the electronic device 1100 according to an embodiment of the present disclosure includes a processor 1101, which can perform various appropriate actions and processes according to a program stored in a read-only memory (ROM) 1102 or a program loaded from a storage portion 1108 into a random access memory (RAM) 1103. The processor 1101 may include, for example, a general-purpose microprocessor (e.g., a CPU), an instruction set processor and / or a related chipset and / or a special-purpose microprocessor (e.g., an application-specific integrated circuit (ASIC)), etc. The processor 1101 may also include onboard memory for caching purposes. The processor 1101 may include a single processing unit or multiple processing units for performing different actions of the method flow according to an embodiment of the present disclosure.
[0142] Various programs and data required for the operation of the electronic device 1100 are stored in the RAM 1103. The processor 1101, the ROM 1102, and the RAM 1103 are connected to each other via a bus 1104. The processor 1101 performs various operations of the method flow according to the embodiment of the present disclosure by executing the programs in the ROM 1102 and / or the RAM 1103. It should be noted that the programs may also be stored in one or more memories other than the ROM 1102 and the RAM 1103. The processor 1101 may also perform various operations of the method flow according to the embodiment of the present disclosure by executing the programs stored in the one or more memories.
[0143] According to an embodiment of the present disclosure, electronic device 1100 may further include an input / output (I / O) interface 1105, which is also connected to bus 1104. Electronic device 1100 may also include one or more of the following components connected to I / O interface 1105: an input section 1106 including a keyboard, mouse, etc.; an output section 1107 including devices such as a cathode ray tube (CRT), liquid crystal display (LCD), and speakers; a storage section 1108 including a hard disk; and a communication section 1109 including a network interface card such as a LAN card or modem. Communication section 1109 performs communication processing via a network such as the Internet. A drive 1110 is also connected to I / O interface 1105 as needed. Removable media 1111, such as a magnetic disk, optical disk, magneto-optical disk, semiconductor memory, etc., is installed in drive 1110 as needed, so that computer programs read from the removable media can be installed into storage section 1108 as needed.
[0144] The present disclosure also provides a computer-readable storage medium, which may be included in the device / apparatus / system described in the above embodiments, or may exist independently and not be incorporated into the device / apparatus / system. The computer-readable storage medium carries one or more programs, and when executed, implements the method according to the embodiments of the present disclosure.
[0145] According to an embodiment of the present disclosure, a computer-readable storage medium may be a non-volatile computer-readable storage medium, and may include, for example, but not limited to: a portable computer disk, a hard disk, a random access memory (RAM), a read-only memory (ROM), an erasable programmable read-only memory (EPROM or flash memory), a portable compact disk read-only memory (CD-ROM), an optical storage device, a magnetic storage device, or any suitable combination thereof. In the present disclosure, a computer-readable storage medium may be any tangible medium that contains or stores a program that can be used by or in conjunction with an instruction execution system, apparatus, or device. For example, according to an embodiment of the present disclosure, a computer-readable storage medium may include the ROM 1102 and / or RAM 1103 described above, and / or one or more memories other than ROM 1102 and RAM 1103.
[0146] The embodiments of the present disclosure also include a computer program product, which includes a computer program containing program code for executing the method shown in the flowchart. When the computer program product is executed in a computer system, the program code is used to cause the computer system to implement the product recommendation method provided by the embodiments of the present disclosure.
[0147] The computer program executes the above functions defined in the system / device of the embodiment of the present disclosure when the computer program is executed by the processor 1101. According to the embodiment of the present disclosure, the system, device, module, unit, etc. described above can be implemented by a computer program module.
[0148] In one embodiment, the computer program may be stored on a tangible storage medium such as an optical storage device or a magnetic storage device. In another embodiment, the computer program may be transmitted and distributed in the form of a signal on a network medium, downloaded and installed via the communication portion 1109, and / or installed from removable media 1111. The program code contained in the computer program may be transmitted using any appropriate network medium, including but not limited to wireless, wired, or any suitable combination thereof.
[0149] In such an embodiment, the computer program can be downloaded and installed from a network via the communication section 1109 and / or installed from the removable medium 1111. When the computer program is executed by the processor 1101, the above-described functions defined in the system of the embodiment of the present disclosure are performed. According to the embodiment of the present disclosure, the systems, devices, means, modules, units, etc. described above can be implemented by computer program modules.
[0150] According to an embodiment of the present disclosure, the program code for executing the computer program provided by the embodiment of the present disclosure can be written in any combination of one or more programming languages. Specifically, these computer programs can be implemented using high-level procedural and / or object-oriented programming languages, and / or assembly / machine languages. Programming languages include, but are not limited to, languages such as Java, C++, Python, "C" or similar programming languages. The program code can be executed entirely on the user computing device, partially on the user device, partially on a remote computing device, or entirely on a remote computing device or server. In cases involving a remote computing device, the remote computing device can be connected to the user computing device through any type of network, including a local area network (LAN) or a wide area network (WAN), or can be connected to an external computing device (for example, using an Internet service provider to connect via the Internet).
[0151] The flowcharts and block diagrams in the accompanying drawings illustrate the possible implementation architecture, functions and operations of the systems, methods and computer program products according to various embodiments of the present disclosure. In this regard, each box in the flowchart or block diagram can represent a module, program segment, or a part of code, and the above-mentioned module, program segment, or a part of code contains one or more executable instructions for implementing the specified logical function. It should also be noted that in some alternative implementations, the functions marked in the box can also occur in an order different from that marked in the accompanying drawings. For example, two boxes represented in succession can actually be executed substantially in parallel, and they can sometimes be executed in the opposite order, depending on the functions involved. It should also be noted that each box in the block diagram or flowchart, and the combination of boxes in the block diagram or flowchart, can be implemented with a dedicated hardware-based system that performs the specified function or operation, or can be implemented with a combination of dedicated hardware and computer instructions.
[0152] Those skilled in the art will appreciate that the features described in the various embodiments of the present disclosure may be combined and / or coupled in various ways, even if such combinations or couplings are not explicitly described in the present disclosure. In particular, the features described in the various embodiments of the present disclosure may be combined and / or coupled in various ways without departing from the spirit and teachings of the present disclosure. All such combinations and / or couplings fall within the scope of the present disclosure.
[0153] The above describes the embodiments of the present disclosure. However, these embodiments are for illustrative purposes only and are not intended to limit the scope of the present disclosure. Although each embodiment has been described separately above, this does not mean that the measures in each embodiment cannot be advantageously used in combination. Without departing from the scope of the present disclosure, those skilled in the art may make various substitutions and modifications, which should all fall within the scope of the present disclosure.
Claims
1. A product recommendation method, characterized in that: The method comprises: Acquire user information of a plurality of users, wherein the user information includes at least a plurality of user characteristics of the users; generating a preference value of each user for each candidate product based on the number of visits and visit time of each user to each candidate product; constructing a scoring matrix corresponding to a target user based on the user characteristics corresponding to each of the users and the preference values of each of the users for each of the candidate products, wherein the target user is at least one of the plurality of users, and the scoring matrix represents the probability that each of the target users will like to visit each of the candidate products; Based on a preset collaborative filtering model and according to the rating matrix, at least one recommended product for the target user is predicted from each of the candidate products.
2. The method according to claim 1, characterized in that Generating the preference value of each user for each candidate product includes: Divide the time ranges based on a preset division strategy, wherein the tail node of at least one of the time ranges is the current time point, and each of the time ranges has a unique weight; Counting the number of visits by the user within each time range; The preference value is calculated based on the number of visits within each of the time ranges and the weight corresponding to each of the time ranges.
3. The method according to claim 1, characterized in that The step of constructing a rating matrix corresponding to the target user includes: Based on the preference values and the user characteristics, training multiple prediction models, wherein the prediction models correspond one-to-one to the candidate products; Based on the prediction model, generating a score value for each target user visiting each candidate product; Based on the scoring values, the scoring matrix is constructed.
4. The method according to claim 3, characterized in that The training of multiple prediction models includes: Based on a preset evaluation rule, a plurality of target features are screened out from the plurality of user features, wherein the target features are user features whose importance satisfies a preset importance condition; Determining, based on the preference value, an access tendency of each user for the candidate product, wherein the access tendency is one of a preference for access and a dislike for access; Using the multiple target features of the user and the access tendency as training data, multiple prediction models are trained until each of the prediction models meets preset conditions.
5. The method according to claim 4, characterized in that Determining the access tendency of each user to the candidate product includes: For each user, perform the following operations to obtain the user's access tendency for the candidate product: Calculating an average of the user's preference values for each of the candidate products; If the preference value of the user for the candidate product is greater than or equal to the average value, determining that the user's access tendency for the candidate product is a preference visit; When the preference value of the user for the candidate product is less than the average value, it is determined that the user's access tendency for the candidate product is not favorable.
6. The method according to claim 4, characterized in that The step of training multiple prediction models using the multiple target features of the user and the access tendency as training data until each prediction model meets a preset condition includes: The prediction model is trained using the multiple target features of the user as sample input data of the prediction model, wherein the output of the prediction model is a predicted value of the user's access tendency to the corresponding candidate product and a probability corresponding to the predicted value; According to the access tendency and the predicted value of the access tendency, the parameters of the prediction model are adjusted until the error between the predicted value of the prediction model and the access tendency is less than a preset error threshold.
7. The method according to claim 4, characterized in that The step of selecting a plurality of target features from the plurality of user features includes: Based on the plurality of user features of each of the users, training a plurality of random forest models until each of the random forest models meets a preset condition, and the random forest models correspond one to one to the candidate products; Generating the importance of each of the user features in each of the random forest models based on each of the random forest models; Based on the importance, a plurality of target features that meet preset importance conditions are screened out from the various user features.
8. The method according to any one of claims 1 to 7, characterized in that The step of predicting at least one recommended product for the target user from each of the candidate products according to the rating matrix includes: Determining at least one similar user for each target user based on the scoring matrix and the collaborative filtering model; Calculating the target user's score for each of the candidate products based on the similar users' scores for each of the candidate products; The candidate products whose scores meet the preset score requirements are used as recommended products for the target users.
9. The method according to claim 3, characterized in that The constructing the scoring matrix based on the scoring values includes: The target users are used to represent the rows of the rating matrix, the candidate products are used to represent the columns of the rating matrix, and the rating values of the target users for the candidate products are used as the values corresponding to the rows and columns to construct the rating matrix.
10. The method according to claim 1, characterized in that The obtaining of user information of multiple users includes: Obtaining authorization for information collection from each of the users; After obtaining the authorization, user information of multiple users is obtained.
11. A product recommendation device, characterized in that: The device comprises: An acquisition module, configured to acquire user information of a plurality of users, wherein the user information includes at least a plurality of user characteristics of the users; A generating module, configured to generate a preference value of each user for each candidate product based on the number of visits and visit time of each user to each candidate product; a construction module, configured to construct a rating matrix corresponding to a target user based on the user characteristics corresponding to each of the users and the preference values of each of the users for each of the candidate products, wherein the target user is at least one of the plurality of users, and the rating matrix represents the probability that each of the target users will like to visit each of the candidate products; and The prediction module is used to predict at least one recommended product for the target user from each of the candidate products based on a preset collaborative filtering model and the rating matrix.
12. An electronic device comprising: one or more processors; a memory for storing one or more computer programs, It is characterized in that the one or more processors execute the one or more computer programs to implement the steps of the method according to any one of claims 1 to 10.
13. A computer-readable storage medium having a computer program or instruction stored thereon, characterized in that: When the computer program or instruction is executed by a processor, the steps of the method according to any one of claims 1 to 10 are implemented.