A training sample determination method and apparatus, a computing device, and a storage medium

CN118551227BActive Publication Date: 2026-10-30SHANGHAI 100 METERS NETWORK TECH CO LTD
View PDF 2 Cites 0 Cited by

Patent Information

Application Number
CN202410716213.8
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2024-06-04
Publication Date
2026-10-30
Estimated Expiration
2044-06-04

AI Technical Summary

Technical Problem

但对于电商而言,通常全部商品的数量都比较庞大,要在这样一个大的商品规模上每次对一个用户都要随机采样出若干商品构造负样本面临着严峻的性能和效率问题,且由于全部商品数量比较大,随机数的范围有限,很难保证每个商品被随机选择到

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN118551227B_ABST
    Figure CN118551227B_ABST
Patent Text Reader

Abstract

The application provides a kind of training sample determination method, device, computing device and storage medium, comprising: for any positive sample, according to the mapping code corresponding to the positive sample of recommendation object identification and user identification in positive sample, is determined;Wherein, positive sample represents that user has carried out preset behavior to recommendation object;For any recommendation object, according to the mapping code corresponding to the recommendation object of recommendation object identification of recommendation object, is determined;For any mapping code corresponding to the sub-set, based on the first user identification in the first positive sample in sub-set, for the second recommendation object in sub-set, the negative sample with first user identification is constructed to obtain training sample;First positive sample is any positive sample in sub-set, second recommendation object is any recommendation object in sub-set;The first recommendation object in first positive sample is different from second recommendation object.The scheme can efficiently construct the training sample meeting the requirements from a large commodity scale.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] This application relates to the field of computer technology, and in particular to a method, apparatus, computing device, and storage medium for determining training samples. Background Technology

[0002] In recommendation systems, recall models are generally used to recommend products that users are interested in. Recall models are a commonly used recommendation system in digital marketing. Their purpose is to filter out the products that are most likely to be of interest to users from a large number of candidate products based on user behavior and preferences, thereby improving user satisfaction and conversion rates.

[0003] However, the effectiveness of recall models is often limited by the quality and quantity of training samples, so the training samples for training recall models are crucial.

[0004] Current technologies generally use products that users have clicked as positive samples and products that have been exposed but not clicked as negative samples. However, if the exposed but unclicked samples are selected as negative samples, the recall model will fall into the dilemma of "being blinded by a leaf and not seeing Mount Tai". In other words, the recall model will only identify those highly exposed samples, and it will not be able to distinguish whether those samples that have not appeared or have appeared infrequently are positive or negative samples.

[0005] The current popular practice is to randomly select a subset of products from all available items to form a negative sample. However, for e-commerce platforms, the total number of products is usually quite large. Randomly sampling a number of products for each user to construct a negative sample on such a large scale presents serious performance and efficiency problems. Furthermore, due to the large number of products, the range of random numbers is limited, making it difficult to guarantee that every product will be randomly selected.

[0006] Therefore, how to efficiently construct training samples that meet the requirements from a large volume of goods remains to be solved. Summary of the Invention

[0007] This application provides a method, apparatus, computing device, and storage medium for determining training samples, which can efficiently construct training samples that meet the requirements from a large commodity scale.

[0008] In a first aspect, embodiments of this application provide a method for determining training samples. This method can be executed by a device for determining training samples, which can be a terminal device or a module for a terminal device, or a server or a module for a server. This application does not limit the executing entity of the method. The method includes: for any positive sample, determining a mapping code corresponding to the positive sample based on the recommendation object identifier and user identifier in the positive sample; wherein, the positive sample represents that the user has performed a preset behavior on the recommendation object; each positive sample is divided into different subsets according to its respective mapping code; for any recommendation object, determining a mapping code corresponding to the recommendation object based on the recommendation object identifier of the recommendation object; wherein, each recommendation object is divided into different subsets according to its respective mapping code; for any subset corresponding to a mapping code, constructing a negative sample with the first user identifier for a second recommendation object in the subset based on the first user identifier in the first positive sample in the subset, thereby obtaining a training sample; the first positive sample is any positive sample in the subset, and the second recommendation object is any recommendation object in the subset; the first recommendation object in the first positive sample is different from the second recommendation object.

