A training method, device and system for a ranking model for product recommendation
By generating an initial sample set and screening qualified samples for product recommendation ranking model training, the problem of insufficient negative samples and inaccurate labels is solved, and the accuracy and recommendation effect of the model are improved.
Patent Information
- Application Number
- CN202010797701.8
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2020-08-10
- Publication Date
- 2024-10-15
- Estimated Expiration
- 2040-08-10
AI Technical Summary
When traditional methods construct negative samples for product recommendation systems, the sample information is insufficient and the labels are not accurate enough, resulting in poor ranking model training results.
By obtaining the user data table, product data table and user behavior data table, an initial sample set is generated, and samples that meet the preset conditions are screened based on the scoring model to form a final sample set for sorting model training to improve the number of samples and label accuracy.
The accuracy and training effect of the ranking model are improved, making the recommendation results more accurate.
Smart Images

Figure CN112116411B_ABST
Abstract
Description
Technical Field
[0001] The present specification relates to the technical field of machine learning models, and more specifically, to a training method for a ranking model for product recommendation, a training device for a ranking model for product recommendation, a system including at least one computing device and at least one storage device, and a computer-readable storage medium. Background Art
[0002] With the popularization of big data technology, it is becoming more and more popular to use data mining methods to build product recommendation systems. Generally speaking, recommendation systems are generally divided into two parts: recall and sorting. Recall is responsible for reducing the number of products. For a specific user, the recall module is responsible for providing the user's product candidate set. The sorting module sorts these product candidate sets and recommends the top ranked products to the corresponding customers.
[0003] The sorting model in the training sorting module needs to construct positive and negative samples. Usually, maintaining a suitable ratio of positive and negative samples can allow the sorting model to achieve better results. However, in actual scenarios, the number of negative samples usually cannot meet the ratio of positive and negative samples. In this case, it is necessary to manually construct negative samples.
[0004] When constructing negative samples, traditional methods usually first construct the Cartesian product of users and products, and then sample and select some of the Cartesian product results as negative samples. However, when traditional methods sample a small number of Cartesian products, the amount of sample information is usually not enough for the ranking model to learn useful information. When the sampling is large, a large number of positive samples may be mixed in the collected samples, which makes the sample labels used to train the model inaccurate. Summary of the invention
[0005] One purpose of this specification is to provide a new technical solution for training a ranking model for product recommendation.
[0006] According to a first aspect of the present specification, a training method for a ranking model for product recommendation is provided, comprising:
[0007] Obtain a user data table reflecting user information, a product data table reflecting product information, and a user behavior data table reflecting the target user performing a specified operation on the target product;
[0008] Generate an initial sample set according to the user data table, the product data table and the user behavior data table;
[0009] According to a pre-selected machine learning algorithm, a machine learning model is trained based on the initial sample set to obtain a scoring model;
[0010] According to the scoring model, samples meeting preset conditions are screened from the initial sample set to generate a final sample set;
[0011] Machine learning training is performed based on the final sample set to obtain a ranking model for product recommendation.
[0012] Optionally, generating the initial sample set according to the user data table, the product data table, and the user behavior data table includes:
[0013] Generate a positive sample set with a label of a first set value and a negative sample set with a label of a second set value according to the user data table, the product data table and the user behavior data table;
[0014] Generate a first sample set according to the user data table and the product data table;
[0015] Marking the label of each first sample in the first sample set as a second set value;
[0016] The first sample set, the positive sample set and the negative sample set are combined to obtain the initial sample set.
[0017] Optionally, generating a positive sample set with a label of a first set value and a negative sample set with a label of a second set value according to the user data table, the product data table, and the user behavior data table includes:
[0018] Determine, according to the user behavior data table, a first user-product pair in which a target user performs a first specified operation on a target product, and a second user-product pair in which the target user performs a second specified operation on the target product but does not perform the first specified operation;
[0019] Generate the positive sample set according to the user information of the target user corresponding to the first user-product pair in the user data table and the product information of the target product corresponding to the first user-product pair in the product data table, and mark the label of each positive sample in the positive sample set as the first set value;
[0020] The negative sample set is generated based on the user information of the target user corresponding to the second user-product pair in the user data table, and the product information of the target product corresponding to the second user-product pair in the product data table, and the label of each negative sample in the negative sample set is marked as the second set value.
[0021] Optionally, generating the first sample set according to the user data table and the product data table includes:
[0022] Determine the Cartesian product of the user in the user data table and the commodity in the commodity data table to obtain a user-commodity pair set;
[0023] Deleting the first user-product pair and the second user-product pair from the user-product pair set to obtain a third user-product pair;
[0024] generating a second sample set according to the user information of the user corresponding to the third user-product pair in the user data table and the product information of the product corresponding to the third user-product pair in the product data table;
[0025] A first set number of second samples are selected from the second sample set to obtain the first sample set.
[0026] Optionally, also include:
[0027] Obtaining a first number of positive samples in the positive sample set and a preset first multiple;
[0028] The first set quantity is determined according to the first quantity and the first multiple.
[0029] Optionally, the step of screening samples meeting preset conditions from the initial sample set according to the scoring model to generate a final sample set includes:
[0030] Scoring the initial samples in the initial sample set according to the scoring model;
[0031] According to the scores of the initial samples, samples meeting preset conditions are screened from the initial sample set to generate a final sample set.
[0032] Optionally, the step of screening samples meeting preset conditions from the initial sample set according to the scores of the initial samples to generate a final sample set includes:
[0033] Determine a first scoring threshold according to the score of each positive sample in the positive sample set; determine a second scoring threshold according to the score of each negative sample in the negative sample set;
[0034] According to the score of each first sample in the first sample set, the first score threshold, and the second score threshold, samples meeting a preset condition are screened from the first sample set to generate a third sample set, and according to the score of each third sample in the third sample set, labels of corresponding third samples are marked;
[0035] The third sample set, the positive sample set and the negative sample set are combined to obtain the final sample set.
[0036] Optionally, determining the first scoring threshold according to the score of each positive sample in the positive sample set; and determining the second scoring threshold according to the score of each negative sample in the negative sample set includes:
[0037] Determine the average value of the score of each positive sample in the positive sample set as the first score threshold; determine the average value of the score of each negative sample in the negative sample set as the second score threshold; or,
[0038] The quantile of the score of each positive sample in the positive sample set is determined as the first score threshold; the quantile of the score of each negative sample in the negative sample set is determined as the second score threshold.
[0039] Optionally, the screening, according to the score of each first sample in the first sample set, the first score threshold, and the second score threshold, of samples meeting a preset condition from the first sample set to generate a third sample set, and marking a label of a corresponding third sample according to the score of each third sample in the third sample set includes:
[0040] Acquire a first sample in the first sample set whose score is greater than or equal to the first score threshold as a fourth sample, and mark a label of the fourth sample as the first set value;
[0041] Acquire a first sample in the first sample set whose score is less than or equal to the second score threshold as a fifth sample, and mark a label of the fifth sample as the second set value;
[0042] Selecting a second set number of other first samples as sixth samples, and marking the labels of the sixth samples as the second set value; wherein the other first samples are first samples in the first sample set except the fourth sample and the fifth sample;
[0043] The fourth sample, the fifth sample and the sixth sample are combined to obtain the third sample set.
[0044] Optionally, also include:
[0045] Obtaining a first number of the positive samples, a second number of the negative samples, a third number of the fourth samples, a fourth number of the fifth samples, and a preset second multiple;
[0046] The second set number is determined according to the first number, the second number, the third number, the fourth number, and the second multiple.
[0047] Optionally, the machine learning algorithm is any one of a support vector machine algorithm, a GBDT algorithm, and a neural network.
[0048] Optionally, performing machine learning training based on the final sample set to obtain a ranking model for product recommendation includes:
[0049] According to a preset binary classification algorithm, machine learning training is performed based on the final sample set to obtain the product recommendation model; or,
[0050] The scoring model is iteratively updated and trained based on the final sample set to obtain the ranking model.
[0051] Optionally, also include:
[0052] Obtaining user information of a user to be recommended and product information of at least one preset candidate product;
[0053] Based on the ranking model, according to the user information of the user to be recommended and the product information of each candidate product, obtaining the recommendation score of each candidate product corresponding to the user to be recommended;
[0054] The candidate products whose recommendation scores meet the preset recommendation conditions are selected and recommended to the to-be-recommended user as recommended products.
[0055] Optionally, the step of selecting the candidate products whose recommendation scores meet preset recommendation conditions and recommending them as recommended products to the to-be-recommended user includes:
[0056] Sorting the candidate products in descending order according to the recommendation score, and obtaining the ranking order of each candidate product;
[0057] The candidate commodities whose sorting order meets the preset sorting range are selected and recommended to the user to be recommended as recommended commodities.
[0058] Optionally, also include:
[0059] The candidate commodities and the ranking order of each candidate commodity are displayed.
[0060] According to a second aspect of the present specification, there is provided a training device for a ranking model for commodity recommendation, comprising:
[0061] A data table acquisition module is used to acquire a user data table reflecting user information, a commodity data table reflecting commodity information, and a user behavior data table reflecting a target user performing a specified operation on a target commodity;
[0062] An initial sample generation module, used to generate an initial sample set according to the user data table, the product data table and the user behavior data table;
[0063] A first model training module is used to perform machine learning model training based on the initial sample set according to a pre-selected machine learning algorithm to obtain a scoring model;
[0064] A final sample generation module, used to screen samples that meet preset conditions from the initial sample set according to the scoring model to generate a final sample set;
[0065] The second model training module is used to perform machine learning training based on the final sample set to obtain a ranking model for product recommendation.
[0066] Optionally, the initial sample generation module is used to:
[0067] Generate a positive sample set with a label of a first set value and a negative sample set with a label of a second set value according to the user data table, the product data table and the user behavior data table;
[0068] Generate a first sample set according to the user data table and the product data table;
[0069] Marking the label of each first sample in the first sample set as a second set value;
[0070] The first sample set, the positive sample set and the negative sample set are combined to obtain the initial sample set.
[0071] Optionally, generating a positive sample set with a label of a first set value and a negative sample set with a label of a second set value according to the user data table, the product data table, and the user behavior data table includes:
[0072] Determine, according to the user behavior data table, a first user-product pair in which a target user performs a first specified operation on a target product, and a second user-product pair in which the target user performs a second specified operation on the target product but does not perform the first specified operation;
[0073] Generate the positive sample set according to the user information of the target user corresponding to the first user-product pair in the user data table and the product information of the target product corresponding to the first user-product pair in the product data table, and mark the label of each positive sample in the positive sample set as the first set value;
[0074] The negative sample set is generated based on the user information of the target user corresponding to the second user-product pair in the user data table, and the product information of the target product corresponding to the second user-product pair in the product data table, and the label of each negative sample in the negative sample set is marked as the second set value.
[0075] Optionally, generating the first sample set according to the user data table and the product data table includes:
[0076] Determine the Cartesian product of the user in the user data table and the commodity in the commodity data table to obtain a user-commodity pair set;
[0077] Deleting the first user-product pair and the second user-product pair from the user-product pair set to obtain a third user-product pair;
[0078] generating a second sample set according to the user information of the user corresponding to the third user-product pair in the user data table and the product information of the product corresponding to the third user-product pair in the product data table;
[0079] A first set number of second samples are selected from the second sample set to obtain the first sample set.
[0080] Optionally, also include:
[0081] A module for obtaining a first number of positive samples in the positive sample set and a preset first multiple;
[0082] A module for determining the first set number according to the first number and the first multiple.
[0083] Optionally, the step of screening samples meeting preset conditions from the initial sample set according to the scoring model to generate a final sample set includes:
[0084] Scoring the initial samples in the initial sample set according to the scoring model;
[0085] According to the scores of the initial samples, samples meeting preset conditions are screened from the initial sample set to generate a final sample set.
[0086] Optionally, the final sample generation module is further used for:
[0087] Determine a first scoring threshold according to the score of each positive sample in the positive sample set; determine a second scoring threshold according to the score of each negative sample in the negative sample set;
[0088] According to the score of each first sample in the first sample set, the first score threshold, and the second score threshold, samples meeting a preset condition are screened from the first sample set to generate a third sample set, and according to the score of each third sample in the third sample set, labels of corresponding third samples are marked;
[0089] The third sample set, the positive sample set and the negative sample set are combined to obtain the final sample set.
[0090] Optionally, determining the first scoring threshold according to the score of each positive sample in the positive sample set; and determining the second scoring threshold according to the score of each negative sample in the negative sample set includes:
[0091] Determine the average value of the score of each positive sample in the positive sample set as the first score threshold; determine the average value of the score of each negative sample in the negative sample set as the second score threshold; or,
[0092] The quantile of the score of each positive sample in the positive sample set is determined as the first score threshold; the quantile of the score of each negative sample in the negative sample set is determined as the second score threshold.
[0093] Optionally, the screening, according to the score of each first sample in the first sample set, the first score threshold, and the second score threshold, of samples meeting a preset condition from the first sample set to generate a third sample set, and marking a label of a corresponding third sample according to the score of each third sample in the third sample set includes:
[0094] Acquire a first sample in the first sample set whose score is greater than or equal to the first score threshold as a fourth sample, and mark a label of the fourth sample as the first set value;
[0095] Acquire a first sample in the first sample set whose score is less than or equal to the second score threshold as a fifth sample, and mark a label of the fifth sample as the second set value;
[0096] Selecting a second set number of other first samples as sixth samples, and marking the labels of the sixth samples as the second set value; wherein the other first samples are first samples in the first sample set except the fourth sample and the fifth sample;
[0097] The fourth sample, the fifth sample and the sixth sample are combined to obtain the third sample set.
[0098] Optionally, also include:
[0099] A module for obtaining a first number of the positive samples, a second number of the negative samples, a third number of the fourth samples, a fourth number of the fifth samples, and a preset second multiple;
[0100] A module for determining the second set number according to the first number, the second number, the third number, the fourth number and the second multiple.
[0101] Optionally, the machine learning algorithm is any one of a support vector machine algorithm, a GBDT algorithm, and a neural network.
[0102] Optionally, the second model training module is further used for:
[0103] According to a preset binary classification algorithm, machine learning training is performed based on the final sample set to obtain the product recommendation model; or,
[0104] The scoring model is iteratively updated and trained based on the final sample set to obtain the ranking model.
[0105] Optionally, also include:
[0106] A module for obtaining user information of a user to be recommended and commodity information of at least one preset candidate commodity;
[0107] A module for obtaining, based on the ranking model and according to the user information of the user to be recommended and the product information of each candidate product, a recommendation score of each candidate product corresponding to the user to be recommended;
[0108] A module for selecting candidate commodities whose recommendation scores meet preset recommendation conditions and recommending them to the to-be-recommended user as recommended commodities.
[0109] Optionally, selecting the candidate product whose recommendation score meets a preset recommendation condition and recommending it as a recommended product to the to-be-recommended user includes:
[0110] Sorting the candidate products in descending order according to the recommendation score, and obtaining the ranking order of each candidate product;
[0111] The candidate commodities whose sorting order meets the preset sorting range are selected and recommended to the user to be recommended as recommended commodities.
[0112] Optionally, also include:
[0113] A module for displaying the candidate commodities and the ranking order of each candidate commodity.
[0114] According to a third aspect of the present specification, a system is provided comprising at least one computing device and at least one storage device, wherein the at least one storage device is used to store instructions, and the instructions are used to control the at least one computing device to execute the method described in the first aspect of the present specification.
[0115] According to a fourth aspect of the present specification, a computer-readable storage medium is provided, on which a computer program is stored. When the computer program is executed by a processor, the method described in the first aspect of the present specification is implemented.
[0116] Through the method of this embodiment, an initial sample set is constructed, and the scoring model is trained with the initial sample set. Then, the scoring model is used to screen out samples that meet preset conditions from the initial sample set to obtain a final sample set. Based on the final sample set, a ranking model for product recommendation is trained. This can increase the number of final samples used to train the ranking model and improve the accuracy of the labels of the final samples, thereby making the trained ranking model more accurate.
[0117] Other features and advantages of the present specification will become apparent from the following detailed description of exemplary embodiments of the present specification with reference to the accompanying drawings. BRIEF DESCRIPTION OF THE DRAWINGS
[0118] The accompanying drawings, which are incorporated in and constitute a part of the specification, illustrate embodiments of the specification and, together with the description, serve to explain the principles of the specification.
[0119] Figure 1 is a block diagram of an example of a hardware configuration of an electronic device that can be used to implement the embodiments of the present specification.
[0120] Figure 2 is a flowchart of a training method for a ranking model for product recommendation according to an embodiment of this specification;
[0121] Figure 3 is a flowchart of an application method of a sorting model according to an embodiment of this specification;
[0122] Figure 4 A flowchart of an example of a method for training a ranking model for product recommendation according to an embodiment of this specification;
[0123] Figure 5 is a block diagram of an example of a training device for a ranking model for product recommendation according to an embodiment of this specification;
[0124] Figure 6 is a block diagram of a system according to an embodiment of the present specification. DETAILED DESCRIPTION
[0125] Various exemplary embodiments of the present specification will now be described in detail with reference to the accompanying drawings. It should be noted that unless otherwise specifically stated, the relative arrangement of components and steps, numerical expressions and numerical values set forth in these embodiments do not limit the scope of the present specification.
[0126] The following description of at least one exemplary embodiment is merely illustrative in nature and is in no way intended to limit the present specification, its application, or uses.
[0127] Technologies, methods, and equipment known to ordinary technicians in the relevant art may not be discussed in detail, but where appropriate, the technologies, methods, and equipment should be considered as part of the specification.
[0128] In all examples shown and discussed herein, any specific values should be interpreted as merely exemplary and not limiting. Therefore, other examples of the exemplary embodiments may have different values.
[0129] It should be noted that like reference numerals and letters refer to similar items in the following figures, and therefore, once an item is defined in one figure, it need not be further discussed in subsequent figures.
[0130] Hereinafter, various embodiments and examples according to the embodiments of the present specification will be described with reference to the drawings.
[0131] <Hardware Configuration>
[0132] Figure 1 1 is a block diagram showing a hardware configuration of an electronic device 1000 that can implement the embodiments of the present specification.
[0133] The electronic device 1000 may be a portable computer, a desktop computer, a mobile phone, a tablet computer, etc. Figure 1 As shown, the electronic device 1000 may include a processor 1100, a memory 1200, an interface device 1300, a communication device 1400, a display device 1500, an input device 1600, a speaker 1700, a microphone 1800, and the like. Among them, the processor 1100 may be a central processing unit CPU, a microprocessor MCU, and the like. The memory 1200 includes, for example, a ROM (read-only memory), a RAM (random access memory), a non-volatile memory such as a hard disk, and the like. The interface device 1300 includes, for example, a USB interface, a headphone interface, and the like. The communication device 1400 is, for example, capable of wired or wireless communication, and may specifically include Wifi communication, Bluetooth communication, 2G / 3G / 4G / 5G communication, and the like. The display device 1500 is, for example, a liquid crystal display screen, a touch display screen, and the like. The input device 1600 may include, for example, a touch screen, a keyboard, a somatosensory input, and the like. The user may input / output voice information through the speaker 1700 and the microphone 1800.
[0134] Figure 1 The electronic device shown is merely illustrative and does not in any way limit the present specification, its application or use. In the embodiments of the present specification, the memory 1200 of the electronic device 1000 is used to store instructions, and the instructions are used to control the processor 1100 to operate to perform any of the methods provided in the embodiments of the present specification. It should be understood by those skilled in the art that although Figure 1In the electronic device 1000, multiple devices are shown, but this specification may only involve some of the devices, for example, the electronic device 1000 only involves the processor 1100 and the storage device 1200. A technician can design instructions according to the scheme disclosed in this specification. How instructions control the processor to operate is well known in the art, so it will not be described in detail here.
[0135] <Method Example>
[0136] In this embodiment, a training method for a ranking model for commodity recommendation is provided. The training method for a ranking model for commodity recommendation can be implemented by an electronic device. The electronic device can be Figure 1 An electronic device 1000 is shown.
[0137] according to Figure 2 As shown, the training method for the ranking model for product recommendation in this embodiment may include the following steps S2100 to S2500:
[0138] Step S2100 , obtaining a user data table reflecting user information, a commodity data table reflecting commodity information, and a user behavior data table reflecting a target user performing a designated operation on a target commodity.
[0139] In the user data table of this embodiment, user information of multiple users may be recorded, for example, including age, deposit balance, whether to buy a house, etc., as shown in the following Table 1:
[0140] Table 1
[0141]
[0142] In the user information of whether to buy a house in Table 1, 1 indicates that the corresponding user has bought a house, and 0 indicates that the corresponding user has not bought a house.
[0143] In the commodity data table of this embodiment, commodity information of multiple commodities may be recorded, for example, commodity price, sales volume, discount, etc., as shown in the following Table 2:
[0144] Table 2
[0145] Product ID Product Prices Sales Discount P0 1092 2 0.9 P1 43 3 0.88 P2 323 16 0.7 P3 1357 75 0.6 P4 234 32 0.9
[0146] In the user behavior data table of this embodiment, it may be recorded that the target user performs the first specified operation on the target product, or performs the second specified operation but does not perform the first specified operation, as shown in the following Table 3:
[0147] Table 3
[0148] User ID Product ID Behavior Type U0 P0 Buy U1 P2 Buy U2 P4 Buy U3 P1 Viewed without purchasing U4 P2 Viewed without purchasing U4 P4 Viewed without purchasing U1 P3 Viewed without purchasing U2 P3 Viewed without purchasing
[0149] In this embodiment, not every user will perform a specified operation on every commodity. Therefore, the user behavior data table usually cannot reflect that all users perform specified operations on all commodities, but can only reflect that the target user performs the specified operation on the target commodity.
[0150] Step S2200, generating an initial sample set according to the user data table, the product data table and the user behavior data table.
[0151] In one embodiment of the present specification, generating an initial sample set according to the user data table, the product data table, and the user behavior data table may include the following steps S2210 to S2240:
[0152] Step S2210: Generate a positive sample set with a label of a first set value and a negative sample set with a label of a second set value according to the user data table, the product data table and the user behavior data table.
[0153] In the embodiments of this specification, the first setting value and the second setting value may be set in advance according to the application scenario or specific requirements. For example, the first setting value may be 1, and the second setting value may be 0. This embodiment is described by taking the first setting value being greater than the second setting value as an example, and those skilled in the art should understand that the above examples are not intended to limit the protection scope of the present disclosure.
[0154] In one example, generating a positive sample set with a label of a first set value and a negative sample set with a label of a second set value according to a user data table, a product data table, and a user behavior data table may include the following steps S2211 to S2213:
[0155] Step S2211, according to the user behavior data table, determining a first user-product pair in which the target user performs a first designated operation on the target product, and a second user-product pair in which the target user performs a second designated operation on the target product but does not perform the first designated operation.
[0156] In this embodiment, if one of the target users performs a first designated operation on one of the target commodities, the target user and the target commodity can be used as a first user-commodity pair. If one of the target users performs a second designated operation on one of the target commodities and does not perform the first designated operation, the target user and the target commodity can be used as a second user-commodity pair. In the embodiment of this specification, a user-commodity pair includes a user and a commodity.
[0157] The user behavior data table records that the target user performs the first specified operation on the target product, and also records that the target user does not perform the first specified operation but performs the second specified operation on the target product. Therefore, the first product pair and the second product pair can be obtained according to the user behavior data table.
[0158] The first designated operation and the second designated operation in this embodiment can be pre-set according to the application scenario or specific needs. In the case where the user behavior data table is shown in Table 3 above, the first designated operation can be purchase, and the second designated operation can be browsing. Then, the first user-product pair can include: user U0 and product P0, user U1 and product P2, user U2 and product P4. The second user-product pair can include: user U3 and product P1, user U4 and product P2, user U4 and product P4, user U1 and product P3, user U2 and product P3.
[0159] Step S2212, generating a positive sample set according to the user information of the target user corresponding to the first user-product pair in the user data table and the product information of the target product corresponding to the first user-product pair in the product data table, and marking the label of each positive sample in the positive sample set as the first set value.
[0160] Step S2213, generating a negative sample set according to the user information of the target user corresponding to the second user-product pair in the user data table and the product information of the target product corresponding to the second user-product pair in the product data table, and marking the label of each negative sample in the negative sample set as the second set value.
[0161] In the embodiments of this specification, each sample corresponds to a user-product pair, and may include user features of the user and product features of the product in the corresponding user-product pair. The user features may be determined based on user information, and the product features may be determined based on product information.
[0162] Step S2220: Generate a first sample set according to the user data table and the product data table.
[0163] In one embodiment of the present specification, the step of generating the first sample set according to the user data table and the product data table may include the following steps S2221 to S2224:
[0164] Step S2221, determine the Cartesian product of the users in the user data table and the commodities in the commodity data table, and obtain a set of user-commodity pairs.
[0165] In the user data table shown in Table 1, users in the user data table may include: user U0, user U1, user U2, user U3 and user U4. In the commodity data table shown in Table 2, commodities in the commodity data table may include: commodity P0, commodity P1, commodity P2, commodity P3 and commodity P4.
[0166] Then, the user-item pair set obtained by determining the Cartesian product of the users in the user data table and the items in the item data table may include the user-item pairs consisting of each user and each item, including: user U0 and item P0, user U0 and item P1, user U0 and item P2, user U0 and item P3, user U0 and item P4, user U1 and item P0, user U1 and item P1, user U1 and item P2, user U1 and item P3, user U1 and item P4, user U2 and item P0, user U2 and item P1, user U2 and item P2, user U2 and item P3, user U2 and item P4, user U3 and item P0, user U3 and item P1, user U3 and item P2, user U3 and item P3, user U3 and item P4, user U4 and item P0, user U4 and item P1, user U4 and item P2, user U4 and item P3, user U4 and item P4.
[0167] Step S2222: Delete the first user-product pair and the second user-product pair from the user-product pair set to obtain a third user-product pair.
[0168] In the embodiments of Table 1, Table 2 and Table 3 above, the first user-product pair and the second user-product pair are deleted from the user-product pair set, and the obtained third user-product pair may include:
[0169] User U0 and product P1, user U0 and product P2, user U0 and product P3, user U0 and product P4, user U1 and product P0, user U1 and product P1, user U1 and product P4, user U2 and product P0, user U2 and product P1, user U2 and product P2, user U3 and product P0, user U3 and product P2, user U3 and product P3, user U3 and product P4, user U4 and product P0, user U4 and product P1, user U4 and product P3.
[0170] Step S2223, generating a second sample set according to the user information of the user corresponding to the third user-product pair in the user data table and the product information of the product corresponding to the third user-product pair in the product data table.
[0171] Step S2224: Select a first set number of second samples from the second sample set to obtain a first sample set.
[0172] Specifically, a sample set consisting of a first set number of second samples may be selected as the first sample set.
[0173] Since the third user-item pair is usually very large in actual applications, resulting in a large number of second samples in the second sample set, therefore, sampling the second sample set to obtain the first sample set can ensure that the number of first samples in the first sample set is within a controllable range.
[0174] In one embodiment of the present specification, the first set number may be pre-set according to an application scenario or specific requirements. For example, the first set number may be 100.
[0175] In another embodiment of the present specification, the method may further include a step of determining a first set number, including:
[0176] A first number of positive samples in a positive sample set and a preset first multiple are obtained; and a first set number is determined according to the first number and the first multiple.
[0177] The first multiple may be a hyperparameter for sample extraction, and may be adjusted according to the final model effect. The first multiple may be set to, for example, 10, 50, 100, etc.
[0178] Specifically, the product of the first quantity and the first multiple may be determined as the first set quantity.
[0179] Step S2230: Mark the label of each first sample in the first sample set as a second set value.
[0180] Step S2240: merge the first sample set, the positive sample set and the negative sample set to obtain an initial sample set.
[0181] Step S2300, according to the pre-selected machine learning algorithm, the machine learning model is trained based on the initial sample set to obtain a scoring model.
[0182] Specifically, the scoring model may be a model for scoring based on the input user information and product information. In one example, the scoring model may be a binary classification model.
[0183] In one embodiment of the present specification, the machine learning algorithm is any one of a support vector machine algorithm, a GBDT algorithm, and a neural network.
[0184] Step S2400: According to the scoring model, samples meeting preset conditions are screened from the initial sample set to generate a final sample set.
[0185] In one embodiment of the present specification, based on the scoring model, samples meeting preset conditions are screened from the initial sample set, and generating the final sample set may include steps S2410 and S2420 as shown below:
[0186] Step S2410: score the initial samples in the initial sample set according to the scoring model.
[0187] In this embodiment, the initial samples in the initial sample set are scored according to the scoring model, and the score of each initial sample can be obtained.
[0188] Step S2420, based on the scores of the initial samples, samples that meet the preset conditions are screened from the initial sample set to generate a final sample set.
[0189] In one embodiment of the present specification, based on the scores of the initial samples, samples meeting the preset conditions are screened from the initial sample set, and generating the final sample set may include the following steps S2421 to S2423:
[0190] Step S2421, determining a first scoring threshold according to the score of each positive sample in the positive sample set; determining a second scoring threshold according to the score of each negative sample in the negative sample set.
[0191] In the embodiment of the present specification, the initial sample set is obtained by combining the first sample set, the positive sample set and the negative sample set. Therefore, the initial sample set may include the first sample in the first sample set, the positive sample in the positive sample set and the negative sample in the negative sample set.
[0192] In one embodiment of the present specification, the method of determining the first scoring threshold according to the scores of the positive samples in the positive sample set may include: determining the average value or quantile of the score of each positive sample in the positive sample set as the first scoring threshold.
[0193] Correspondingly, the method of determining the second scoring threshold according to the scores of the negative samples in the negative sample set may include: determining an average value or a quantile of the score of each negative sample in the negative sample set as the second scoring threshold.
[0194] For example, when the first setting value is 1 and the second setting value is 0, the first scoring threshold value obtained may be 0.85 and the second scoring threshold value may be 0.15.
[0195] Step S2422, based on the score of each first sample in the first sample set, the first score threshold and the second score threshold, samples that meet the preset conditions are screened out from the first sample set to generate a third sample set, and based on the score of each third sample in the third sample set, the labels of the corresponding third samples are marked.
[0196] In one embodiment of the present specification, according to the score of each first sample in the first sample set, the first score threshold and the second score threshold, samples meeting the preset condition are screened out from the first sample set to generate a third sample set, and according to the score of each third sample in the third sample set, the label of the corresponding third sample is marked, which may include the following steps S2422-1 to S2422-4:
[0197] Step S2422-1: Obtain a first sample in the first sample set whose score is greater than or equal to the first score threshold as the fourth sample, and mark the label of the fourth sample as the first set value.
[0198] Step S2422-2: Obtain the first sample in the first sample set whose score is less than or equal to the second score threshold as the fifth sample, and mark the label of the fifth sample as the second set value.
[0199] Step S2422-3: Select a second set number of other first samples as the sixth sample, and mark the label of the sixth sample as the second set value.
[0200] Among them, the other first samples are the first samples in the first sample set except the fourth sample and the fifth sample.
[0201] In one embodiment of the present specification, the second set number may be pre-set according to an application scenario or specific requirements. For example, the second set number may be 100.
[0202] In another embodiment of the present specification, the method may further include a step of determining a second set number, including:
[0203] Obtain a first number of positive samples, a second number of negative samples, a third number of fourth samples, a fourth number of fifth samples, and a preset second multiple; determine a second set number based on the first number, the second number, the third number, the fourth number, and the second multiple.
[0204] Specifically, the second set quantity Y can be determined by the following formula:
[0205] Y=r2*D1-D2-D3-D4
[0206] Among them, r2 is the second multiple, D1 is the first number, D2 is the second number, D3 is the third number, and D4 is the fourth number.
[0207] The second multiple may be a hyperparameter for sample extraction, and may be adjusted according to the final model effect. The second multiple may be set to 10, 50, 100, etc., for example.
[0208] Step S2422-4: merge the fourth sample, the fifth sample and the sixth sample to obtain a third sample set.
[0209] Step S2423: merge the third sample set, the positive sample set and the negative sample set to obtain a final sample set.
[0210] Step S2500: Perform machine learning training based on the final sample set to obtain a ranking model for product docking.
[0211] In one embodiment of the present specification, the scoring model may be iteratively updated based on the final sample set to obtain a ranking model.
[0212] In another embodiment of the present specification, a machine learning model can be trained based on the final sample set according to a pre-selected binary classification algorithm to obtain a ranking model. The binary classification algorithm used to train the ranking model and the machine learning algorithm used to train the scoring model can be the same or different, and this specification does not limit this.
[0213] Through the method of this embodiment, an initial sample set is constructed, and the scoring model is trained with the initial sample set. Then, the scoring model is used to screen out samples that meet preset conditions from the initial sample set to obtain a final sample set. Based on the final sample set, a ranking model for product recommendation is trained. This can increase the number of final samples used to train the ranking model and improve the accuracy of the labels of the final samples, thereby making the trained ranking model more accurate.
[0214] In one embodiment of the present specification, product recommendations can be made to users based on the final product recommendation model. Specifically, the method may also include: Figure 3 Steps S3100 to S3300 shown:
[0215] Step S3100, obtaining user information of a user to be recommended and product information of at least one preset candidate product.
[0216] Step S3200, based on the ranking model, according to the user information of the user to be recommended and the product information of each candidate product, obtain the recommendation score of each candidate product corresponding to the user to be recommended.
[0217] Specifically, the user information of the user to be recommended and the product information of each candidate product can generate features corresponding to each candidate user-product pair. Each candidate user-product pair includes the user to be recommended and the corresponding candidate product. By inputting each candidate user-product pair into the final product recommendation model, the score of each candidate user-product pair can be obtained, that is, the recommendation score of each candidate product corresponding to the user to be recommended.
[0218] Step S3300, selecting candidate products whose recommendation scores meet preset recommendation conditions and recommending them to the user to be recommended as recommended products.
[0219] In one embodiment of the present specification, the step of selecting candidate commodities whose recommendation scores meet preset recommendation conditions and recommending them as recommended commodities to the user to be recommended includes the following steps S3310 and S3320:
[0220] Step S3310, sort the candidate products in descending order according to the recommendation score, and obtain the sorting order of each candidate product.
[0221] Step S3320, selecting candidate products whose sorting order meets the preset sorting range and recommending them to the user to be recommended as recommended products.
[0222] In one embodiment of the present specification, the sorting range may be pre-set according to the application scenario or specific needs. For example, the sorting range may be 1 to 3. Then, candidate products with a sorting order of 1, 2, and 3 may be selected and recommended to the user to be recommended as recommended products.
[0223] In one embodiment of the present specification, the method may further include:
[0224] Display candidate products and the ranking order of each candidate product for recommendation users to choose.
[0225] <Example>
[0226] Figure 4 The flowchart is a diagram of an example of a method for training a ranking model for product recommendation according to an embodiment of the present specification.
[0227] like Figure 4 As shown, the method may include:
[0228] Step S4001, obtaining a user data table reflecting user information, a commodity data table reflecting commodity information, and a user behavior data table reflecting a target user performing a designated operation on a target commodity.
[0229] Step S4002: determining, according to the user behavior data table, a first user-product pair in which the target user performs a first designated operation on the target product, and a second user-product pair in which the target user performs a second designated operation on the target product but does not perform the first designated operation.
[0230] Step S4003, generating a positive sample set according to the user information of the target user corresponding to the first user-product pair in the user data table and the product information of the target product corresponding to the first user-product pair in the product data table, and marking the label of each positive sample in the positive sample set as the first set value.
[0231] Step S4004, generating a negative sample set according to the user information of the target user corresponding to the second user-product pair in the user data table and the product information of the target product corresponding to the second user-product pair in the product data table, and marking the label of each negative sample in the negative sample set as the second set value.
[0232] Step S4005, determine the Cartesian product of the users in the user data table and the commodities in the commodity data table to obtain a set of user-commodity pairs.
[0233] Step S4006: Delete the first user-product pair and the second user-product pair from the user-product pair set to obtain a third user-product pair.
[0234] Step S4007: Generate a second sample set based on the user information of the user corresponding to the third user-product pair in the user data table and the product information of the product corresponding to the third user-product pair in the product data table.
[0235] Step S4008: Select a first set number of second samples from the second sample set to obtain a first sample set.
[0236] Step S4009: Mark the label of each first sample in the first sample set as a second set value.
[0237] Step S4010: merge the first sample set, the positive sample set and the negative sample set to obtain an initial sample set.
[0238] Step S4011, according to the pre-selected machine learning algorithm, the machine learning model is trained based on the initial sample set to obtain a scoring model.
[0239] Step S4012: score the initial samples in the initial sample set according to the scoring model.
[0240] Step S4013, determining a first scoring threshold according to the score of each positive sample in the positive sample set; determining a second scoring threshold according to the score of each negative sample in the negative sample set.
[0241] Step S4014: obtaining a first sample in the first sample set whose score is greater than or equal to the first score threshold as a fourth sample, and marking a label of the fourth sample as a first set value.
[0242] Step S4015: obtaining a first sample in the first sample set whose score is less than or equal to the second score threshold as the fifth sample, and marking the label of the fifth sample as the second set value.
[0243] Step S4016: Select a second set number of other first samples as the sixth sample, and mark the label of the sixth sample as the second set value.
[0244] Step S4017: merge the fourth sample, the fifth sample and the sixth sample to obtain a third sample set.
[0245] Step S4018: merge the third sample set, the positive sample set and the negative sample set to obtain a final sample set.
[0246] Step S4019: Perform machine learning training based on the final sample set to obtain a ranking model for product docking.
[0247] <Device Example>
[0248] In this embodiment, a training device 5000 for a ranking model for commodity recommendation is provided. Figure 5 As shown, it includes a data table acquisition module 5100, an initial sample generation module 5200, a first model training module 5300, a final sample generation module 5400 and a second model training module 5500. The data table acquisition module 5100 is used to acquire a user data table reflecting user information, a commodity data table reflecting commodity information, and a user behavior data table reflecting the target user performing a specified operation on the target commodity; the initial sample generation module 5200 is used to generate an initial sample set according to the user data table, the commodity data table and the user behavior data table; the first model training module 5300 is used to perform machine learning model training based on the initial sample set according to a pre-selected machine learning algorithm to obtain a scoring model; the final sample generation module 5400 is used to screen samples that meet preset conditions from the initial sample set according to the scoring model to generate a final sample set; the second model training module 5500 is used to perform machine learning training based on the final sample set to obtain a ranking model for commodity recommendation.
[0249] In one embodiment of the present specification, the initial sample generation module 5200 is used to:
[0250] Generate a positive sample set with a label of a first set value and a negative sample set with a label of a second set value according to the user data table, the product data table and the user behavior data table;
[0251] Generate a first sample set according to the user data table and the product data table;
[0252] Marking the label of each first sample in the first sample set as a second set value;
[0253] The first sample set, the positive sample set and the negative sample set are combined to obtain an initial sample set.
[0254] In one embodiment of the present specification, generating a positive sample set with a label of a first set value and a negative sample set with a label of a second set value according to a user data table, a product data table, and a user behavior data table includes:
[0255] Determine, according to the user behavior data table, a first user-product pair in which the target user performs a first specified operation on the target product, and a second user-product pair in which the target user performs a second specified operation on the target product but does not perform the first specified operation;
[0256] Generate a positive sample set according to the user information of the target user corresponding to the first user-product pair in the user data table and the product information of the target product corresponding to the first user-product pair in the product data table, and mark the label of each positive sample in the positive sample set as a first set value;
[0257] A negative sample set is generated based on the user information of the target user corresponding to the second user-product pair in the user data table and the product information of the target product corresponding to the second user-product pair in the product data table, and the label of each negative sample in the negative sample set is marked as the second set value.
[0258] In one embodiment of the present specification, generating the first sample set according to the user data table and the product data table includes:
[0259] Determine the Cartesian product of the user in the user data table and the item in the item data table to obtain a set of user-item pairs;
[0260] Delete the first user-product pair and the second user-product pair from the user-product pair set to obtain a third user-product pair;
[0261] Generate a second sample set according to user information of a user corresponding to the third user-product pair in the user data table and product information of a product corresponding to the third user-product pair in the product data table;
[0262] A first set number of second samples are selected from the second sample set to obtain a first sample set.
[0263] In one embodiment of the present specification, it also includes:
[0264] A module for obtaining a first number of positive samples in a positive sample set and a preset first multiple;
[0265] A module for determining a first set quantity according to a first quantity and a first multiple.
[0266] In one embodiment of the present specification, based on the scoring model, samples meeting preset conditions are screened from the initial sample set to generate the final sample set, including:
[0267] According to the scoring model, the initial samples in the initial sample set are scored;
[0268] According to the scores of the initial samples, samples that meet the preset conditions are screened from the initial sample set to generate the final sample set.
[0269] In one embodiment of the present specification, the final sample generation module 5400 is further used to:
[0270] Determine a first scoring threshold according to the score of each positive sample in the positive sample set; determine a second scoring threshold according to the score of each negative sample in the negative sample set;
[0271] According to the score of each first sample in the first sample set, the first score threshold and the second score threshold, samples meeting the preset conditions are screened from the first sample set to generate a third sample set, and according to the score of each third sample in the third sample set, labels of corresponding third samples are marked;
[0272] The third sample set, the positive sample set and the negative sample set are combined to obtain the final sample set.
[0273] In one embodiment of the present specification, determining the first scoring threshold according to the score of each positive sample in the positive sample set; determining the second scoring threshold according to the score of each negative sample in the negative sample set includes:
[0274] Determine the average value of the score of each positive sample in the positive sample set as the first score threshold; determine the average value of the score of each negative sample in the negative sample set as the second score threshold; or,
[0275] The quantile of the score of each positive sample in the positive sample set is determined as the first score threshold; the quantile of the score of each negative sample in the negative sample set is determined as the second score threshold.
[0276] In one embodiment of the present specification, according to the score of each first sample in the first sample set, the first score threshold and the second score threshold, screening samples meeting the preset condition from the first sample set to generate a third sample set, and marking the label of the corresponding third sample according to the score of each third sample in the third sample set includes:
[0277] Obtain a first sample in the first sample set whose score is greater than or equal to the first score threshold as a fourth sample, and mark a label of the fourth sample as a first set value;
[0278] Obtain a first sample in the first sample set whose score is less than or equal to the second score threshold as a fifth sample, and mark the label of the fifth sample as a second set value;
[0279] Selecting a second set number of other first samples as sixth samples, and marking the labels of the sixth samples as the second set value; wherein the other first samples are first samples other than the fourth sample and the fifth sample in the first sample set;
[0280] The fourth sample, the fifth sample and the sixth sample are combined to obtain a third sample set.
[0281] In one embodiment of the present specification, it also includes:
[0282] A module for obtaining a first number of positive samples, a second number of negative samples, a third number of fourth samples, a fourth number of fifth samples, and a preset second multiple;
[0283] A module for determining a second set quantity according to the first quantity, the second quantity, the third quantity, the fourth quantity and the second multiple.
[0284] In one embodiment of the present specification, the machine learning algorithm is any one of a support vector machine algorithm, a GBDT algorithm, and a neural network.
[0285] In one embodiment of the present specification, the second model training module 5500 may also be used for:
[0286] According to the preset binary classification algorithm, machine learning training is performed based on the final sample set to obtain a product recommendation model; or,
[0287] The scoring model is iteratively updated and trained based on the final sample set to obtain the ranking model.
[0288] In one embodiment of the present specification, it also includes:
[0289] A module for obtaining user information of a user to be recommended and commodity information of at least one preset candidate commodity;
[0290] A module for obtaining a recommendation score of each candidate product corresponding to the user to be recommended based on the ranking model and the user information of the user to be recommended and the product information of each candidate product;
[0291] A module used to select candidate products whose recommendation scores meet the preset recommendation conditions and recommend them to the users to be recommended as recommended products.
[0292] In one embodiment of the present specification, selecting candidate commodities whose recommendation scores meet preset recommendation conditions and recommending them as recommended commodities to the user to be recommended includes:
[0293] Sort candidate products in descending order according to the recommendation score, and obtain the ranking order of each candidate product;
[0294] The candidate products whose sorting order meets the preset sorting range are selected and recommended to the user to be recommended as recommended products.
[0295] In one embodiment of the present specification, it also includes:
[0296] A module used to display candidate products and the ranking order of each candidate product.
[0297] Those skilled in the art should understand that the training device 5000 for the ranking model for commodity recommendation can be implemented in various ways. For example, the training device 5000 for the ranking model for commodity recommendation can be implemented by configuring the processor with instructions. For example, the instructions can be stored in a ROM, and when the device is started, the instructions are read from the ROM into a programmable device to implement the training device 5000 for the ranking model for commodity recommendation. For example, the training device 5000 for the ranking model for commodity recommendation can be solidified into a dedicated device (such as an ASIC). The training device 5000 for the ranking model for commodity recommendation can be divided into independent units, or they can be combined together for implementation. The training device 5000 for the ranking model for commodity recommendation can be implemented by one of the various implementations described above, or can be implemented by a combination of two or more of the various implementations described above.
[0298] In this embodiment, the training device 5000 for the ranking model for product recommendation can have multiple implementation forms. For example, the training device 5000 for the ranking model for product recommendation can be a functional module running in any software product or application that provides model training services, or it can be an external embedded component, plug-in, patch, etc. of these software products or applications, or it can also be these software products or applications themselves.
[0299] <System Embodiment>
[0300] In this embodiment, if Figure 6 As shown, a system 6000 of at least one computing device 6100 and at least one storage device 6200 is also provided. The at least one storage device 6200 is used to store executable instructions; the instructions are used to control the at least one computing device 6100 to execute the method according to any embodiment of the present specification.
[0301] In this embodiment, the system 6000 can be a mobile phone, a tablet computer, a PDA, a desktop computer, a laptop computer, a workstation, a game console, etc., or it can be a distributed system composed of multiple devices.
[0302] <Computer Readable Storage Medium>
[0303] In this embodiment, a computer-readable storage medium is further provided, on which a computer program is stored. When the computer program is executed by a processor, the method of any embodiment of this specification is implemented.
[0304] The present specification may be a device, a method and / or a computer program product. The computer program product may include a computer-readable storage medium carrying computer-readable program instructions for causing a processor to implement various aspects of the present specification.
[0305] A computer-readable storage medium may be a tangible device that can hold and store instructions used by an instruction execution device. A computer-readable storage medium may be, for example, but not limited to, an electrical storage device, a magnetic storage device, an optical storage device, an electromagnetic storage device, a semiconductor storage device, or any suitable combination of the foregoing. More specific examples of computer-readable storage media (a non-exhaustive list) include: 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 static random access memory (SRAM), a portable compact disk read-only memory (CD-ROM), a digital versatile disk (DVD), a memory stick, a floppy disk, a mechanical encoding device, such as a punch card or a raised structure in a groove on which instructions are stored, and any suitable combination of the foregoing. As used herein, a computer-readable storage medium is not to be interpreted as a transient signal per se, such as a radio wave or other freely propagating electromagnetic wave, an electromagnetic wave propagating through a waveguide or other transmission medium (e.g., a light pulse through a fiber optic cable), or an electrical signal transmitted through a wire.
[0306] The computer-readable program instructions described herein can be downloaded from a computer-readable storage medium to each computing / processing device, or downloaded to an external computer or external storage device via a network, such as the Internet, a local area network, a wide area network, and / or a wireless network. The network can include copper transmission cables, optical fiber transmissions, wireless transmissions, routers, firewalls, switches, gateway computers, and / or edge servers. The network adapter card or network interface in each computing / processing device receives the computer-readable program instructions from the network and forwards the computer-readable program instructions for storage in the computer-readable storage medium in each computing / processing device.
[0307] The computer program instructions for performing the operation of this specification can be assembly instructions, instruction set architecture (ISA) instructions, machine instructions, machine-related instructions, microcode, firmware instructions, state setting data, or source code or object code written in any combination of one or more programming languages, including object-oriented programming languages, such as Smalltalk, C++, etc., and conventional procedural programming languages, such as "C" language or similar programming languages. Computer-readable program instructions can be executed completely on the user's computer, partially on the user's computer, as an independent software package, partially on the user's computer, partially on the remote computer, or completely on the remote computer or server. In the case of a remote computer, the remote computer can be connected to the user's computer through any type of network, including a local area network (LAN) or a wide area network (WAN), or can be connected to an external computer (e.g., using an Internet service provider to connect through the Internet). In some embodiments, by using the state information of the computer-readable program instructions to personalize an electronic circuit, such as a programmable logic circuit, a field programmable gate array (FPGA) or a programmable logic array (PLA), the electronic circuit can execute the computer-readable program instructions, thereby realizing various aspects of this specification.
[0308] Various aspects of this specification are described herein with reference to flowcharts and / or block diagrams of methods, devices (systems) and computer program products according to embodiments of this specification. It should be understood that each box in the flowchart and / or block diagram and the combination of boxes in the flowchart and / or block diagram can be implemented by computer-readable program instructions.
[0309] These computer-readable program instructions can be provided to a processor of a general-purpose computer, a special-purpose computer, or other programmable data processing device, thereby producing a machine, so that when these instructions are executed by the processor of the computer or other programmable data processing device, a device that implements the functions / actions specified in one or more boxes in the flowchart and / or block diagram is generated. These computer-readable program instructions can also be stored in a computer-readable storage medium, and these instructions cause the computer, programmable data processing device, and / or other equipment to work in a specific manner, so that the computer-readable medium storing the instructions includes a manufactured product, which includes instructions for implementing various aspects of the functions / actions specified in one or more boxes in the flowchart and / or block diagram.
[0310] Computer-readable program instructions may also be loaded onto a computer, other programmable data processing apparatus, or other device so that a series of operating steps are performed on the computer, other programmable data processing apparatus, or other device to produce a computer-implemented process, thereby causing the instructions executed on the computer, other programmable data processing apparatus, or other device to implement the functions / actions specified in one or more boxes in the flowchart and / or block diagram.
[0311] The flowchart and block diagram in the accompanying drawings show the possible architecture, function and operation of the system, method and computer program product according to multiple embodiments of this specification. In this regard, each box in the flowchart or block diagram can represent a part of a module, program segment or instruction, and the part of the module, program segment or instruction contains one or more executable instructions for realizing the specified logical function. In some alternative implementations, the functions marked in the box can also occur in a different order from the order marked in the accompanying drawings. For example, two consecutive boxes 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 and / or flowchart, and the combination of the boxes in the block diagram and / or flowchart can be implemented by a dedicated hardware-based system that performs the specified function or action, or can be implemented by a combination of dedicated hardware and computer instructions. It is well known to those skilled in the art that it is equivalent to implement it by hardware, implement it by software, and implement it by combining software and hardware.
[0312] The embodiments of the present specification have been described above, and the above description is exemplary, not exhaustive, and is not limited to the disclosed embodiments. Many modifications and variations will be apparent to those of ordinary skill in the art without departing from the scope and spirit of the described embodiments. The selection of terms used herein is intended to best explain the principles of the embodiments, practical applications, or technical improvements in the marketplace, or to enable other persons of ordinary skill in the art to understand the embodiments disclosed herein. The scope of this specification is defined by the appended claims.
Claims
1. A training method for a ranking model for product recommendation, characterized in that: include: Obtain a user data table reflecting user information, a product data table reflecting product information, and a user behavior data table reflecting the target user performing a specified operation on the target product; Generate an initial sample set according to the user data table, the product data table and the user behavior data table; According to a pre-selected machine learning algorithm, a machine learning model is trained based on the initial sample set to obtain a scoring model; According to the scoring model, samples meeting preset conditions are screened from the initial sample set to generate a final sample set; Performing machine learning training based on the final sample set to obtain a ranking model for product recommendation; The generating the initial sample set according to the user data table, the commodity data table and the user behavior data table comprises: Generate a positive sample set with a label of a first set value and a negative sample set with a label of a second set value according to the user data table, the product data table and the user behavior data table; Generate a first sample set according to the user data table and the product data table; Marking the label of each first sample in the first sample set as a second set value; Merging the first sample set, the positive sample set and the negative sample set to obtain the initial sample set; Generating a first sample set according to the user data table and the commodity data table includes: Determine, according to the user behavior data table, a first user-product pair in which a target user performs a first specified operation on a target product, and a second user-product pair in which the target user performs a second specified operation on the target product but does not perform the first specified operation; Determine the Cartesian product of the user in the user data table and the commodity in the commodity data table to obtain a user-commodity pair set; Deleting the first user-product pair and the second user-product pair from the user-product pair set to obtain a third user-product pair; generating a second sample set according to the user information of the user corresponding to the third user-product pair in the user data table and the product information of the product corresponding to the third user-product pair in the product data table; A first set number of second samples are selected from the second sample set to obtain the first sample set.
2. According to the method of claim 1, generating a positive sample set with a label of a first set value and a negative sample set with a label of a second set value according to the user data table, the product data table and the user behavior data table comprises: Determine, according to the user behavior data table, a first user-product pair in which a target user performs a first specified operation on a target product, and a second user-product pair in which the target user performs a second specified operation on the target product but does not perform the first specified operation; Generate the positive sample set according to the user information of the target user corresponding to the first user-product pair in the user data table and the product information of the target product corresponding to the first user-product pair in the product data table, and mark the label of each positive sample in the positive sample set as the first set value; The negative sample set is generated based on the user information of the target user corresponding to the second user-product pair in the user data table, and the product information of the target product corresponding to the second user-product pair in the product data table, and the label of each negative sample in the negative sample set is marked as the second set value.
3. The method according to claim 1, further comprising: Obtaining a first number of positive samples in the positive sample set and a preset first multiple; The first set quantity is determined according to the first quantity and the first multiple.
4. According to the method of claim 1, the step of screening samples meeting preset conditions from the initial sample set according to the scoring model to generate a final sample set comprises: Scoring the initial samples in the initial sample set according to the scoring model; According to the scores of the initial samples, samples meeting preset conditions are screened from the initial sample set to generate a final sample set.
5. According to the method of claim 4, the step of screening samples that meet preset conditions from the initial sample set according to the scores of the initial samples to generate the final sample set comprises: Determining a first scoring threshold according to the score of each positive sample in the positive sample set; Determining a second scoring threshold according to the score of each negative sample in the negative sample set; According to the score of each first sample in the first sample set, the first score threshold, and the second score threshold, samples meeting a preset condition are screened from the first sample set to generate a third sample set, and according to the score of each third sample in the third sample set, labels of corresponding third samples are marked; The third sample set, the positive sample set and the negative sample set are combined to obtain the final sample set.
6. The method according to claim 5, wherein the first scoring threshold is determined according to the score of each positive sample in the positive sample set; Determining the second scoring threshold according to the score of each negative sample in the negative sample set includes: Determine the average value of the score of each positive sample in the positive sample set as the first score threshold; determine the average value of the score of each negative sample in the negative sample set as the second score threshold; or, The quantile of the score of each positive sample in the positive sample set is determined as the first score threshold; the quantile of the score of each negative sample in the negative sample set is determined as the second score threshold.
7. The method according to claim 5, wherein the screening of samples meeting preset conditions from the first sample set to generate a third sample set according to the score of each first sample in the first sample set, the first score threshold, and the second score threshold, and marking the label of the corresponding third sample according to the score of each third sample in the third sample set comprises: Acquire a first sample in the first sample set whose score is greater than or equal to the first score threshold as a fourth sample, and mark a label of the fourth sample as the first set value; Acquire a first sample in the first sample set whose score is less than or equal to the second score threshold as a fifth sample, and mark a label of the fifth sample as the second set value; Selecting a second set number of other first samples as sixth samples, and marking the labels of the sixth samples as the second set value; wherein the other first samples are first samples in the first sample set except the fourth sample and the fifth sample; The fourth sample, the fifth sample and the sixth sample are combined to obtain the third sample set.
8. The method according to claim 7, further comprising: Obtaining a first number of the positive samples, a second number of the negative samples, a third number of the fourth samples, a fourth number of the fifth samples, and a preset second multiple; The second set number is determined according to the first number, the second number, the third number, the fourth number, and the second multiple.
9. According to the method of claim 1, the machine learning algorithm is any one of a support vector machine algorithm, a GBDT algorithm, and a neural network.
10. According to the method of claim 1, the performing machine learning training based on the final sample set to obtain a ranking model for product recommendation comprises: According to a preset binary classification algorithm, machine learning training is performed based on the final sample set to obtain the sorting model; or, The scoring model is iteratively updated and trained based on the final sample set to obtain the ranking model.
11. The method according to claim 1, further comprising: Obtaining user information of a user to be recommended and product information of at least one preset candidate product; Based on the ranking model, according to the user information of the user to be recommended and the product information of each candidate product, obtaining the recommendation score of each candidate product corresponding to the user to be recommended; The candidate products whose recommendation scores meet the preset recommendation conditions are selected and recommended to the to-be-recommended user as recommended products.
12. According to the method of claim 11, the step of selecting the candidate products whose recommendation scores meet the preset recommendation conditions and recommending them to the to-be-recommended user as recommended products comprises: Sorting the candidate products in descending order according to the recommendation score, and obtaining the ranking order of each candidate product; The candidate commodities whose sorting order meets the preset sorting range are selected and recommended to the user to be recommended as recommended commodities.
13. The method according to claim 12, further comprising: The candidate commodities and the ranking order of each candidate commodity are displayed.
14. A training device for a ranking model for product recommendation, characterized in that: include: A data table acquisition module is used to acquire a user data table reflecting user information, a commodity data table reflecting commodity information, and a user behavior data table reflecting a target user performing a specified operation on a target commodity; An initial sample generation module, used to generate an initial sample set according to the user data table, the product data table and the user behavior data table; A first model training module is used to perform machine learning model training based on the initial sample set according to a pre-selected machine learning algorithm to obtain a scoring model; A final sample generation module, used to screen samples that meet preset conditions from the initial sample set according to the scoring model to generate a final sample set; A second model training module, used for performing machine learning training based on the final sample set to obtain a ranking model for product recommendation; The initial sample generation module is used for: Generate a positive sample set with a label of a first set value and a negative sample set with a label of a second set value according to the user data table, the product data table and the user behavior data table; Generate a first sample set according to the user data table and the product data table; Marking the label of each first sample in the first sample set as a second set value; Merging the first sample set, the positive sample set and the negative sample set to obtain the initial sample set; Generating a first sample set according to the user data table and the commodity data table includes: Determine, according to the user behavior data table, a first user-product pair in which a target user performs a first specified operation on a target product, and a second user-product pair in which the target user performs a second specified operation on the target product but does not perform the first specified operation; Determine the Cartesian product of the user in the user data table and the commodity in the commodity data table to obtain a user-commodity pair set; Deleting the first user-product pair and the second user-product pair from the user-product pair set to obtain a third user-product pair; generating a second sample set according to the user information of the user corresponding to the third user-product pair in the user data table and the product information of the product corresponding to the third user-product pair in the product data table; A first set number of second samples are selected from the second sample set to obtain the first sample set.
15. The device according to claim 14, wherein generating a positive sample set with a label of a first set value and a negative sample set with a label of a second set value according to the user data table, the product data table and the user behavior data table comprises: Determine, according to the user behavior data table, a first user-product pair in which a target user performs a first specified operation on a target product, and a second user-product pair in which the target user performs a second specified operation on the target product but does not perform the first specified operation; Generate the positive sample set according to the user information of the target user corresponding to the first user-product pair in the user data table and the product information of the target product corresponding to the first user-product pair in the product data table, and mark the label of each positive sample in the positive sample set as the first set value; The negative sample set is generated based on the user information of the target user corresponding to the second user-product pair in the user data table, and the product information of the target product corresponding to the second user-product pair in the product data table, and the label of each negative sample in the negative sample set is marked as the second set value.
16. The apparatus according to claim 14, further comprising: A module for obtaining a first number of positive samples in the positive sample set and a preset first multiple; A module for determining the first set number according to the first number and the first multiple.
17. The apparatus according to claim 14, wherein the step of screening samples meeting preset conditions from the initial sample set according to the scoring model to generate a final sample set comprises: Scoring the initial samples in the initial sample set according to the scoring model; According to the scores of the initial samples, samples meeting preset conditions are screened from the initial sample set to generate a final sample set.
18. The apparatus according to claim 17, wherein the final sample generation module is further configured to: Determine a first scoring threshold according to the score of each positive sample in the positive sample set; determine a second scoring threshold according to the score of each negative sample in the negative sample set; According to the score of each first sample in the first sample set, the first score threshold, and the second score threshold, samples meeting a preset condition are screened from the first sample set to generate a third sample set, and according to the score of each third sample in the third sample set, labels of corresponding third samples are marked; The third sample set, the positive sample set and the negative sample set are combined to obtain the final sample set.
19. The device according to claim 18, wherein the first scoring threshold is determined according to the score of each positive sample in the positive sample set; Determining the second scoring threshold according to the score of each negative sample in the negative sample set includes: Determine the average value of the score of each positive sample in the positive sample set as the first score threshold; determine the average value of the score of each negative sample in the negative sample set as the second score threshold; or, The quantile of the score of each positive sample in the positive sample set is determined as the first score threshold; the quantile of the score of each negative sample in the negative sample set is determined as the second score threshold.
20. The apparatus according to claim 18, wherein the filtering, according to the score of each first sample in the first sample set, the first score threshold and the second score threshold, samples meeting a preset condition from the first sample set to generate a third sample set, and marking the label of the corresponding third sample according to the score of each third sample in the third sample set comprises: Acquire a first sample in the first sample set whose score is greater than or equal to the first score threshold as a fourth sample, and mark a label of the fourth sample as the first set value; Acquire a first sample in the first sample set whose score is less than or equal to the second score threshold as a fifth sample, and mark a label of the fifth sample as the second set value; Selecting a second set number of other first samples as sixth samples, and marking the labels of the sixth samples as the second set value; wherein the other first samples are first samples in the first sample set except the fourth sample and the fifth sample; The fourth sample, the fifth sample and the sixth sample are combined to obtain the third sample set.
21. The apparatus according to claim 20, further comprising: A module for obtaining a first number of the positive samples, a second number of the negative samples, a third number of the fourth samples, a fourth number of the fifth samples, and a preset second multiple; A module for determining the second set number according to the first number, the second number, the third number, the fourth number and the second multiple.
22. According to the device of claim 14, the machine learning algorithm is any one of a support vector machine algorithm, a GBDT algorithm, and a neural network.
23. The apparatus according to claim 14, wherein the second model training module is further configured to: According to a preset binary classification algorithm, machine learning training is performed based on the final sample set to obtain the sorting model; or, The scoring model is iteratively updated and trained based on the final sample set to obtain the ranking model.
24. The apparatus of claim 14, further comprising: A module for obtaining user information of a user to be recommended and commodity information of at least one preset candidate commodity; A module for obtaining, based on the ranking model and according to the user information of the user to be recommended and the product information of each candidate product, a recommendation score of each candidate product corresponding to the user to be recommended; A module for selecting candidate commodities whose recommendation scores meet preset recommendation conditions and recommending them to the to-be-recommended user as recommended commodities.
25. The device according to claim 24, wherein the selecting the candidate products whose recommendation scores meet the preset recommendation conditions and recommending them to the to-be-recommended user as the recommended products comprises: Sorting the candidate products in descending order according to the recommendation score, and obtaining the ranking order of each candidate product; The candidate commodities whose sorting order meets the preset sorting range are selected and recommended to the user to be recommended as recommended commodities.
26. The apparatus according to claim 25, further comprising: A module for displaying the candidate commodities and the ranking order of each candidate commodity.
27. A system comprising at least one computing device and at least one storage device, wherein: The at least one storage device is used to store instructions, and the instructions are used to control the at least one computing device to execute the method according to any one of claims 1 to 13.
28. A computer-readable storage medium having a computer program stored thereon, wherein the computer program implements the method according to any one of claims 1 to 13 when executed by a processor.
