Recommendation model training methods, devices, electronic equipment, and storage media
By acquiring and encoding feature information from electronic devices, determining target feature information, and training recommendation models, the computational time-consuming problem caused by excessive historical browsing records is solved, thus improving the efficiency and accuracy of recommendation models.
Patent Information
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2022-12-15
- Publication Date
- 2026-03-06
AI Technical Summary
In existing technologies, when electronic devices recommend content using data mining models, the large number of historical browsing records leads to long computation times and low efficiency.
By obtaining the first encoding set corresponding to the second feature set and the first feature set, M target feature information is determined, and the recommendation model is trained based on these feature information, thus avoiding inputting the entire feature set into the model.
This reduces the computational complexity of electronic devices and improves the training efficiency of recommendation models and the accuracy of recommendation information.
Smart Images

Figure CN116010689B_ABST
Abstract
Description
Technical Field
[0001] This application belongs to the field of artificial intelligence technology, specifically relating to a training method, apparatus, electronic device, and storage medium for a recommendation model. Background Technology
[0002] Currently, when users browse videos or applications on electronic devices, the devices can recommend content related to the user's choices. In existing technology, electronic devices can access the user's browsing history and then perform data mining on this history using data mining models to recommend content relevant to the user's selections.
[0003] However, in the above methods, the user's browsing history is constantly increasing based on the duration of the user's use of electronic devices. When electronic devices use data mining models to mine the browsing history, if there are too many browsing history records, the data mining process will be time-consuming. As a result, the efficiency of electronic devices in recommending content through data mining models is low. Summary of the Invention
[0004] The purpose of this application is to provide a training method, apparatus, electronic device, and storage medium for a recommendation model, which can solve the problem of low efficiency in content recommendation by electronic devices using data mining models.
[0005] In a first aspect, embodiments of this application provide a method for training a recommendation model. The method includes: obtaining a first encoding set corresponding to a second feature set and a first feature set, wherein the first feature set includes feature information of at least one first piece of information, the first information being information selected historically by a user; and the second feature set includes feature information of at least one second piece of information, the second information being recommendation information; determining M target feature information from the first feature set based on the first encoding set and the second feature set, wherein the M target feature information are feature information whose matching degree between the feature information in the first feature set and the feature information in the second feature set exceeds a preset threshold; and training a recommendation model based on the M target feature information.
[0006] Secondly, embodiments of this application provide a training apparatus for a recommendation model, comprising: an acquisition module, a determination module, and a training module. The acquisition module is used to acquire a first encoding set corresponding to a second feature set and a first feature set. The first feature set includes feature information of at least one first piece of information, which is information selected historically by the user. The second feature set includes feature information of at least one second piece of information, which is recommendation information. The determination module is used to determine M target feature information from the first feature set based on the first encoding set and the second feature set. The M target feature information are feature information whose matching degree between the feature information in the first feature set and the feature information in the second feature set exceeds a preset threshold. The training module is used to train the recommendation model based on the M target feature information.
[0007] Thirdly, embodiments of this application provide an electronic device including a processor and a memory, wherein the memory stores programs or instructions executable on the processor, and the programs or instructions, when executed by the processor, implement the steps of the method described in the first aspect.
[0008] Fourthly, embodiments of this application provide a readable storage medium on which a program or instructions are stored, which, when executed by a processor, implement the steps of the method described in the first aspect.
[0009] Fifthly, embodiments of this application provide a chip, the chip including a processor and a communication interface, the communication interface being coupled to the processor, the processor being used to run programs or instructions to implement the method as described in the first aspect.
[0010] In a sixth aspect, embodiments of this application provide a computer program product stored in a storage medium, which is executed by at least one processor to implement the method described in the first aspect.
[0011] In this embodiment, the electronic device can obtain a first encoding set corresponding to a second feature set and a first feature set. Based on the first encoding set and the second feature set, it determines M target feature information from the first feature set, and then trains the recommendation model using these M target feature information. In this solution, since the electronic device can train the recommendation model using M target feature information, the computational complexity of the electronic device is reduced. Furthermore, since the electronic device does not input the entire first feature set into the recommendation model, it can continue to increase the length of the first feature set, thereby adding more information to the recommendation model training. Thus, while improving the efficiency of the electronic device in recommending information through the recommendation model, the accuracy of the information recommended by the electronic device through the recommendation model is also improved. Attached Figure Description
[0012] Figure 1 This is a flowchart of a training method for a recommendation model provided in an embodiment of this application;
[0013] Figure 2 This is a schematic diagram of the structure of a training device for a recommendation model provided in an embodiment of this application;
[0014] Figure 3 This is one of the hardware structure diagrams of an electronic device provided in the embodiments of this application;
[0015] Figure 4 This is a second schematic diagram of the hardware structure of an electronic device provided in an embodiment of this application. Detailed Implementation
[0016] The technical solutions of the embodiments of this application will be clearly and completely described below with reference to the accompanying drawings. Obviously, the described embodiments are only some embodiments of this application, not all embodiments. Based on the embodiments of this application, all other embodiments obtained by those skilled in the art without creative effort are within the scope of protection of this application.
[0017] The terms "first," "second," etc., used in the specification and claims of this application are used to distinguish similar objects and not to describe a specific order or sequence. It should be understood that such use of data can be interchanged where appropriate so that embodiments of this application can be implemented in orders other than those illustrated or described herein, and the objects distinguished by "first," "second," etc., are generally of the same class and the number of objects is not limited; for example, a first object can be one or more. Furthermore, in the specification and claims, "and / or" indicates at least one of the connected objects, and the character " / " generally indicates that the preceding and following objects are in an "or" relationship.
[0018] The training method for recommendation information provided in this application will be described in detail below with reference to the accompanying drawings, through specific embodiments and application scenarios.
[0019] Currently, when users browse videos or applications on electronic devices, the devices can save the user's current selections, generating a click sequence. The electronic device can then recommend content based on this click sequence. In related technologies, electronic devices can use recommendation systems (such as big data algorithms) to perform data mining on the click sequence to obtain recommended content related to the user's choices. However, due to the computational limitations of electronic devices, the longer the user's click sequence, the higher the computational cost of the electronic device's model, resulting in lower efficiency in content recommendation. For example, after mapping the user's click sequence into a sequence vector, the entire sequence vector can be input into the hidden layer for training. The longer the sequence vector, the greater the training pressure on the hidden layer. An excessively large hidden layer slows down model training and can easily lead to memory shortages. Thus, the efficiency of content recommendation using recommendation models on electronic devices remains low.
[0020] In this embodiment, the electronic device can obtain a first encoding set corresponding to a second feature set and a first feature set. Based on the first encoding set and the second feature set, it determines M target feature information from the first feature set, and then trains the recommendation model using these M target feature information. In this scheme, since the electronic device can train the recommendation model using M target feature information, the computational complexity of the electronic device is reduced. Furthermore, since the electronic device does not input the entire first feature set into the recommendation model, it can continue to increase the length of the first feature set, thereby adding more information to the recommendation model training. Thus, while improving the efficiency of the electronic device in recommending information through the recommendation model, the accuracy of the information recommended by the electronic device through the recommendation model is also improved.
[0021] The execution entity of the recommendation model training method provided in this application embodiment can be a recommendation model training device, which can be an electronic device or a functional module in an electronic device. The following uses an electronic device as an example to illustrate the technical solution provided in this application embodiment.
[0022] This application provides a method for training a recommendation model. Figure 1 A flowchart illustrating a training method for a recommendation model provided in an embodiment of this application is shown. Figure 1 As shown, the training method of the recommendation model provided in this application embodiment may include the following steps 201 to 203.
[0023] Step 201: The electronic device acquires the first encoding set corresponding to the second feature set and the first feature set.
[0024] In this embodiment of the application, the first feature set includes feature information of at least one first piece of information, which is information selected historically by the user; the second feature set includes feature information of at least one second piece of information, which is recommendation information.
[0025] Optionally, in this embodiment of the application, the first feature set mentioned above can be a feature set obtained by the electronic device from the user's historical selection information through a neural network.
[0026] Optionally, in this embodiment of the application, the first feature set described above can be represented by an array or a vector.
[0027] Optionally, in this embodiment of the application, the first information mentioned above includes at least one of the following: video information, application information, image information, and user information (e.g., gender, user account information).
[0028] Optionally, in this embodiment of the application, the feature information of at least one of the first pieces of information in the first feature set mentioned above includes at least one of the following: user feature information, scene feature information, content feature information, and cross features. The user feature information includes user attribute information and user historical behavior (e.g., exposure clicks, exposure without clicks, likes, favorites, comments, etc.).
[0029] For example, each of the codes in the first set of codes described above can be represented in binary.
[0030] For example, the second feature set mentioned above can be the recommendation information obtained by the electronic device through a preset recommendation model, and then the recommendation information is input into a neural network to obtain the feature set.
[0031] Optionally, in the embodiments of this application, the second feature set can be represented by an array or a vector.
[0032] Optionally, in the embodiments of this application, step 201 above can be specifically implemented by steps 201a to 201d below.
[0033] Step 201a: The electronic device performs vectorization processing on each first feature information in the first feature set to obtain a first vector.
[0034] In this embodiment of the application, the first vector is the vector corresponding to each first feature information.
[0035] In this embodiment of the application, the electronic device can input the first feature set into the embedding layer (i.e., a fully connected layer), and then the electronic device can map it into a vector through the embedding layer to obtain the first vector set.
[0036] For example, in the embedding layer, taking click sequence features as an example, each piece of information in the click sequence is represented by id[id1,id2,...,id]. m This means that the final multiplication by the weight matrix maps each id to a dense vector.
[0037] Optionally, in this embodiment of the application, after obtaining the click sequence features, the electronic device can convert each piece of first information in the click sequence features into a hash value, so that the electronic device can obtain the first vector corresponding to each piece of first information based on the hash value corresponding to each piece of first information.
[0038] Step 201b: The electronic device divides the first vector into N subspaces.
[0039] In this embodiment of the application, each of the above N subspaces includes at least one second vector, and each of the at least one second vector is a part of the first vector, where N is an integer greater than 1.
[0040] In this embodiment of the application, the electronic device divides each vector into N subspaces, and the vector dimension of each subspace is simplified to Q / N, where Q is the dimension of each vector.
[0041] For example, assuming the dimension of the first vector is Q = 64 and the number of subspaces is 2, then the vector dimension of each subspace is 64 / 2 = 32.
[0042] In this embodiment of the application, the electronic device can improve the processing speed of each first vector by reducing the dimension of each first vector.
[0043] Step 201c: The electronic device acquires K third vectors in each subspace.
[0044] In this embodiment of the application, each of the K third vectors is used to characterize the category to which at least one second vector belongs, and K is a positive integer.
[0045] In this embodiment of the application, the electronic device obtains K third vectors in each subspace, that is, the electronic device can cluster at least one second vector, so that the electronic device can process at least one second vector after clustering, thereby making the training process more thorough.
[0046] Optionally, in the embodiments of this application, step 201c can be implemented by the following steps 301 and 302.
[0047] Step 301: The electronic device calculates the average distance between the fourth vector in each subspace and the K initial vectors to obtain the K first averages.
[0048] In this embodiment of the application, the above-mentioned K initial vectors are any second vectors, and the fourth vector is at least one of the second vectors other than the K initial vectors.
[0049] For example, the aforementioned K initial vectors are second vectors randomly selected by the electronic device.
[0050] For example, an electronic device can randomly select K objects as initial cluster centers. It then calculates the distances between all vectors in the cluster and the cluster center, and uses the average of these distances as the new cluster center. This process is repeated, recalculating the distances between the cluster center and all points within the cluster, and using the average of these distances as the new cluster center. After repeating this process R times, the cluster center that best represents each vector in the cluster is obtained, and each vector is assigned to the nearest center, thus achieving grouping.
[0051] For example, the electronic device can specifically obtain the K third vectors (i.e., K cluster centers) in each subspace using the following formula:
[0052]
[0053] Where, x i (i = 1, 2, ..., n) is a vector in the subspace, u i (j = 1, 2, ..., k) are the initial cluster centers.
[0054] Step 302: The electronic device determines the target vectors corresponding to the K first means as K third vectors.
[0055] In this embodiment of the application, the target vector is the vector other than the K initial vectors among the 2K vectors corresponding to the K first means.
[0056] For example, assuming K is 256, the first vector is divided into two subspaces, meaning each subspace contains 256 groups of vectors. Each subspace is trained separately, resulting in a total of 256 × 2 clusters. Compared to not dividing the vectors into subspaces, the training process is more thorough due to the increased number of cluster center data.
[0057] Step 201d: The electronic device encodes the K third vectors and merges the K third vectors in each subspace after encoding to obtain the first encoding set corresponding to the first feature set.
[0058] For example, each cluster center is assigned a specific number as its ID, thus encoding each cluster center. If the number of groups is 256, then each cluster center ID can be represented by a decimal number (0-256), which, when converted to binary, is log2256 = log22. 8= 8 bits. Using this encoding method, each vector can be represented by a very short code. Furthermore, the original vector of the cluster center (64-dimensional, represented by x_0 to x_63), x_0 to x_31 is encoded as 32 in subspace 1, and x_32 to x_63 is encoded as 213 in subspace 2. Therefore, the encoded initial vector is represented as (32, 213). When there is a need for new vectors, the same method is used to divide the vector, and the nearest cluster center is found in each subspace. Then, the cluster center's ID is used to represent them, completing the embedding encoding.
[0059] In this embodiment, the electronic device obtains the first encoding set corresponding to the first feature set. That is, the electronic device can build an index for each feature information in the first feature set. Moreover, the index in this embodiment is determined based on the cluster center, and the index structure is more concise. When the electronic device queries the feature information in the first feature set according to the index, it is more efficient. Furthermore, the index structure can be used as a separate service, independent of model training. Different model training can share this service, which can save resources and facilitate management and development.
[0060] Step 202: The electronic device determines M target feature information from the first feature set based on the first encoding set and the second feature set.
[0061] In this embodiment, the M target feature information are feature information in which the matching degree between the feature information in the first feature set and the feature information in the second feature set exceeds a preset threshold.
[0062] In this embodiment of the application, the electronic device can determine M target features from the first feature set based on the second feature set, and then input the M feature information into the recommendation model to reduce the computational pressure on the recommendation model and improve the efficiency of the electronic device in recommending content.
[0063] Optionally, in the embodiments of this application, step 202 can be implemented by steps 202a and 202b as described below.
[0064] Step 202a: The electronic device obtains the second encoding set corresponding to the second feature set.
[0065] It should be noted that step 202a above can be referred to the above embodiments, and will not be repeated here to avoid repetition.
[0066] Step 202b: The electronic device determines M target feature information from the first feature set based on the distance between the second encoding set and the first encoding set.
[0067] In this embodiment of the application, the electronic device can determine the M target feature information with the highest similarity to the second feature set from the first feature set based on the distance between the second encoding set and the first encoding set.
[0068] Optionally, in the embodiments of this application, step 202b above can be specifically implemented by steps 401 to 404 below.
[0069] Step 401: The electronic device acquires at least one set of target values between each first code value in the second encoding set and the first encoding set.
[0070] In this embodiment of the application, each of the above-mentioned at least one set of target values is used to characterize the similarity between a first code value and a second code set.
[0071] It can be understood that if there are N second code values in the first encoding set, then there are N target groups. That is, each first code value in the second encoding set must be operated with each second code value in the first encoding set to obtain at least one target value.
[0072] In this embodiment of the application, the electronic device can calculate the distance between each first code value in the second coding set and the first coding set respectively, so as to obtain at least one set of target values between each code in the second coding set and the first coding set.
[0073] For example, when an electronic device calculates the distance from a cluster center to a query vector in a database, it can obtain the distances corresponding to each field from the 2×256 distances calculated separately and then sum them up. For instance, for a cluster center encoded as (32, 213), we obtain the distance (d_1) between the vector encoded as 32 and the query vector and the distance (d_2) between the vector encoded as 213 and the query vector. (d_1 + d_2) is then the distance from a cluster center to the query vector, where the query vector is the feature vector corresponding to any encoding in the first encoding set.
[0074] Step 402: The electronic device sorts each target value in each group of target values to obtain L target values in each group of target values.
[0075] In this embodiment of the application, L target values are target values for which the similarity between the first code value corresponding to each group of target values and the first encoding set exceeds a preset threshold, and L is a preset number.
[0076] Optionally, in this embodiment of the application, the electronic device can sort each set of target values in at least one set of target values in ascending order; or sort each set of target values in at least one set of target values in descending order.
[0077] Step 403: For each set of target values, the electronic device determines L second code values corresponding to the L target values from the first encoding set based on the L target values, and determines L target feature information from the first feature set based on the L second code values.
[0078] In this embodiment of the application, the electronic device can determine L second code values in the first encoding set corresponding to L target values, and then determine L target feature information from the first feature set based on the feature information corresponding to the L second code values.
[0079] Step 404: The electronic device merges the L target feature information corresponding to each group of target values to obtain M target feature information.
[0080] In this embodiment of the application, the electronic device can splice together L target feature information corresponding to each set of target values to obtain M target feature information.
[0081] Optionally, in this embodiment of the application, after obtaining M target feature information, the electronic device can convert the M target feature information into vector form or array form in order to reduce the storage space of the recommendation model.
[0082] In this embodiment, the distance calculation for the entire sample is transformed into a distance calculation to the subspace class center. After encoding, the time-consuming distance calculation only needs to be performed 2×256 times, which is almost negligible. Furthermore, after encoding the features, a relatively short code can be used to represent the sample, reducing memory consumption.
[0083] Step 203: The electronic device trains a recommendation model based on the M target feature information.
[0084] In this embodiment of the application, the electronic device can splice together M target feature information and input it into the hidden layer of the preset model for training.
[0085] For example, the recommendation model described above can be a neural network.
[0086] For example, the training process can be implemented according to the following formula (2), the specific formula is as follows:
[0087]
[0088] Where, x i It is a vector in the subspace, b is a constant, and w i Let be the weights of the vectors in the subspace, and e be the vector formed by concatenating the M target feature information.
[0089] Optionally, in this embodiment of the application, the final result of the neural network processing all data may include one or more nodes, and the final value is obtained through an activation function.
[0090] For example, the output of the CTR prediction model in a recommender system is a floating-point number representing the probability of a user clicking on an item. For instance, given user 582345 (the hash of the user name) and item 976534 (the hash of the item name), the model predicts an output of 0.2, indicating that user 582345 has a 20% probability of clicking on item 976534.
[0091] Optionally, in this embodiment of the application, after obtaining the final result of data processing, the electronic device can determine the loss value of the current result using the following formula (3), the specific formula being:
[0092]
[0093] Among them, y i For genuine user clicks, p i L represents the model's prediction result, and L represents the loss value.
[0094] Optionally, in this embodiment of the application, the electronic device can backpropagate the loss value to train the model.
[0095] It should be noted that the training method for the recommendation model provided in this application can be executed by a training device for the recommendation model, an electronic device, or a functional module or entity within an electronic device. This application uses an example of a training device for the recommendation model executing the training method to illustrate the training device for the recommendation model provided in this application.
[0096] Figure 2 A schematic diagram of a possible structure of a training device for the recommendation model involved in an embodiment of this application is shown. For example... Figure 2 As shown, the training device 70 of the recommendation model may include: an acquisition module 71, a determination module 72, and a training module 73.
[0097] The acquisition module 71 is used to acquire a first encoding set corresponding to a second feature set and a first feature set. The first feature set includes feature information of at least one first piece of information, which is information selected historically by the user. The second feature set includes feature information of at least one second piece of information, which is recommendation information. The determination module 72 is used to determine M target feature information from the first feature set based on the first encoding set and the second feature set. The M target feature information are feature information whose matching degree between feature information in the first feature set and feature information in the second feature set exceeds a preset threshold. The training module 73 is used to train a recommendation model based on the M target feature information.
[0098] In one possible implementation, the acquisition module 71 is specifically used to vectorize each first feature information in the first feature set to obtain a first vector, wherein the first vector is a vector corresponding to each first feature information; and to divide the first vector into N subspaces, each subspace including at least one second vector, each second vector being a part of the first vector, where N is an integer greater than 1; and to acquire K third vectors in each subspace, each third vector being used to characterize the category to which at least one second vector belongs, where K is a positive integer; and to encode the K third vectors, and to merge the encoded K third vectors in each subspace to obtain a first encoding set corresponding to the first feature set.
[0099] In one possible implementation, the acquisition module 71 is specifically used to calculate the average distance between the fourth vector in each subspace and the K initial vectors to obtain K first averages, where the K initial vectors are any second vectors, and the fourth vector is a vector other than the K initial vectors among at least one of the second vectors; and to determine the target vectors corresponding to the K first averages as K third vectors, where the target vectors are vectors other than the K initial vectors among the 2K vectors corresponding to the K first averages.
[0100] In one possible implementation, the aforementioned determining module 72 is specifically used to obtain the second encoding set corresponding to the second feature set; and to determine M target feature information from the first feature set based on the distance between the second encoding set and the first encoding set.
[0101] In one possible implementation, the determining module 72 is specifically used to obtain at least one set of target values between each first code value in the second encoding set and the first encoding set; each set of target values is used to characterize the similarity between a first code value and the second encoding set; each target value in each set of target values is sorted to obtain L target values in each set of target values, where L target values are target values whose similarity between the first code value corresponding to each set of target values and the first encoding set exceeds a preset threshold, and L is a preset number; for each set of target values, based on the L target values, L second code values corresponding to the L target values are determined from the first encoding set, and based on the L second code values, L target feature information is determined from the first feature set; the L target feature information corresponding to each set of target values is merged to obtain M target feature information.
[0102] This application provides a training device for a recommendation model. Since the training device can train the recommendation model using M target feature information, the computational complexity of the training device is reduced. Moreover, since the training device does not input the entire first feature set into the preset model, it can continue to increase the length of the first feature set, thereby adding more information to the training of the recommendation model. In this way, the efficiency and accuracy of the recommendation model's recommendation information are improved.
[0103] The training device for the recommended model in this application embodiment can be a device, or a component, integrated circuit, or chip in an electronic device. The device can be a mobile electronic device or a non-mobile electronic device. For example, a mobile electronic device can be a mobile phone, tablet computer, laptop computer, PDA, in-vehicle electronic device, mobile internet device (MID), augmented reality (AR) / virtual reality (VR) device, robot, wearable device, ultra-mobile personal computer (UMPC), netbook, or personal digital assistant (PDA), etc. It can also be a server, network attached storage (NAS), personal computer (PC), television (TV), ATM, or self-service machine, etc. This application embodiment does not specifically limit the device.
[0104] The training device for the recommendation model in this application embodiment can be a device with an operating system. This operating system can be Android, iOS, or other possible operating systems; this application embodiment does not specifically limit the specific operating system used.
[0105] The training device for recommendation information provided in this application embodiment can achieve... Figure 1 To avoid repetition, the various processes implemented in the method implementation examples will not be described again here.
[0106] Optionally, such as Figure 3 As shown, this application embodiment also provides an electronic device 90, including a processor 91 and a memory 92. The memory 92 stores a program or instructions that can run on the processor 91. When the program or instructions are executed by the processor 91, they implement the various steps of the above-mentioned training method embodiment for recommended information and achieve the same technical effect. To avoid repetition, they will not be described again here.
[0107] It should be noted that the electronic devices in the embodiments of this application include the mobile electronic devices and non-mobile electronic devices described above.
[0108] Figure 4 A schematic diagram of the hardware structure of an electronic device to implement an embodiment of this application.
[0109] The electronic device 100 includes, but is not limited to, components such as: radio frequency unit 101, network module 102, audio output unit 103, input unit 104, sensor 105, display unit 106, user input unit 107, interface unit 108, memory 109, and processor 110.
[0110] Those skilled in the art will understand that the electronic device 100 may also include a power supply (such as a battery) for supplying power to various components. The power supply may be logically connected to the processor 110 through a power management system, thereby enabling functions such as managing charging, discharging, and power consumption through the power management system. Figure 4 The electronic device structure shown does not constitute a limitation on the electronic device. The electronic device may include more or fewer components than shown, or combine certain components, or have different component arrangements, which will not be elaborated here.
[0111] The processor 110 is configured to acquire a first encoding set corresponding to a second feature set and a first feature set, wherein the first feature set includes feature information of at least one first piece of information, and the at least one first piece of information is information selected historically by the user; the second feature set includes feature information of at least one second piece of information, and the second piece of information is recommendation information; and, based on the first encoding set and the second feature set, determine M target feature information from the first feature set, wherein the second feature set includes feature information of at least one second piece of information, and the at least one second piece of information is recommendation information, and the M target feature information are feature information whose matching degree between the feature information in the first feature set and the feature information in the second feature set exceeds a preset threshold; and train a recommendation model based on the M target feature information.
[0112] This application provides an electronic device that reduces computational complexity by training a recommendation model using M target feature information. Furthermore, since the electronic device does not input the entire first feature set into the recommendation model, it can continue to increase the length of the first feature set, thereby adding more information to the recommendation model training. In this way, the efficiency and accuracy of the electronic device in recommending information through the recommendation model are improved.
[0113] Optionally, in this embodiment of the application, the processor 110 is specifically configured to perform vectorization processing on each first feature information in the first feature set to obtain a first vector, wherein the first vector is a vector corresponding to each first feature information; divide the first vector into N subspaces, each subspace including at least one second vector, each second vector being a part of the first vector, where N is an integer greater than 1; obtain K third vectors in each subspace, each third vector being used to characterize the category to which at least one second vector belongs, where K is a positive integer; encode the K third vectors, and merge the encoded K third vectors in each subspace to obtain a first encoding set corresponding to the first feature set.
[0114] Optionally, in this embodiment of the application, the processor 110 is specifically used to calculate the average distance between the fourth vector in each subspace and the K initial vectors to obtain K first averages, where the K initial vectors are any second vectors, and the fourth vector is a vector other than the K initial vectors among at least one of the second vectors; and to determine the target vectors corresponding to the K first averages as K third vectors, where the target vectors are vectors other than the K initial vectors among the 2K vectors corresponding to the K first averages.
[0115] Optionally, in this embodiment of the application, the processor 110 is specifically used to obtain the second encoding set corresponding to the second feature set; and to determine M target feature information from the first feature set based on the distance between the second encoding set and the first encoding set.
[0116] Optionally, in this embodiment of the application, the processor 110 is specifically configured to obtain at least one set of target values between each first code value in the second encoding set and the first encoding set; each set of target values is used to characterize the similarity between a first code value and the second encoding set; each target value in each set of target values is sorted to obtain L target values in each set of target values, where L target values are target values whose similarity between the first code value corresponding to each set of target values and the first encoding set exceeds a preset threshold, and L is a preset number; for each set of target values, based on the L target values, L second code values corresponding to the L target values are determined from the first encoding set, and based on the L second code values, L target feature information is determined from the first feature set; the L target feature information corresponding to each set of target values is merged to obtain M target feature information.
[0117] The electronic device provided in this application embodiment can implement the various processes implemented in the above method embodiments and achieve the same technical effect. To avoid repetition, it will not be described again here.
[0118] For details on the beneficial effects of the various implementation methods in this embodiment, please refer to the beneficial effects of the corresponding implementation methods in the above method embodiments. To avoid repetition, these will not be repeated here.
[0119] It should be understood that, in this embodiment, the input unit 104 may include a graphics processing unit (GPU) 1041 and a microphone 1042. The GPU 1041 processes image data of still images or videos obtained by an image capture device (such as a camera) in video capture mode or image capture mode. The display unit 106 may include a display panel 1061, which may be configured in the form of a liquid crystal display, an organic light-emitting diode, or the like. The user input unit 107 includes at least one of a touch panel 1071 and other input devices 1072. The touch panel 1071 is also called a touch screen. The touch panel 1071 may include a touch detection device and a touch controller. Other input devices 1072 may include, but are not limited to, a physical keyboard, function keys (such as volume control buttons, power buttons, etc.), a trackball, a mouse, and a joystick, which will not be described in detail here.
[0120] The memory 109 can be used to store software programs and various data. The memory 109 may primarily include a first storage area for storing programs or instructions and a second storage area for storing data. The first storage area may store the operating system, application programs or instructions required for at least one function (such as sound playback, image playback, etc.). Furthermore, the memory 109 may include volatile memory or non-volatile memory, or both. The non-volatile memory may be read-only memory (ROM), programmable read-only memory (PROM), erasable programmable read-only memory (EPROM), electrically erasable programmable read-only memory (EEPROM), or flash memory. Volatile memory can be random access memory (RAM), static random access memory (SRAM), dynamic random access memory (DRAM), synchronous dynamic random access memory (SDRAM), double data rate synchronous dynamic random access memory (DDRSDRAM), enhanced synchronous dynamic random access memory (ESDRAM), synchronous link dynamic random access memory (SLDRAM), and direct memory bus RAM (DRRAM). The memory 109 in the embodiments of this application includes, but is not limited to, these and any other suitable types of memory.
[0121] Processor 110 may include one or more processing units; optionally, processor 110 integrates an application processor and a modem processor, wherein the application processor mainly handles operations involving the operating system, user interface, and applications, and the modem processor mainly handles wireless communication signals, such as a baseband processor. It is understood that the aforementioned modem processor may also not be integrated into processor 110.
[0122] This application also provides a readable storage medium storing a program or instructions. When the program or instructions are executed by a processor, they implement the various processes of the above method embodiments and achieve the same technical effect. To avoid repetition, they will not be described again here.
[0123] The processor is the processor in the electronic device described in the above embodiments. The readable storage medium includes computer-readable storage media, such as computer read-only memory (ROM), random access memory (RAM), magnetic disk, or optical disk.
[0124] This application embodiment also provides a chip, which includes a processor and a communication interface. The communication interface is coupled to the processor. The processor is used to run programs or instructions to implement the various processes of the above method embodiments and achieve the same technical effect. To avoid repetition, it will not be described again here.
[0125] It should be understood that the chip mentioned in the embodiments of this application may also be referred to as a system-on-a-chip, system chip, chip system, or system-on-a-chip, etc.
[0126] This application provides a computer program product stored in a storage medium. The program product is executed by at least one processor to implement the various processes of the training method embodiment of the recommended model described above, and can achieve the same technical effect. To avoid repetition, it will not be described again here.
[0127] It should be noted that, in this document, the terms "comprising," "including," or any other variations thereof are intended to cover non-exclusive inclusion, such that a process, method, article, or apparatus that comprises a list of elements includes not only those elements but also other elements not expressly listed, or elements inherent to such a process, method, article, or apparatus. Without further limitations, an element defined by the phrase "comprising one..." does not exclude the presence of other identical elements in the process, method, article, or apparatus that includes that element. Furthermore, it should be noted that the scope of the methods and apparatuses in the embodiments of this application is not limited to performing functions in the order shown or discussed, but may also include performing functions substantially simultaneously or in the reverse order, depending on the functions involved. For example, the described methods may be performed in a different order than described, and various steps may be added, omitted, or combined. Additionally, features described with reference to certain examples may be combined in other examples.
[0128] Through the above description of the embodiments, those skilled in the art can clearly understand that the methods of the above embodiments can be implemented by means of software plus necessary general-purpose hardware platforms. Of course, they can also be implemented by hardware, but in many cases the former is a better implementation method. Based on this understanding, the technical solution of this application, in essence, or the part that contributes to the prior art, can be embodied in the form of a computer software product. This computer software product is stored in a storage medium (such as ROM / RAM, magnetic disk, optical disk) and includes several instructions to cause a terminal (which may be a mobile phone, computer, server, or network device, etc.) to execute the methods described in the various embodiments of this application.
[0129] The embodiments of this application have been described above with reference to the accompanying drawings. However, this application is not limited to the specific embodiments described above. The specific embodiments described above are merely illustrative and not restrictive. Those skilled in the art can make many other forms under the guidance of this application without departing from the spirit and scope of the claims, and all of these forms are within the protection scope of this application.
Claims
1. A method for training a recommendation model, characterized in that, The method comprises: obtaining a first encoding set corresponding to a second feature set and a first feature set, the first feature set comprising feature information of at least one first information, the first information being information selected by a user in history, the second feature set comprising feature information of at least one second information, the second information being recommended information; determining M target feature information from the first feature set according to the first encoding set and the second feature set, the M target feature information being feature information in the first feature set and feature information in the second feature set having a matching degree exceeding a preset threshold; training a recommendation model based on the M target feature information; the method comprises: vectorizing each first feature information in the first feature set to obtain a first vector, the first vector being a vector corresponding to each first feature information; dividing the first vector into N subspaces, each subspace comprising at least one second vector, each second vector being a part of the first vector, N being an integer greater than 1; obtaining K third vectors in each subspace, each third vector being used to represent a category to which the at least one second vector belongs, K being a positive integer; encoding the K third vectors in each subspace and merging the encoded K third vectors in each subspace to obtain a first encoding set corresponding to the first feature set.
2. The method of claim 1, wherein, the method comprises: calculating a distance mean value between each fourth vector in each subspace and K initial vectors to obtain K first mean values, the K initial vectors being any second vector, and the fourth vector being a vector other than the K initial vectors in the at least one second vector; determining a target vector corresponding to the K first mean values as the K third vectors, the target vector being a vector other than the K initial vectors in 2K vectors corresponding to the K first mean values.
3. The method of claim 1, wherein, the method comprises: obtaining a second encoding set corresponding to the second feature set; determining M target feature information from the first feature set according to a distance between the second encoding set and the first encoding set.
4. The method of claim 3, wherein, the method comprises: obtaining a second encoding set corresponding to the second feature set; determining M target feature information from the first feature set according to a distance between the second encoding set and the first encoding set. the method comprises: obtaining at least one group of target values between each first code value in the second encoding set and the first encoding set, each group of target values being used to represent a similarity between one first code value and the second encoding set; sorting each target value in each group of target values to obtain L target values in each group of target values, the L target values being target values whose similarity between the first code value corresponding to each group of target values and the first encoding set exceeds a preset threshold, L being a preset number; For each group of target values, L second code values corresponding to the L target values are determined from the first code set according to the L target values, and L target feature information is determined from the first feature set according to the L second code values; The L target feature information corresponding to each group of target values is merged to obtain M target feature information. 5.A device for training a recommendation model, characterized in that, The device comprises an acquisition module, a determination module and a training module; The acquisition module is configured to acquire a first code set corresponding to a second feature set and a first feature set, the first feature set comprising feature information of at least one first information, the first information being information selected by a user in the past, and the second feature set comprising feature information of at least one second information, the second information being recommended information; The determination module is configured to determine M target feature information from the first feature set according to the first code set and the second feature set, the M target feature information being feature information in the first feature set and feature information in the second feature set having a matching degree exceeding a preset threshold; The training module is configured to train a recommendation model based on the M target feature information; The acquisition module is specifically configured to perform vectorization processing on each first feature information in the first feature set to obtain a first vector, the first vector being a vector corresponding to each first feature information; divide the first vector into N subspaces, each subspace comprising at least one second vector, each second vector being a part of the first vector, N being an integer greater than 1; acquire K third vectors in each subspace, each third vector being used to represent a category to which the at least one second vector belongs, K being a positive integer; perform encoding processing on the K third vectors, and merge the K third vectors in each subspace after encoding to obtain a first code set corresponding to the first feature set.
6. The apparatus of claim 5, wherein, The acquisition module is specifically configured to calculate a distance mean value between a fourth vector in each subspace and K initial vectors to obtain K first mean values, the K initial vectors being any second vector, and the fourth vector being a vector other than the K initial vectors in the at least one second vector; and determine a target vector corresponding to the K first mean values as the K third vectors, the target vector being a vector other than the K initial vectors in 2K vectors corresponding to the K first mean values.
7. The apparatus of claim 5, wherein, The determination module is specifically configured to acquire a second code set corresponding to the second feature set; and determine M target feature information from the first feature set according to a distance between the second code set and the first code set.
8. The apparatus of claim 7, wherein, The determination module is specifically configured to acquire at least one group of target values between each first code value in the second code set and the first code set, each group of target values being used to represent a similarity between the first code value and the second code set; Sort each target value in each group of target values to obtain L target values in each group of target values, the L target values being target values whose similarity between the first code value corresponding to each group of target values and the first code set exceeds a preset threshold, L being a preset number; for each group of target values, determining L second code values corresponding to the L target values from the first code set according to the L target values, and determining L target feature information from the first feature set according to the L second code values; Merge the L target feature information corresponding to each group of target values to obtain M target feature information.
9. An electronic device, comprising: The processor, the memory, and a program or instructions stored on the memory and executable on the processor, the program or instructions being executed by the processor to implement the steps of the training method of the recommendation model according to any one of claims 1 to 4.
10. A readable storage medium, characterized by, The program or instructions are stored on the readable storage medium, and the program or instructions are executed by the processor to implement the steps of the training method of the recommendation model according to any one of claims 1 to 4.
Citation Information
Patent Citations
Personalized text recommendation method based on deep learning
CN111209386A
Information recommendation method and device, model training method and device, equipment and storage medium
CN114218486A