[0009] The above scheme divides positive samples into different subsets based on their mapping codes, and then divides all recommended objects into different subsets based on their mapping codes. For subsets with the same mapping code, negative samples are determined based on the information of the positive samples in that subset, thus forming the training samples. On the one hand, the range of random data is limited; for example, the maximum number of random numbers a typical processor can generate is 2. 16 However, the total amount of data for all recommended objects is enormous, often exceeding this value, making it difficult to randomly sample many samples. Dividing all recommended objects into different subsets, with each subset containing a relatively small number of samples, ensures that each sample is randomly sampled. Furthermore, each subset is independent and can be stored separately, reducing storage pressure. Different subsets can be processed in parallel, improving the efficiency of constructing training samples. On the other hand, traditional methods require randomly selecting samples from all recommended objects to form negative samples for each user. In this application, the subsets formed by positive samples contain user information. When determining negative samples based on the subsets formed by positive samples, it is only necessary to add the first user identifier from the positive samples to the second recommended object to form negative samples. This eliminates the need for random sampling for each user, thus constructing negative samples for all users and improving the efficiency of constructing negative samples.

[0010] In one possible implementation, a preset number of second recommended objects are randomly determined from the subset; for any second recommended object, a negative sample is constructed having the recommender object identifier of the second recommended object and the first user identifier.

[0011] The above scheme, on the one hand, can determine different numbers of negative samples to meet different needs; on the other hand, by adding the first user identifier from the positive samples to the second recommendation object to form negative samples, it is possible to form negative samples for all users without performing random sampling for each user, thus improving the efficiency of constructing negative samples.

[0012] In one possible implementation, the recommendation object identifier and user identifier in the positive sample are concatenated into a first string; a first hash operation is performed on the first string to determine the first hash value corresponding to the positive sample; and the first hash value is moduloed according to a set modulo value to determine the mapping code corresponding to the positive sample.

[0013] The above scheme can accurately determine the mapping code corresponding to the positive sample.

[0014] In one possible implementation, multiple different second hash operations are performed on the second string corresponding to the recommendation object identifier of the recommendation object to obtain multiple second hash values; the multiple second hash values ​​are then moduloed according to a set modulo value to determine multiple mapping codes corresponding to the recommendation object.

[0015] The above scheme, on the one hand, can accurately determine the mapping code corresponding to the recommended object; on the other hand, by determining multiple mapping codes for each recommended object, it can ensure that each recommended object can be assigned to multiple subsets, thereby improving the uniformity of the data.

[0016] One possible implementation is based on the MapReduce architecture.

[0017] The above scheme uses the MapReduce architecture for parallel computation of large-scale datasets. It can not only effectively handle all recommendation objects with a huge amount of data, but also allows multiple tasks to be processed in parallel, improving the efficiency of constructing training samples. Furthermore, the Reduce task can automatically aggregate subsets with the same mapping code, greatly improving the efficiency of constructing training samples.

[0018] Secondly, embodiments of this application provide a training sample determination apparatus, comprising: a subset determination unit and a sample determination unit. The subset determination unit is configured to, for any positive sample, determine a mapping code corresponding to the positive sample based on the recommendation object identifier and user identifier in the positive sample; wherein the positive sample represents a user performing a preset behavior on a recommendation object; each positive sample is divided into different subsets according to its respective mapping code; for any recommendation object, determine a mapping code corresponding to the recommendation object based on the recommendation object identifier of the recommendation object; wherein each recommendation object is divided into different subsets according to its respective mapping code; the sample determination unit is configured to, for any subset corresponding to a mapping code, construct a negative sample with the first user identifier for a second recommendation object in the subset based on the first user identifier in a first positive sample in the subset, thereby obtaining a training sample; the first positive sample is any positive sample in the subset, and the second recommendation object is any recommendation object in the subset; the first recommendation object in the first positive sample is different from the second recommendation object.

[0019] In one possible implementation, a sample determination unit is used to randomly determine a preset number of second recommended objects from the subset; for any second recommended object, a negative sample is constructed having the recommender object identifier of the second recommended object and the first user identifier.

[0020] In one possible implementation, a subset determination unit is used to concatenate the recommendation object identifier and user identifier in the positive sample into a first string; perform a first hash operation on the first string to determine the first hash value corresponding to the positive sample; and take the modulo of the first hash value according to a set modulo value to determine the mapping code corresponding to the positive sample.

[0021] In one possible implementation, a subset determination unit is used to perform multiple different second hash operations on the second string corresponding to the recommendation object identifier of the recommendation object to obtain multiple second hash values; and to determine multiple mapping codes corresponding to the recommendation object by taking the modulus of the multiple second hash values ​​according to a set modulus value.

[0022] One possible implementation is based on the MapReduce architecture.

[0023] Thirdly, embodiments of this application also provide a computing device, including:

[0024] Memory, used to store program instructions;

[0025] The processor is configured to invoke program instructions stored in the memory and execute any method for implementing the first aspect described above, according to the obtained program instructions.

[0026] Fourthly, embodiments of this application also provide a computer-readable storage medium storing computer-readable instructions, which, when read and executed by a computer, implement any of the methods described in the first aspect.

[0027] Fifthly, embodiments of this application provide a computer program product, including a computer program executable by a computer device, which, when run on the computer device, causes the computer device to perform any of the methods described in the first aspect. Attached Figure Description

[0028] Figure 1 A flowchart illustrating a method for determining training samples provided in an embodiment of this application;

[0029] Figure 2 A flowchart illustrating a method for determining training samples provided in an embodiment of this application;

[0030] Figure 3 A schematic diagram of a training sample determination device provided in an embodiment of this application;

[0031] Figure 4 This is a schematic diagram of a training sample determination device provided in an embodiment of this application. Detailed Implementation

[0032] Figure 1 This is a flowchart illustrating a method for determining training samples according to an embodiment of this application. This method can be executed by a device for determining training samples, which can be a terminal device or a module for a terminal device, or a server or a module for a server. This application does not limit the entity executing this method.

[0033] The method includes the following steps:

[0034] Step 101: For any positive sample, determine the mapping code corresponding to the positive sample based on the recommended object identifier and user identifier in the positive sample.

[0035] The positive samples represent the preset behaviors performed by users on the recommended objects; each positive sample is divided into different subsets according to its own mapping code.

[0036] In one possible implementation, the recommended object can be a product, and the user performs a preset action on the recommended object. The preset action can be clicking or purchasing, that is, the user performs a click operation or a purchase operation on the product. Of course, the preset action can also be other actions, and this application does not limit it.

[0037] In one possible implementation, the identifier of the recommendation object can be the name of the recommendation object, the ID (Identity Document) of the recommendation object, etc., and this application does not limit this. The user identifier can be the user's name, the user's ID card number, the user's mobile phone number, etc.; this application does not limit this.

[0038] In one possible implementation, any positive sample includes a recommendation object identifier and a user identifier. The recommendation object identifier and user identifier in the positive sample are concatenated into a first string; a first hash operation is performed on the first string to determine a first hash value corresponding to the positive sample; the first hash value is moduloed by a set modulo value to determine the mapping code corresponding to the positive sample. This application does not limit the set modulo value and can set it according to actual needs, for example, the set modulo value is 10. This scheme can accurately determine the mapping code corresponding to the positive sample.

[0039] Step 102: For any recommended object, determine the mapping code corresponding to the recommended object based on the recommended object identifier.

[0040] Each recommended object is divided into different subsets based on its corresponding mapping code.

[0041] In one possible implementation, any recommended object refers to any product in the global product list, which includes exposed products and unexposed products. Exposed products include products for which the user has performed a preset action, and products for which the user has not performed a preset action. For example, exposed products include products that the user has clicked, and products that have been exposed but not clicked by the user.

[0042] In one possible implementation, multiple different second hash operations are performed on the second string corresponding to the recommender identifier of the recommended object to obtain multiple second hash values; the multiple second hash values ​​are then moduloed according to a set modulo value to determine multiple mapping codes corresponding to the recommender. This scheme, on the one hand, can accurately determine the mapping codes corresponding to the recommender; on the other hand, by determining multiple mapping codes for each recommender, it can ensure that each recommender can be assigned to multiple subsets, improving data uniformity.

[0043] Step 103: For any subset corresponding to a mapping code, based on the first user identifier in the first positive sample in the subset, construct a negative sample with the first user identifier for the second recommendation object in the subset to obtain a training sample.

[0044] Wherein, the first positive sample is any positive sample in the subset, and the second recommended object is any recommended object in the subset; the first recommended object in the first positive sample is different from the second recommended object.

[0045] In one possible implementation, a preset number of second recommendation objects are randomly determined from the subset; for any second recommendation object, a negative sample is constructed having the recommendation object identifier of the second recommendation object and the first user identifier. This application does not limit the preset number; for example, the preset number is 10, meaning the number of negative samples is 10 times the number of positive samples. This scheme, on the one hand, can determine different numbers of negative samples to meet different needs; on the other hand, by adding the first user identifier from the positive samples to the second recommendation objects to form negative samples, it is possible to construct negative samples for all users without performing random sampling for each user, thus improving the efficiency of constructing negative samples.

[0046] In one possible implementation, if a second recommended object randomly determined from the subset is the same as the first recommended object, then the second recommended object is removed.

[0047] The above scheme divides positive samples into different subsets based on mapping codes, and then divides all recommended objects into different subsets based on mapping codes; for subsets with the same mapping code, negative samples are determined based on the information of positive samples in the subset, thus forming training samples.

[0048] On the one hand, the range of random data is limited; for example, the maximum number of random numbers a typical processor can generate is 2. 16 However, the total amount of data for all recommended objects is enormous, often exceeding this value. Therefore, it is difficult to randomly sample many samples. Dividing all recommended objects into different subsets, with each subset containing a relatively small number of samples, ensures that each sample is randomly sampled. Furthermore, each subset is independent and can be stored separately, reducing storage pressure. In addition, different subsets can be processed in parallel, improving the efficiency of constructing training samples.

[0049] On the other hand, traditional methods require randomly selecting samples from all recommended objects to form negative samples for each user. In this application, the subset of positive samples contains user information. When determining negative samples based on the subset of positive samples, it is only necessary to add the first user identifier from the positive samples to the second recommended object to form negative samples. There is no need to perform random sampling for each user to form negative samples for all users, which improves the efficiency of constructing negative samples.

[0050] The following specific example will be used to illustrate in detail the method for determining the training samples in this application.

[0051] Table 1 shows positive sample examples, and Table 2 shows global product examples.

[0052] Table 1

[0053] Positive Sample 1 Product ID1 User A Positive Sample 2 Product ID2 User A Positive Sample 3 Product ID1 User B Positive Sample 4 Product ID3 User B …… …… ……

[0054] Table 2

[0055]

[0056] First, the mapping code corresponding to the positive sample is determined based on the recommended object identifier and user identifier in the positive sample.

[0057] In one possible implementation, the recommendation object identifier and user identifier in the positive sample are concatenated into a first string; a first hash operation is performed on the first string to determine the first hash value corresponding to the positive sample; the first hash value is moduloed according to a set modulo value to determine the mapping code corresponding to the positive sample. Taking Table 1 as an example, in positive sample 1, product ID1 and user A are concatenated into the first string "product ID1 user A", and then the first string "product ID1 user A" is hashed to obtain the first hash value "b2cf1ce9e6e0b8acbe19332198433648"; the first hash value is moduloed, where the preset modulo value is 10, and the corresponding mapping code is 8; similarly, the mapping codes corresponding to all positive samples are shown in Table 3.

[0058] Table 3

[0059]

[0060]

[0061] Based on the mapping codes in Table 3, the data is divided into subsets with mapping code 8: {{mapping code: 8, recommendation object identifier: product ID1, user identifier: user A}, {mapping code: 8, recommendation object identifier: product ID2, user identifier: user A}}; and subsets with mapping code 4: {{mapping code: 4, recommendation object identifier: product ID1, user identifier: user B}, {mapping code: 4, recommendation object identifier: product ID3, user identifier: user B}}.

[0062] In another possible implementation, the recommendation object identifier and user identifier in the positive sample are hashed separately to obtain two different hash values; then the two hash values ​​are concatenated or weighted to obtain a new hash value; and the new hash value is moduloed to obtain the mapping code corresponding to the positive sample.

[0063] In another possible implementation, the recommendation object identifier and user identifier in the positive sample are hashed separately to obtain two different hash values; the two hash values ​​are then moduloed to obtain two modulo results; and the modulo results are then weighted to obtain the mapping code corresponding to the positive sample. This application does not limit the method for obtaining the mapping code of the positive sample.

[0064] Secondly, for any recommended object, the mapping code corresponding to the recommended object is determined based on the recommended object identifier.

[0065] In one possible implementation, multiple different second hash operations are performed on the second string corresponding to the recommendation object identifier of the recommendation object to obtain multiple second hash values; the multiple second hash values ​​are then moduloed according to a set modulo value to determine multiple mapping codes corresponding to the recommendation object. Taking Table 2 as an example, the second string is determined based on the recommendation object identifier, namely "product ID1"; different hash operations are performed on the second string "product ID1" to obtain different second hash values. For example, "product ID1" is hashed using the MD5 encryption method to obtain the second hash value "90eb6ab7286e11417681139cbb434874"; "product ID1" is hashed using the SHA1 encryption method to obtain the second hash value "93766b21a67974e81e2cc76d3b84aed0c6ae1187"; and "..." is used to determine the mapping codes corresponding to the recommendation object. Product ID1 is hashed using the SHA512 encryption method to obtain a second hash value of "9a8eea7cb30c700217453d44d86e8bc7164302b9e95dff3e02a65de8b60330d9415bcb8feee104cca3a48359fb149c9f23cfeb8a97bcc7a981a19167205a71e1". This second hash value is then moduloed according to a preset modulo value to obtain multiple mapping codes corresponding to Product ID1, which are 8, 8, and 0 respectively. This application does not limit the use of different hash algorithms.

[0066] In one possible implementation, if multiple mapping codes obtained by modulo operations on multiple second hash values ​​are duplicated, the duplicate mapping codes are removed. For example, in the above example, the multiple mapping codes corresponding to product ID1 are 8, 8, and 0. After removing duplicate mapping codes, the multiple mapping codes corresponding to product ID1 are 8 and 0. Similarly, the mapping codes corresponding to all products are shown in Table 4.

[0067] Product ID1 8 0 Product ID2 6 0 Product ID3 6 4 Product ID4 8 0 Product ID5 2 6 Product ID6 4 8 …… …… ……

[0068] Based on the mapping codes in Table 4, the subsets are divided into: {{mapping code: 8, recommendation object ID: product ID1}, {mapping code: 8, recommendation object ID: product ID4}, {mapping code: 8, recommendation object ID: product ID6}} (mapping code 8); {{mapping code: 4, recommendation object ID: product ID6}, {mapping code: 4, recommendation object ID: product ID3}} (mapping code 4); {{mapping code: 2, recommendation object ID: product ID5}} (mapping code 2); {{mapping code: 4, recommendation object ID: product ID6}} (mapping code 6); and {{mapping code: 0, recommendation object ID: product ID1}, {mapping code: 0, recommendation object ID: product ID2}, {mapping code: 0, recommendation object ID: product ID4}} (mapping code 0). As shown in Table 4, product ID1 can appear in both the subset with mapping code 8 and the subset with mapping code 0. This distributes the recommended objects corresponding to product ID1 evenly across multiple subsets, improving data uniformity. If only one hash algorithm is used for the identifier of the recommended object, only one mapping code will be obtained, and the recommended object will only exist in one subset. Positive samples in other subsets cannot form negative samples with the recommended object, thus biasing the training samples.

[0069] Finally, for any subset corresponding to a mapping code, based on the first user identifier in the first positive sample of the subset, a negative sample with the first user identifier is constructed for the second recommendation object in the subset to obtain training samples. Specifically, for the positive samples, they are divided into subsets with mapping code 8: {{mapping code: 8, recommendation object identifier: product ID1, user identifier: user A}, {mapping code: 8, recommendation object identifier: product ID2, user identifier: user A}}; for the global products, they are divided into subsets with mapping code 8: {{mapping code: 8, recommendation object identifier: product ID1}, {mapping code: 8, recommendation object identifier: product ID4}, {mapping code: 8, recommendation object identifier: product ID6}}.

[0070] A preset number of second recommended objects are randomly selected from the global products. Since there are few global products in the example above, all of the global products divided into subsets with mapping code 8 are used as second recommended objects.

[0071] Since the positive samples include products with the first recommended object identifier as product ID1, the subset with the first recommended object identifier as product ID1 in the subset with mapping code 8 is removed. Therefore, for the global products, they are divided into subsets with mapping code 8: {{mapping code: 8, recommended object identifier: product ID4}, {mapping code: 8, recommended object identifier: product ID6}}.

[0072] Add the user identifier to the subset of global product mapping code 8 to form a negative sample. The resulting negative samples are: {{mapping code: 8, recommendation object identifier: product ID4, user identifier: user A}, {mapping code: 8, recommendation object identifier: product ID6, user identifier: user A}}.

[0073] In one possible implementation, positive and negative sample labels are added to the samples to form training samples. Then, for the subset with mapping code 8, the resulting positive samples are {{product ID1, user A, 1}, {product ID2, user A, 1}}; for the subset with mapping code 8, the resulting negative samples are {{product ID4, user A, 0}, {product ID6, user A, 0}}; where 1 represents a positive sample label and 0 represents a negative sample label.

[0074] For training samples formed from subsets corresponding to other mapping codes, the steps are similar to those described above, and will not be repeated here.

[0075] In one possible implementation, an embodiment of this application provides another method for determining training samples, which is based on the MapReduce architecture.

[0076] MapReduce is a parallel programming model for parallel computation of large datasets (greater than 1TB). It highly abstracts the complex parallel computing process running on large-scale clusters into two functions: Map and Reduce.

[0077] In MapReduce, a large dataset stored in a distributed file system is split into many independent smaller datasets. These smaller datasets can be processed in parallel by multiple Map tasks. The MapReduce framework takes a small dataset (shard) as input to each Map task, the results of the Map tasks continue to serve as input to the Reduce tasks, and finally, the Reduce tasks output the final result and write it to the distributed file system. Specifically, a large MapReduce job is first broken down into many Map tasks that are executed in parallel on multiple machines. Each Map task typically runs on a node storing data. In this way, computation and data can be run together without additional data transfer overhead. When the Map tasks are completed, a dataset is generated...<key,value> This results in many intermediate forms. These intermediate results are then distributed to multiple Reduce tasks that execute in parallel across multiple machines, each with the same key.<key,value> They will be sent to the same Reduce task, which will aggregate and calculate the intermediate results to obtain the final result and output it to the distributed file system.

[0078] Figure 2 A method for determining training samples based on a MapReduce architecture, provided for embodiments of this application, includes the following steps:

[0079] Step 201: Divide all positive samples into multiple sub-positive sample sets, and divide the global products into multiple sub-product sets.

[0080] Step 202: Input multiple sub-positive sample sets and multiple sub-product sets into the Map task respectively.

[0081] In one possible implementation, a Map task point may include at least one sub-positive sample set; and / or, at least one sub-item set. This application does not limit this.

[0082] Step 203: The Map task determines the mapping code corresponding to the positive sample in parallel based on the recommendation object identifier and user identifier in the sub-positive sample set.

[0083] In one possible implementation, the Map task concatenates the recommendation object identifier and user identifier in the positive sample into a first string in parallel; performs a first hash operation on the first string to determine the first hash value corresponding to the positive sample; and takes the modulo of the first hash value according to a set modulo value to determine the mapping code corresponding to the positive sample.

[0084] Step 204: The Map task determines the mapping code corresponding to the recommended object in parallel based on the recommended object identifier in the sub-product set.

[0085] In one possible implementation, the Map task performs multiple different second hash operations on the second string corresponding to the recommendation object identifier of the recommendation object in parallel to obtain multiple second hash values; and takes the modulus of the multiple second hash values ​​according to a set modulus value to determine multiple mapping codes corresponding to the recommendation object.

[0086] There is no restriction on the execution order of steps 203 and 204 above.

[0087] In one possible implementation, the mapping code corresponds to the key in the execution result of the Map task.

[0088] Step 205: Subsets with the same mapping code are distributed to the same Reduce task.

[0089] Step 206: For a subset of objects with the same mapping code, the Reduce task constructs a negative sample with the first user identifier for the second recommendation object in the subset based on the first user identifier in the first positive sample in the subset, thereby obtaining the training sample.

[0090] In one possible implementation, different Reduce tasks are performed in parallel. For any Reduce task, a preset number of second recommendation objects are randomly determined from the subset; for any second recommendation object, a negative sample is constructed containing the recommendation object identifier of the second recommendation object and the first user identifier.

[0091] The above scheme uses the MapReduce architecture for parallel computation of large-scale datasets. It can not only effectively handle all recommendation objects with a huge amount of data, but also allows multiple tasks to be processed in parallel, improving the efficiency of constructing training samples. Furthermore, the Reduce task can automatically aggregate subsets with the same mapping code, greatly improving the efficiency of constructing training samples.

[0092] Based on the same technological concept Figure 3 An exemplary embodiment of a training sample determination device 300 provided in this application is illustrated. Figure 3 As shown, it includes: a subset determination unit 301 and a sample determination unit 302. The subset determination unit 301 is used to determine the mapping code corresponding to any positive sample based on the recommendation object identifier and user identifier in the positive sample; wherein, the positive sample represents a user performing a preset behavior on the recommendation object; each positive sample is divided into different subsets according to its respective mapping code; for any recommendation object, it determines the mapping code corresponding to the recommendation object based on the recommendation object identifier of the recommendation object; wherein, each recommendation object is divided into different subsets according to its respective mapping code. The sample determination unit 302 is used to construct a negative sample with the first user identifier for a second recommendation object in the subset, based on the first user identifier in the first positive sample in the subset, thereby obtaining a training sample; the first positive sample is any positive sample in the subset, and the second recommendation object is any recommendation object in the subset; the first recommendation object in the first positive sample is different from the second recommendation object.

[0093] In one possible implementation, the sample determination unit 302 is used to randomly determine a preset number of second recommended objects from the subset; for any second recommended object, a negative sample is constructed having the recommended object identifier of the second recommended object and the first user identifier.

[0094] In one possible implementation, the subset determination unit 301 is used to concatenate the recommendation object identifier and user identifier in the positive sample into a first string; perform a first hash operation on the first string to determine the first hash value corresponding to the positive sample; and take the modulo of the first hash value according to a set modulo value to determine the mapping code corresponding to the positive sample.

[0095] In one possible implementation, the subset determination unit 301 is used to perform multiple different second hash operations on the second string corresponding to the recommendation object identifier of the recommendation object to obtain multiple second hash values; and to determine multiple mapping codes corresponding to the recommendation object by taking the modulus of the multiple second hash values ​​according to a set modulus value.

[0096] One possible implementation is based on the MapReduce architecture.

[0097] Based on the same technical concept, embodiments of this application provide a training sample determination device 400, which may be, for example, a computing device. Figure 4 As shown, a training sample determination device 400 includes at least one processor 401 and a memory 402 connected to the at least one processor. In this embodiment, the specific connection medium between the processor 401 and the memory 402 is not limited. Figure 4 Taking the connection between processor 401 and memory 402 via a bus as an example, the bus can be divided into address bus, data bus, control bus, etc.

[0098] In this embodiment of the application, the memory 402 stores instructions that can be executed by at least one processor 401. By executing the instructions stored in the memory 402, at least one processor 401 can execute the above-described method for determining training samples.

[0099] The processor 401 serves as the control center of the training sample determination device 400. It can connect to various parts of the computer device via various interfaces and lines, and performs resource settings by running or executing instructions stored in the memory 402 and accessing data stored in the memory 402. Optionally, the processor 401 may include one or more determination units. The processor 401 may integrate an application processor and a modem processor, wherein the application processor primarily handles the operating system, user interface, and applications, while the modem processor primarily handles wireless communication. It is understood that the modem processor may not be integrated into the processor 401. In some embodiments, the processor 401 and the memory 402 may be implemented on the same chip; in other embodiments, they may be implemented on separate chips.

[0100] Processor 401 can be a general-purpose processor, such as a central processing unit (CPU), digital signal processor, application-specific integrated circuit (ASIC), field-programmable gate array (FPGA), or other programmable logic device, discrete gate or transistor logic device, or discrete hardware component, capable of implementing or executing the methods, steps, and logic block diagrams disclosed in the embodiments of this application. The general-purpose processor can be a microprocessor or any conventional processor. The steps of the methods disclosed in the embodiments of this application can be directly manifested as being executed by a hardware processor, or executed by a combination of hardware and software modules within the processor.

[0101] Memory 402, as a non-volatile computer-readable storage medium, can be used to store non-volatile software programs, non-volatile computer-executable programs, and modules. Memory 402 may include at least one type of storage medium, such as flash memory, hard disk, multimedia card, card-type memory, random access memory (RAM), static random access memory (SRAM), programmable read-only memory (PROM), read-only memory (ROM), electrically erasable programmable read-only memory (EEPROM), magnetic storage, magnetic disk, optical disk, etc. Memory 402 can be any other medium capable of carrying or storing desired program code in the form of instructions or data structures that can be accessed by a computer, but is not limited thereto. In the embodiments of this application, memory 402 can also be a circuit or any other device capable of implementing storage functions for storing program instructions and / or data.

[0102] This application also provides a computer-readable storage medium storing a computer-executable program for causing a computer to execute a method for determining training samples as listed in any of the above embodiments.

[0103] This application provides a computer program product, including a computer program executable by a computer device. When the program is run on the computer device, it causes the computer device to perform a method for determining training samples as listed in any of the above methods.

[0104] Those skilled in the art will understand that embodiments of this application can be provided as methods, systems, or computer program products. Therefore, this application can take the form of a completely hardware embodiment, a completely software embodiment, or an embodiment combining software and hardware aspects. Furthermore, this application can take the form of a computer program product embodied on one or more computer-usable storage media (including but not limited to disk storage, CD-ROM, optical storage, etc.) containing computer-usable program code.

[0105] This application is described with reference to flowchart illustrations and / or block diagrams of methods, apparatus (systems), and computer program products according to this application. It should be understood that each block of the flowchart illustrations and / or block diagrams, and combinations of blocks in the flowchart illustrations and / or block diagrams, can be implemented by computer program instructions. These computer program instructions can be provided to a processor of a general-purpose computer, special-purpose computer, embedded processor, or other programmable data processing apparatus to produce a machine, such that the instructions, which execute via the processor of the computer or other programmable data processing apparatus, generate instructions for implementing the flowchart illustrations. Figure 1 One or more processes and / or boxes Figure 1 A device that provides the functions specified in one or more boxes.

[0106] These computer program instructions may also be stored in a computer-readable storage medium that can direct a computer or other programmable data processing device to function in a particular manner, such that the instructions stored in the computer-readable storage medium produce an article of manufacture including instruction means, which are implemented in a process Figure 1 One or more processes and / or boxes Figure 1 The function specified in one or more boxes.

[0107] These computer program instructions may also be loaded onto a computer or other programmable data processing equipment to cause a series of operational steps to be performed on the computer or other programmable equipment to produce a computer-implemented process, thereby providing instructions that execute on the computer or other programmable equipment for implementing the process. Figure 1 One or more processes and / or boxes Figure 1 The steps of the function specified in one or more boxes.

[0108] Obviously, those skilled in the art can make various modifications and variations to this application without departing from the spirit and scope of this application. Therefore, if such modifications and variations fall within the scope of the claims of this application and their equivalents, this application also intends to include such modifications and variations.

Claims

1. A method for determining training samples, characterized in that, include: For any positive sample, the mapping code corresponding to the positive sample is determined based on the recommended object identifier and the user identifier in the positive sample; wherein, the positive sample represents that the user has performed a preset behavior on the recommended object; each positive sample is divided into different subsets according to its own mapping code; For any recommended object, the mapping code corresponding to the recommended object is determined based on the recommended object identifier; wherein, each recommended object is divided into different subsets according to its corresponding mapping code; For any subset corresponding to a mapping code, a negative sample with the first user identifier is constructed for the second recommended object in the subset based on the first user identifier in the first positive sample in the subset, thereby obtaining a training sample; the first positive sample is any positive sample in the subset, and the second recommended object is any recommended object in the subset; the first recommended object in the first positive sample is different from the second recommended object.

2. The method as described in claim 1, characterized in that, The step of constructing negative samples with the first user identifier for the second recommendation object in the subset to obtain training samples includes: A predetermined number of second recommended objects are randomly selected from the subset; For any second recommended object, construct a negative sample containing the recommender object identifier of the second recommended object and the first user identifier.

3. The method as described in claim 1, characterized in that, The step of determining the mapping code corresponding to the positive sample based on the recommended object identifier and user identifier in the positive sample includes: Concatenate the recommendation object identifier and user identifier in the positive sample into a first string; Perform a first hash operation on the first string to determine the first hash value corresponding to the positive sample; The mapping code corresponding to the positive sample is determined by taking the modulus of the first hash value with the set modulus value.

4. The method as described in claim 1, characterized in that, The step of determining the mapping code corresponding to the recommendation object based on the recommendation object identifier includes: Perform multiple different second hash operations on the second string corresponding to the recommendation object identifier of the recommendation object to obtain multiple second hash values; Based on the set modulo value, the modulo values ​​of the multiple second hash values ​​are respectively taken to determine the multiple mapping codes corresponding to the recommended object.

5. The method according to any one of claims 1 to 4, characterized in that, The method described is based on the MapReduce architecture.

6. A device for determining training samples, characterized in that, Includes subset determination unit and sample determination unit: The subset determination unit is used to determine the mapping code corresponding to any positive sample based on the recommendation object identifier and user identifier in the positive sample; wherein, the positive sample represents that the user has performed a preset behavior on the recommendation object; each positive sample is divided into different subsets according to its respective mapping code; and for any recommendation object, the unit determines the mapping code corresponding to the recommendation object based on the recommendation object identifier of the recommendation object; wherein, each recommendation object is divided into different subsets according to its respective mapping code. The sample determination unit is used to construct negative samples with the first user identifier for a second recommended object in a subset corresponding to any mapping code, based on the first user identifier in the first positive sample in the subset, thereby obtaining training samples; the first positive sample is any positive sample in the subset, and the second recommended object is any recommended object in the subset; the first recommended object in the first positive sample is different from the second recommended object.

7. The apparatus as claimed in claim 6, characterized in that, The sample determination unit is used to randomly determine a preset number of second recommended objects from the subset; for any second recommended object, a negative sample is constructed having the recommender object identifier of the second recommended object and the first user identifier.

8. A computing device, characterized in that, include: Memory, used to store program instructions; A processor is configured to invoke program instructions stored in the memory and execute the method as described in any one of claims 1 to 5 according to the obtained program instructions.

9. A computer-readable storage medium, characterized in that, Includes computer-readable instructions that, when read and executed by a computer, cause the method as described in any one of claims 1 to 5 to be implemented.

10. A computer program product, characterized in that, It includes a computer program executable by a computer device, which, when run on the computer device, causes the computer device to perform the steps of the method according to any one of claims 1 to 5.

Citation Information

Patent Citations

  • Commodity recommendation method, device and system, and storage medium

    CN113761347A

  • Similar article searching method and device and computer readable storage medium

    CN114067139A