Video recommendation method, apparatus, device, storage medium, and program product
Patent Information
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- TENCENT TECHNOLOGY (SHENZHEN) CO LTD
- Filing Date
- 2022-06-29
- Publication Date
- 2026-08-07
AI Technical Summary
上述相关技术中,视频推荐的考量方式较为单一,直接影响了视频推荐的准确度
[0050] According to another aspect of this application, a computer program product is provided, comprising a computer program stored in a computer-readable storage medium; the computer program is read from and executed by a processor of a computer device from the computer-readable storage medium, causing the computer device to perform the video recommendation method or the training method of the video recommendation model as described above.
Smart Images

Figure CN117390220B_ABST
Abstract
Description
Technical Field
[0001] This application relates to the field of machine learning, and in particular to a video recommendation method, apparatus, device, storage medium, and program product. Background Technology
[0002] Sequential recommendation refers to using all historical sequence information and the information corresponding to the current moment to predict the recommended information for the next moment. For example, if a user watches a video of category A at the first moment and a video of category B at the second moment, the recommended video for the third moment can be predicted based on the videos watched by the user at the first and second moments.
[0003] In related technologies, in video recommendation scenarios, before pushing relevant recommendations to users, the system obtains the user's historical recommended video sequences, recommends videos similar to the historical video sequences to the user based on a recurrent neural network, and finally obtains the recommendation results.
[0004] However, in the aforementioned related technologies, sequence recommendation models only recommend videos to users based on similarity; that is, they only consider similarity to historical video sequences as the final recommendation result. For example, in the historical recommended video sequence, if a user dislikes video category A, the related technologies will still recommend videos similar to video category A. In these related technologies, the consideration method for video recommendation is relatively simplistic, directly affecting the accuracy of video recommendations. Summary of the Invention
[0005] This application provides a video recommendation method, apparatus, device, storage medium, and program product, which can improve the accuracy of video recommendations. The technical solution is as follows:
[0006] According to one aspect of this application, a video recommendation method is provided, the method comprising:
[0007] Obtain the historical recommended video sequence vector of the target account and the candidate video vector corresponding to the candidate video in the candidate video set. The historical recommended video sequence vector includes the feature vector corresponding to the video in the historical recommended video sequence.
[0008] Using the historical recommended video sequence vector as analysis parameters, the recommendation similarity value and recommendation anti-similarity value corresponding to each video in the historical recommended video vector are obtained. The recommendation similarity value refers to the sum of the similarity values between any video in the historical recommended video sequence and other videos, and the recommendation anti-similarity value refers to the sum of the difference values between any video in the historical recommended video sequence and other videos.
[0009] The recommendation similarity value and the recommendation anti-similarity value corresponding to the same video in the historical recommendation video sequence vector are fused to obtain the video recommendation vector corresponding to the historical recommendation video sequence vector;
[0010] The recommendation score is calculated based on the video recommendation vector and the candidate video vector to obtain the recommendation score between the video recommendation vector and the candidate video vector;
[0011] Based on the recommendation score, the candidate videos are recommended to the target account.
[0012] According to one aspect of this application, a method for training a video recommendation model is provided, the method comprising:
[0013] Obtain the historical recommended video sequence vector of the target account, the positive candidate video sample vector corresponding to the positive candidate video sample in the candidate video set, and the negative candidate video sample vector corresponding to the negative candidate video sample in the candidate video set. The historical recommended video sequence vector includes the feature vectors corresponding to the videos in the historical recommended video sequence.
[0014] Using the historical recommended video sequence vector as analysis parameters, the recommendation similarity value and recommendation anti-similarity value corresponding to each video in the historical recommended video vector are obtained. The recommendation similarity value refers to the sum of the similarity values between any video in the historical recommended video sequence and other videos, and the recommendation anti-similarity value refers to the sum of the difference values between any video in the historical recommended video sequence and other videos.
[0015] The recommendation similarity value and the recommendation anti-similarity value corresponding to the same video in the historical recommendation video sequence vector are fused to obtain the video recommendation vector corresponding to the historical recommendation video sequence vector;
[0016] A recommendation score is calculated based on the video recommendation vector and the positive candidate video sample vector to obtain a first recommendation score between the video recommendation vector and the positive candidate video sample vector; a second recommendation score is calculated based on the video recommendation vector and the negative candidate video sample vector to obtain a second recommendation score between the video recommendation vector and the negative candidate video sample vector.
[0017] Based on the first recommendation value and the second recommendation value, calculate the loss function value;
[0018] The model parameters of the video recommendation model are updated based on the loss function value.
[0019] According to one aspect of this application, a video recommendation device is provided, the device comprising:
[0020] The acquisition module is used to acquire the historical recommended video sequence vector of the target account and the candidate video vector corresponding to the candidate video in the candidate video set. The historical recommended video sequence vector includes the feature vector corresponding to the video in the historical recommended video sequence.
[0021] The calculation module is used to obtain the recommendation similarity value and recommendation anti-similarity value corresponding to each video in the historical recommendation video vector as the analysis parameter. The recommendation similarity value refers to the sum of the similarity values between any video in the historical recommendation video sequence and other videos, and the recommendation anti-similarity value refers to the sum of the difference values between any video in the historical recommendation video sequence and other videos.
[0022] The fusion module is used to fuse the recommendation similarity value and the recommendation anti-similarity value corresponding to the same video in the historical recommended video sequence vector to obtain the video recommendation vector corresponding to the historical recommended video sequence vector;
[0023] The calculation module is further configured to calculate the recommendation degree value based on the video recommendation vector and the candidate video vector, so as to obtain the recommendation degree value between the video recommendation vector and the candidate video vector;
[0024] The recommendation module is used to recommend the candidate videos to the target account based on the recommendation score.
[0025] In one possible implementation, the calculation module is further configured to use the historical recommended video sequence vector as an analysis parameter to calculate the similarity value between the video corresponding to time i and the videos corresponding to other times in the historical recommended video vector, and sum them up to obtain the recommendation similarity value corresponding to the video corresponding to time i, where i is a positive integer.
[0026] In one possible implementation, the calculation module is further configured to use the historical recommended video sequence vector as an analysis parameter, calculate the similarity value between the video corresponding to time i and the videos corresponding to other times in the historical recommended video vector based on the first self-attention mechanism network, and sum them up to obtain the recommendation similarity value corresponding to the video corresponding to time i.
[0027] In one possible implementation, the calculation module is further configured to use the historical recommended video sequence vector as an analysis parameter to calculate the difference between the video corresponding to time i and the videos corresponding to other times in the historical recommended video vector, and sum them up to obtain the recommended anti-similarity value corresponding to the video corresponding to time i.
[0028] In one possible implementation, the calculation module is further configured to use the historical recommended video sequence vector as an analysis parameter, calculate the difference between the video corresponding to time i and the videos corresponding to other times in the historical recommended video vector based on the second self-attention mechanism network, and sum them up to obtain the recommended anti-similarity value corresponding to the video corresponding to time i.
[0029] In one possible implementation, the calculation module is further configured to input the recommendation similarity value corresponding to the historical recommended video sequence vector into the first fully connected layer network for nonlinear fitting to obtain the first intermediate video recommendation vector.
[0030] In one possible implementation, the calculation module is further configured to input the recommendation anti-similarity value corresponding to the historical recommended video sequence vector into a second fully connected layer network for nonlinear fitting to obtain a second intermediate video recommendation vector.
[0031] In one possible implementation, the fusion module is further configured to add the first intermediate video recommendation vector and the second intermediate video recommendation vector according to the weight values corresponding to the first intermediate video recommendation vector and the second intermediate video recommendation vector, to obtain the video recommendation vector corresponding to the historical recommended video sequence vector.
[0032] In one possible implementation, the acquisition module is further configured to acquire the historical recommended video sequence of the target account; input the videos in the historical recommended video sequence into a feature extraction network for feature extraction to obtain the historical recommended video sequence vector.
[0033] According to one aspect of this application, a training apparatus for a video recommendation model is provided, the apparatus comprising:
[0034] The acquisition module is used to acquire the historical recommended video sequence vector of the target account, the positive candidate video sample vector corresponding to the positive candidate video sample in the candidate video set, and the negative candidate video sample vector corresponding to the negative candidate video sample. The historical recommended video sequence vector includes the feature vector corresponding to the video in the historical recommended video sequence.
[0035] The calculation module is used to obtain the recommendation similarity value and recommendation anti-similarity value corresponding to each video in the historical recommendation video vector as the analysis parameter. The recommendation similarity value refers to the sum of the similarity values between any video in the historical recommendation video sequence and other videos, and the recommendation anti-similarity value refers to the sum of the difference values between any video in the historical recommendation video sequence and other videos.
[0036] The fusion module is used to fuse the recommendation similarity value and the recommendation anti-similarity value corresponding to the same video in the historical recommended video sequence vector to obtain the video recommendation vector corresponding to the historical recommended video sequence vector;
[0037] The calculation module is further configured to calculate a recommendation value based on the video recommendation vector and the positive candidate video sample vector to obtain a first recommendation value between the video recommendation vector and the positive candidate video sample vector; and to calculate a recommendation value based on the video recommendation vector and the negative candidate video sample vector to obtain a second recommendation value between the video recommendation vector and the negative candidate video sample vector.
[0038] The calculation module is further configured to calculate a loss function value based on the first recommendation value and the second recommendation value;
[0039] The update module is used to update the model parameters of the video recommendation model based on the loss function value.
[0040] In one possible implementation, the calculation module is further configured to use the historical recommended video sequence vector as an analysis parameter to calculate the similarity value between the video corresponding to time i and the videos corresponding to other times in the historical recommended video vector, and sum them up to obtain the recommended similarity value corresponding to the video corresponding to time i, where i is a positive integer.
[0041] In one possible implementation, the calculation module is further configured to input the historical recommended video sequence vector into the first self-attention mechanism network, calculate the similarity value between the video corresponding to time i and the videos corresponding to other times in the historical recommended video vector, and sum them up to obtain the recommendation similarity value corresponding to the video corresponding to time i, where i is a positive integer.
[0042] In one possible implementation, the calculation module is further configured to use the historical recommended video sequence vector as an analysis parameter to calculate the difference between the video corresponding to time i and the videos corresponding to other times in the historical recommended video vector, and sum them up to obtain the recommended anti-similarity value corresponding to the video corresponding to time i, where i is a positive integer.
[0043] In one possible implementation, the calculation module is further configured to input the historical recommended video sequence vector into the second self-attention mechanism network, calculate the difference between the video corresponding to time i and the videos corresponding to other times in the historical recommended video vector, and sum them up to obtain the recommended anti-similarity value corresponding to the video corresponding to time i.
[0044] In one possible implementation, the video recommendation model further includes a first fully connected layer network, a second fully connected layer network, and a feature fusion network; the fusion module is further configured to input the recommendation similarity value corresponding to the historical recommended video sequence vector into the first fully connected layer network for nonlinear fitting to obtain a first intermediate video recommendation vector;
[0045] The fusion module is further configured to input the recommendation anti-similarity value corresponding to the historical recommended video sequence vector into the second fully connected layer network for nonlinear fitting to obtain the second intermediate video recommendation vector;
[0046] The fusion module is further configured to input the first intermediate video recommendation vector and the second intermediate video recommendation vector into the feature fusion network and add them together according to the weight values to obtain the video recommendation vector corresponding to the historical recommended video sequence vector.
[0047] In one possible implementation, the acquisition module is further configured to acquire the historical recommended video sequence of the target account; input the videos in the historical recommended video sequence into a feature extraction network for feature extraction to obtain the historical recommended video sequence vector.
[0048] According to another aspect of this application, a computer device is provided, comprising: a processor and a memory, wherein the memory stores at least one computer program, the at least one computer program being loaded and executed by the processor to implement the video recommendation method or the training method of the video recommendation model as described above.
[0049] According to another aspect of this application, a computer storage medium is provided, wherein at least one computer program is stored in the computer-readable storage medium, and the at least one computer program is loaded and executed by a processor to implement the video recommendation method or the training method of the video recommendation model as described above.
[0050] According to another aspect of this application, a computer program product is provided, comprising a computer program stored in a computer-readable storage medium; the computer program is read from and executed by a processor of a computer device from the computer-readable storage medium, causing the computer device to perform the video recommendation method or the training method of the video recommendation model as described above.
[0051] The beneficial effects of the technical solution provided in this application include at least the following:
[0052] This application improves the accuracy of video recommendations by obtaining the historical recommended video sequence vectors of the target account and the candidate video vectors corresponding to the candidate videos in the candidate video set. Using the historical recommended video sequence vectors as analysis parameters, it obtains the recommendation similarity value and recommendation anti-similarity value for each video in the historical recommended video sequence vectors. Based on weighted values, it fuses the recommendation similarity and recommendation anti-similarity values corresponding to the same video in the historical recommended video sequence vectors to obtain the video recommendation vectors corresponding to the historical recommended video sequence vectors. A recommendation degree value is calculated based on the video recommendation vectors and candidate video vectors to obtain the recommendation degree value between the video recommendation vectors and candidate video vectors. Based on the recommendation degree value, candidate videos are recommended to the target account. This application improves the accuracy of video recommendations by obtaining the recommendation similarity and recommendation anti-similarity values corresponding to the same video in the historical recommended video sequence and comprehensively judging candidate videos from the perspectives of similarity and anti-similarity. Attached Figure Description
[0053] To more clearly illustrate the technical solutions in the embodiments of this application, the accompanying drawings used in the description of the embodiments will be briefly introduced below. Obviously, the accompanying drawings described below are only some embodiments of this application. For those skilled in the art, other drawings can be obtained based on these drawings without creative effort.
[0054] Figure 1 This is a schematic diagram of a video recommendation method provided in an exemplary embodiment of this application;
[0055] Figure 2 This is a schematic diagram of the architecture of a computer system provided in an exemplary embodiment of this application;
[0056] Figure 3 This is a flowchart of a video recommendation method provided in an exemplary embodiment of this application;
[0057] Figure 4 This is a flowchart of a video recommendation method provided in an exemplary embodiment of this application;
[0058] Figure 5 This is a schematic diagram of a recommended video display interface provided in an exemplary embodiment of this application;
[0059] Figure 6 This is a framework diagram of video recommendation model generation and video recommendation provided in an exemplary embodiment of this application;
[0060] Figure 7 This is a flowchart of a training method for a video recommendation model provided in an exemplary embodiment of this application;
[0061] Figure 8This is a flowchart of a training method for a video recommendation model provided in an exemplary embodiment of this application;
[0062] Figure 9 This is a block diagram of a video recommendation apparatus provided in an exemplary embodiment of this application;
[0063] Figure 10 This is a block diagram of a training apparatus for a video recommendation model provided in an exemplary embodiment of this application;
[0064] Figure 11 This is a schematic diagram of the structure of a computer device provided in an exemplary embodiment of this application. Detailed Implementation
[0065] To make the objectives, technical solutions, and advantages of this application clearer, the embodiments of this application will be described in further detail below with reference to the accompanying drawings.
[0066] This application provides a technical solution for a video recommendation method, such as... Figure 1 The diagram illustrates a video recommendation method that can be executed by a computer device, which can be a terminal or a server.
[0067] The computer device obtains the historical recommended video sequence vector 103 of the target account and the candidate video vector corresponding to the candidate video in the candidate video set 110.
[0068] The historical recommended video sequence vector 103 includes feature vectors corresponding to at least two videos in the historical recommended video sequence 101.
[0069] For example, taking the historical recommended video sequence 101 as an example, which includes N historical recommended videos, the N historical recommended videos are: historical recommended video 1, historical recommended video 2, historical recommended video 3, ..., historical recommended video N.
[0070] For example, the computer device obtains the historical recommended video sequence of the target account; the computer device inputs the videos in the historical recommended video sequence into the feature extraction network 102 for feature extraction to obtain the historical recommended video sequence vector.
[0071] For example, taking the historical recommended video sequence 101 as containing N historical recommended videos, the historical recommended video sequence vector 103 contains N historical recommended video vectors, and the N historical recommended video vectors are: historical recommended video vector 1, historical recommended video vector 2, historical recommended video vector 3, ..., historical recommended video vector N.
[0072] The computer device uses the historical recommended video sequence vector 103 as an analysis parameter to obtain the recommendation similarity value and recommendation anti-similarity value corresponding to each video in the historical recommended video sequence vector 103; the computer device fuses the recommendation similarity value and recommendation anti-similarity value corresponding to the same video in the historical recommended video sequence vector 103 to obtain the video recommendation vector 109 corresponding to the historical recommended video sequence vector 103; the computer device calculates the recommendation degree value based on the video recommendation vector 109 and the candidate video vector to obtain the recommendation degree value between the video recommendation vector 109 and the candidate video vector; the computer device recommends candidate video 111 to the target account according to the recommendation degree value.
[0073] The recommendation similarity value refers to the sum of the similarity values between any video in the historical recommended video sequence 101 obtained based on the first self-attention mechanism network 104 and other videos.
[0074] The recommended anti-similarity value refers to the sum of the differences between any video in the historical recommended video sequence 101 obtained based on the second self-attention mechanism network 106 and other videos.
[0075] For example, the computer device uses the historical recommended video sequence vector 103 as an analysis parameter, inputs the historical recommended video sequence vector 103 into the first self-attention mechanism network 104 for calculation, calculates the similarity value between the video corresponding to time i and the videos corresponding to other times in the historical recommended video vector 103 in the first self-attention mechanism network 104, and sums them up to obtain the recommendation similarity value corresponding to the video corresponding to time i, where i is a positive integer.
[0076] The computer device uses the historical recommended video sequence vector 103 as the analysis parameter, inputs the historical recommended video sequence vector 103 into the second self-attention mechanism network 106 for calculation, calculates the difference between the video corresponding to time i and the videos corresponding to other times in the historical recommended video vector in the second self-attention mechanism network 106, and sums them up to obtain the recommended anti-similarity value of the video corresponding to time i.
[0077] For example, the computer device inputs the recommendation similarity value corresponding to the historical recommended video sequence vector 103 into the first fully connected layer network 105 for nonlinear fitting to obtain the first intermediate video recommendation vector;
[0078] The computer device inputs the recommendation anti-similarity value corresponding to the historical recommended video sequence vector 103 into the second fully connected layer network 107 for non-linear fitting to obtain the second intermediate video recommendation vector.
[0079] The computer device inputs the first intermediate video recommendation vector and the second intermediate video recommendation vector into the feature fusion network 108 for fusion to obtain the video recommendation vector 109 corresponding to the historical recommended video sequence vector 103.
[0080] For example, taking the historical recommended video sequence 101, which includes N historical recommended videos, as an example, the video recommendation vector 109 includes N video recommendation vectors, which are: video recommendation vector 1, video recommendation vector 2, video recommendation vector 3, ..., video recommendation vector N.
[0081] For example, the computer device calculates the recommendation score between the video recommendation vector 109 and the candidate video vectors in the candidate video set 110, and the computer device determines the candidate video with the highest recommendation score as the candidate video 111 recommended to the target account.
[0082] In summary, the method provided in this embodiment obtains the historical recommended video sequence vector of the target account and the candidate video vector corresponding to the candidate videos in the candidate video set; uses the historical recommended video sequence vector as an analysis parameter to obtain the recommendation similarity value and recommendation anti-similarity value corresponding to each video in the historical recommended video sequence vector; fuses the recommendation similarity value and recommendation anti-similarity value corresponding to the same video in the historical recommended video sequence vector to obtain the video recommendation vector corresponding to the historical recommended video sequence vector; calculates the recommendation degree value based on the video recommendation vector and the candidate video vector to obtain the recommendation degree value between the video recommendation vector and the candidate video vector; and recommends candidate videos to the target account according to the recommendation degree value. This application improves the accuracy of video recommendation by obtaining the recommendation similarity value and recommendation anti-similarity value corresponding to the same video in the historical recommended video sequence and making a comprehensive judgment on candidate videos from the perspectives of similarity and anti-similarity.
[0083] Figure 2 A schematic diagram of the architecture of a computer system provided in one embodiment of this application is shown. The computer system may include: a terminal 100 and a server 200.
[0084] Terminal 100 can be an electronic device such as a mobile phone, tablet computer, in-vehicle terminal (vehicle system), wearable device, personal computer (PC), intelligent voice interaction device, smart home appliance, aircraft, unmanned vending terminal, etc. A client application for the target application can be installed and run on terminal 100. This target application can be an application that supports video recommendation, or other applications that provide video recommendation functionality; this application does not limit the specific form of the target application. Furthermore, this application does not limit the form of the target application, including but not limited to applications (Apps), mini-programs, etc., installed on terminal 100, and can also be in web page form.
[0085] Server 200 can be a standalone physical server, a server cluster or distributed system composed of multiple physical servers, or a cloud server providing cloud computing services such as cloud databases, cloud computing, cloud functions, cloud storage, network services, cloud communications, middleware services, domain name services, security services, content delivery networks (CDNs), and basic cloud computing services such as big data and artificial intelligence platforms. Server 200 can be a backend server for the aforementioned target application, used to provide backend services to the clients of the target application.
[0086] Cloud technology refers to a hosting technology that unifies hardware, software, and network resources within a wide area network (WAN) or local area network (LAN) to achieve data computation, storage, processing, and sharing. Based on the cloud computing business model, cloud technology encompasses network technology, information technology, integration technology, management platform technology, and application technology. It can form resource pools, providing flexible and convenient on-demand access. Cloud computing technology will become a crucial support. Backend services of technical network systems require substantial computing and storage resources, such as video websites, image websites, and many portal websites. With the rapid development and application of the internet industry, every item may have its own identification mark in the future, requiring transmission to backend systems for logical processing. Data at different levels will be processed separately, and various industry data will require robust system support, which can only be achieved through cloud computing.
[0087] In some embodiments, the server described above can also be implemented as a node in a blockchain system. Blockchain is a novel application model of computer technologies such as distributed data storage, peer-to-peer transmission, consensus mechanisms, and cryptographic algorithms. Essentially, a blockchain is a decentralized database, a chain of data blocks linked together using cryptographic methods. Each data block contains information about a batch of network transactions, used to verify the validity of the information (anti-counterfeiting) and generate the next block. A blockchain can include a blockchain underlying platform, a platform product service layer, and an application service layer.
[0088] Terminal 100 and server 200 can communicate via a network, such as a wired or wireless network.
[0089] The video recommendation method or video recommendation model training method provided in this application embodiment can be executed by a computer device, which refers to an electronic device with data computing, processing, and storage capabilities. Figure 2Taking the implementation environment of the scheme shown as an example, the video recommendation method or the training method of the video recommendation model can be executed by the terminal 100 (such as the video recommendation method or the training method of the video recommendation model executed by the client of the target application installed and running in the terminal 100), or the video recommendation method or the training method of the video recommendation model can be executed by the server 200, or the terminal 100 and the server 200 can interact and cooperate to execute it. This application does not limit this.
[0090] Figure 3 This is a flowchart illustrating a video recommendation method provided in an exemplary embodiment of this application. The method can be executed by a computer device, which may be... Figure 2 The method includes: terminal 100 or server 200.
[0091] Step 302: Obtain the historical recommended video sequence vector of the target account and the candidate video vector corresponding to the candidate video in the candidate video set.
[0092] Historical recommended video sequence vectors refer to the feature vectors corresponding to the videos in the historical recommended video sequence.
[0093] The historical recommended video sequence refers to the sequence of recommended videos that the target account received up to the current moment.
[0094] For example, the target account receives a type A recommended video at the first moment, a type B recommended video at the second moment, and a type C recommended video at the third moment. The historical recommended video sequence is determined based on the time order of the recommended videos.
[0095] The candidate video set includes at least one video to be recommended.
[0096] Candidate video vectors refer to the feature vectors obtained by feature extraction from the videos to be recommended in the candidate video set.
[0097] Step 304: Using the historical recommended video sequence vector as analysis parameters, obtain the recommendation similarity value and recommendation anti-similarity value corresponding to each video in the historical recommended video vector.
[0098] The recommendation similarity value is the sum of the similarity values between any video in the historical recommended video sequence and other videos.
[0099] The recommendation anti-similarity value is the sum of the differences between any video in the historical recommended video sequence and other videos.
[0100] The similarity value is used to represent the degree of association between any two videos in the historical recommended video sequence. For example, the higher the similarity value, the higher the degree of association between the two videos.
[0101] The anti-similarity value is used to represent the degree of difference between any two videos in the historical recommended video sequence. For example, the larger the anti-similarity value, the greater the degree of difference between the two videos.
[0102] For example, the computer device uses the historical recommended video sequence vector as an analysis parameter to calculate the recommendation similarity value corresponding to each video in the historical recommended video vector; and calculates the recommendation anti-similarity value corresponding to each video in the historical recommended video vector.
[0103] For example, the computer device uses 10 historical recommended videos from the historical recommended video sequence vector as analysis parameters, calculates the recommendation similarity value between each video in the historical recommended video vector and other videos, and sums them to obtain 10 recommendation similarity values; it also calculates the recommendation inverse similarity value between each video in the historical recommended video vector and other videos and sums them to obtain 10 recommendation inverse similarity values.
[0104] Step 306: Fuse the recommendation similarity value and recommendation anti-similarity value corresponding to the same video in the historical recommended video sequence vector to obtain the video recommendation vector corresponding to the historical recommended video sequence vector.
[0105] For example, the computer device will fuse the recommendation similarity value and recommendation anti-similarity value corresponding to the same video in the historical recommended video sequence vector to obtain the video recommendation vector corresponding to the historical recommended video sequence vector.
[0106] For example, the computer device uses 10 historical recommended videos from the historical recommended video sequence vector as analysis parameters to calculate 10 recommendation similarity values; it also calculates 10 recommendation anti-similarity values. The computer device then merges the recommendation similarity values and recommendation anti-similarity values corresponding to the same video to obtain the video recommendation vector corresponding to the historical recommended video sequence vector.
[0107] Step 308: Calculate the recommendation score based on the video recommendation vector and the candidate video vector to obtain the recommendation score between the video recommendation vector and the candidate video vector.
[0108] The recommendation score is used to represent the degree of correlation between historical recommended video sequences and candidate videos. For example, the higher the recommendation score, the higher the degree of correlation between historical recommended video sequences and candidate videos.
[0109] For example, the computer device calculates the recommendation score based on the video recommendation vector and the candidate video vector to obtain the recommendation score between the video recommendation vector and the candidate video vector.
[0110] Step 310: Recommend candidate videos to the target account based on the recommendation score.
[0111] For example, the computer device calculates the recommendation score between the video recommendation vector corresponding to the historical recommended video sequence vector and some or all of the candidate video vectors in the candidate video set. Based on the ranking of the recommendation scores, the computer device recommends the videos with the highest recommendation scores to the target account.
[0112] For example, the computer device uses 10 historical recommended videos from the historical recommended video sequence vector as analysis parameters. The computer device merges the recommendation similarity value and recommendation anti-similarity value corresponding to the same video to obtain a video recommendation vector corresponding to the historical recommended video sequence vector. The computer device calculates the recommendation degree value of the video recommendation vector with 100 candidate video vectors in the candidate video set in turn, and obtains 100 recommendation degree values. According to the ranking of the recommendation degree values, the computer device recommends the candidate video corresponding to the top recommendation degree value to the target account.
[0113] In summary, this method improves the accuracy of video recommendations by obtaining the historical recommended video sequence vectors of the target account and the candidate video vectors corresponding to the candidate videos in the candidate video set; using the historical recommended video sequence vectors as analysis parameters, it obtains the recommendation similarity value and recommendation anti-similarity value for each video in the historical recommended video sequence vectors; it then fuses the recommendation similarity value and recommendation anti-similarity value corresponding to the same video in the historical recommended video sequence vectors according to weight values; based on the video recommendation vectors and candidate video vectors, it calculates the recommendation degree value between the video recommendation vectors and candidate video vectors; and finally, it recommends candidate videos to the target account based on the recommendation degree value. This application improves the accuracy of video recommendations by obtaining the recommendation similarity value and recommendation anti-similarity value corresponding to the same video in the historical recommended video sequence and comprehensively judging candidate videos from the perspectives of similarity and anti-similarity.
[0114] This application provides a video recommendation model, which includes: a feature extraction network, a first self-attention mechanism network, a second self-attention mechanism network, a first fully connected layer network, a second fully connected layer network, and a feature fusion network.
[0115] The computer device obtains the historical recommended video sequence of the target account, and inputs the videos in the historical recommended video sequence into the feature extraction network for feature extraction to obtain the historical recommended video sequence vector; at the same time, the computer device obtains the candidate video vector corresponding to the candidate video in the candidate video set.
[0116] The computer device uses the historical recommended video sequence vector as an analysis parameter, inputs the historical recommended video sequence vector into the first self-attention mechanism network for calculation, and obtains the recommendation similarity value corresponding to each video in the historical recommended video vector; the computer device also uses the historical recommended video sequence vector as an analysis parameter, inputs the historical recommended video sequence vector into the second self-attention mechanism network for calculation, and obtains the recommendation anti-similarity value corresponding to each video in the historical recommended video vector.
[0117] The computer device inputs the recommendation similarity value corresponding to the historical recommended video sequence vector into the first fully connected layer network for nonlinear fitting to obtain the first intermediate video recommendation vector; the computer device inputs the recommendation inverse similarity value corresponding to the historical recommended video sequence vector into the second fully connected layer network for nonlinear fitting to obtain the second intermediate video recommendation vector; the computer device inputs the first intermediate video recommendation vector and the second intermediate video recommendation vector into the feature fusion network for fusion to obtain the video recommendation vector corresponding to the historical recommended video sequence vector.
[0118] The computer device calculates the recommendation score based on the video recommendation vector and the candidate video vector, thus obtaining the recommendation score between the video recommendation vector and the candidate video vector.
[0119] The computer device recommends videos with the highest similarity scores to the target account based on the ranking of recommendation scores.
[0120] Based on this video recommendation model, the following video recommendation methods are provided.
[0121] Figure 4 This is a flowchart illustrating a video recommendation method provided in an exemplary embodiment of this application. The method can be executed by a computer device, which may be... Figure 2 The method includes: terminal 100 or server 200.
[0122] Step 402: Obtain the historical recommended video sequence vector of the target account and the candidate video vector corresponding to the candidate video in the candidate video set.
[0123] For example, the computer device obtains the historical recommended video sequence of the target account, and inputs the videos in the historical recommended video sequence into the feature extraction network to extract features, thereby obtaining the historical recommended video sequence vector.
[0124] The historical recommended video sequence refers to the sequence of recommended videos that the target account received up to the current moment.
[0125] Historical recommended video sequence vectors refer to the feature vectors corresponding to the videos in the historical recommended video sequence.
[0126] For example, the historical recommended video sequence corresponding to the target account u is S. u Historical recommended video sequence S u It can be represented as:
[0127] Optionally, the computer device will store historical recommended video sequences S u The length is controlled to be n, if the historical recommended video sequence S u If the length is greater than n, then choose the distance. The most recent n videos; if the historical recommended video sequence S u If the length of the sequence is equal to n, then no selection is needed; if the historical recommended video sequence S... u If the length of the historical recommended video sequence S is less than n, then zero-padding is used to shorten the sequence. u The length is determined by n, for example, n is 10, and the historical recommended video sequence S u If there are only 6 videos in the sequence, then the remaining 4 videos in the sequence will be set to 0.
[0128] Optionally, the historical recommended video sequence vector E∈R |j|*d , where |j| represents the number of videos in the historical recommended video sequence, d represents the embedding vector of the video, and R is a real number.
[0129] The candidate video set includes at least one video to be recommended.
[0130] Candidate video vectors refer to the feature vectors obtained by feature extraction from the videos to be recommended in the candidate video set.
[0131] Step 404: Using the historical recommended video sequence vector as the analysis parameter, obtain the recommendation similarity value corresponding to each video in the historical recommended video vector.
[0132] The recommendation similarity value refers to the sum of the similarity values between any video and other videos in the historical recommended video sequence obtained based on the first self-attention mechanism network.
[0133] Self-attention network is used to calculate the similarity between videos in a historical recommended video sequence.
[0134] The similarity value is used to represent the degree of association between any two videos in the historical recommended video sequence. For example, the higher the similarity value, the higher the degree of association between the two videos.
[0135] For example, for a self-attention network, the historical recommended video vector E is first linearly transformed into a sequence of query, key, and value vectors: Q, K, V, by three different learnable parameter matrices. The learnable parameter matrix refers to the matrix whose parameters are continuously updated during model training, and its calculation formula is as follows:
[0136]
[0137] Among them, W Q1 W K1 W V1 These are all trainable parameter matrices; these three parameters are the learnable parameter matrices of this network. The self-attention mechanism network uses dot product modeling to calculate the logical similarity *e* between the request and each key-value pair. Dot product modeling involves multiplying the two matrices by their dot product to calculate the similarity between elements within the matrices. The formula is as follows:
[0138]
[0139] Among them, K T Let represent the transpose of the key matrix, where d is the dimension of the vector. Then, the self-attention mechanism network applies SoftMax for a non-linear transformation, converting the logical similarity into a weighted relationship α between the request and each key-value pair:
[0140] α = softmax (e)
[0141] Based on the obtained weights, the output vector of the current element is obtained by weighted summation of each value. In actual calculation, the weights and values are multiplied by a dot product.
[0142] Attention(EW Q EW K EW V )=α*EW V
[0143] Here, Attention represents the self-attention mechanism network, which can be viewed as a function.
[0144] For example, the computer device uses the historical recommended video sequence vector as analysis parameters and obtains the recommendation similarity value corresponding to each video in the historical recommended video vector based on the first self-attention mechanism network.
[0145] In one possible implementation, the computer device uses the historical recommended video sequence vector as an analysis parameter to calculate the similarity value between the video at time i and the videos at other times in the historical recommended video vector, and sums them up to obtain the recommendation similarity value for the video at time i, where i is a positive integer.
[0146] Optionally, the computer device uses the historical recommended video sequence vector as the analysis parameter, calculates the similarity value between the video corresponding to time i and the videos corresponding to other times in the historical recommended video vector based on the first self-attention mechanism network, and sums them to obtain the recommendation similarity value corresponding to the video corresponding to time i.
[0147] For example, the computer device uses 10 historical recommended videos from the historical recommended video sequence vector as analysis parameters, and obtains the recommendation similarity value between each video in the historical recommended video vector and other videos based on the first self-attention mechanism network, and sums them to obtain 10 recommendation similarity values.
[0148] The formula for calculating the similarity value between any video in the historical recommended video sequence and other videos can be expressed as:
[0149]
[0150] Among them, W Q1 W K1 W V1 All three parameters are trainable parameter matrices. These three parameters are the learnable parameter matrices of this network. E is the vector of historical recommended video sequences, and d is the vector length.
[0151] It is understandable that the recommendation similarity value obtained based on the first self-attention mechanism network can be used to obtain the target account's preferred or liked videos in the historical recommended video sequence.
[0152] Step 406: Using the historical recommended video sequence vector as the analysis parameter, obtain the recommendation anti-similarity value corresponding to each video in the historical recommended video vector.
[0153] The recommendation anti-similarity value refers to the sum of the differences between any video in the historical recommended video sequence obtained based on the second self-attention mechanism network and other videos.
[0154] For example, the computer device uses the historical recommended video sequence vector as analysis parameters and obtains the recommendation anti-similarity value corresponding to each video in the historical recommended video vector based on the second self-attention mechanism network.
[0155] In one possible implementation, the computer device uses the historical recommended video sequence vector as an analysis parameter, calculates the difference between the video at time i and the videos at other times in the historical recommended video vector, and sums them to obtain the recommended anti-similarity value of the video at time i.
[0156] Optionally, the computer device uses the historical recommended video sequence vector as the analysis parameter, calculates the difference between the video at time i and the videos at other times in the historical recommended video vector based on the second self-attention mechanism network, and sums them up to obtain the recommended anti-similarity value of the video at time i.
[0157] For example, the computer device uses 10 historical recommended videos from the historical recommended video sequence vector as analysis parameters, and obtains the recommendation anti-similarity value between each video in the historical recommended video vector and other videos based on the second self-attention mechanism network, and sums them to obtain 10 recommendation anti-similarity values.
[0158] The formula for calculating the difference between any video in the historical recommended video sequence and other videos can be expressed as:
[0159]
[0160] Among them, W Q2 W K2 W V2 All three parameters are trainable parameter matrices. These three parameters are the learnable parameter matrices of this network. E is the vector of historical recommended video sequences, and d is the vector length.
[0161] It is understandable that the recommendation anti-similarity value obtained based on the second self-attention mechanism network can be used to identify videos that the target account has deviated from or disliked in the historical recommended video sequence.
[0162] Step 408: Fuse the recommendation similarity value and recommendation anti-similarity value corresponding to the same video in the historical recommended video sequence vector to obtain the video recommendation vector corresponding to the historical recommended video sequence vector.
[0163] For example, the computer device will fuse the recommendation similarity value and recommendation anti-similarity value corresponding to the same video in the historical recommended video sequence vector to obtain the video recommendation vector corresponding to the historical recommended video sequence vector.
[0164] For example, the computer device uses 10 historical recommended videos from the historical recommended video sequence vector as analysis parameters, obtains 10 recommendation similarity values based on the first self-attention mechanism network, and obtains 10 recommendation anti-similarity values based on the second self-attention mechanism network. The computer device then fuses the recommendation similarity values and recommendation anti-similarity values corresponding to the same video to obtain the video recommendation vector corresponding to the historical recommended video sequence vector.
[0165] In one possible implementation, the computer device inputs the recommendation similarity value corresponding to the historical recommended video sequence vector into the first fully connected layer network for nonlinear fitting to obtain the first intermediate video recommendation vector.
[0166] The formula for the non-linear fitting of the recommendation similarity value by the first fully connected layer network can be expressed as:
[0167]
[0168] in, Let S be the trainable parameter matrix in the first fully connected layer of the network. These three parameters are the learnable parameter matrix of this network. sim To recommend similarity values, F sim This is the recommendation vector for the first intermediate video.
[0169] The computer device inputs the recommendation anti-similarity value corresponding to the historical recommended video sequence vector into the second fully connected layer network for nonlinear fitting to obtain the second intermediate video recommendation vector.
[0170] The formula for the nonlinear fitting of the recommendation anti-similarity value by the second fully connected layer network can be expressed as:
[0171]
[0172] in, Let S be the trainable parameter matrix in the second fully connected layer network. These three parameters are the learnable parameter matrix of this network. anti_sim To recommend the anti-similarity value, F anti_sim This is the recommendation vector for the second intermediate video.
[0173] The computer device adds the first intermediate video recommendation vector and the second intermediate video recommendation vector together based on the weight values corresponding to the first intermediate video recommendation vector and the second intermediate video recommendation vector, to obtain the video recommendation vector corresponding to the historical recommended video sequence vector.
[0174] The formula for calculating video recommendation vectors can be expressed as:
[0175] F = βF sim +(1-)F anti_sim
[0176] Where F is the video recommendation vector, F sim F is the recommendation vector for the first intermediate video. anti_sim Let β be the recommendation vector for the second intermediate video, 1-β be the weight value corresponding to the recommendation vector for the first intermediate video, and 1-β be the weight value corresponding to the recommendation vector for the second intermediate video.
[0177] Step 410: Calculate the recommendation score based on the video recommendation vector and the candidate video vector to obtain the recommendation score between the video recommendation vector and the candidate video vector.
[0178] The recommendation score is used to represent the degree of correlation between historical recommended video sequences and candidate videos. For example, the higher the recommendation score, the higher the degree of correlation between historical recommended video sequences and candidate videos.
[0179] For example, the computer device calculates the recommendation score based on the video recommendation vector and the candidate video vector to obtain the recommendation score between the video recommendation vector and the candidate video vector.
[0180] The formula for calculating the recommendation score can be expressed as:
[0181]
[0182] Among them, F t This is the video recommendation vector corresponding to the historical recommended video sequence at time t. Let r be the transpose of the candidate video vector corresponding to the i-th candidate video in the candidate video set. t This represents the recommendation score.
[0183] Step 412: Recommend candidate videos to the target account based on the recommendation score.
[0184] For example, the computer device calculates the recommendation score between the video recommendation vector corresponding to the historical recommended video sequence vector and some or all of the candidate video vectors in the candidate video set. Based on the ranking of the recommendation scores, the computer device recommends the videos with the highest recommendation scores to the target account.
[0185] For example, the computer device uses five historical recommended videos corresponding to five time points in the historical recommended video sequence vector as analysis parameters. The computer device fuses the recommendation similarity value and recommendation anti-similarity value corresponding to the same video to obtain a video recommendation vector corresponding to the historical recommended video sequence vector. The computer device calculates the recommendation degree value of the video recommendation vector with 100 candidate video vectors in the candidate video set in turn, and obtains 100 recommendation degree values. According to the ranking of the recommendation degree values, the computer device recommends the candidate video corresponding to the first ranked recommendation degree value as the video corresponding to the sixth time point to the target account.
[0186] Based on this, using the six historical recommended videos corresponding to six time points in the historical recommended video sequence vector as analysis parameters, the computer device fuses the recommendation similarity value and recommendation anti-similarity value corresponding to the same video to obtain a video recommendation vector corresponding to the historical recommended video sequence vector. The computer device then calculates the recommendation degree value with the video recommendation vector and 100 candidate video vectors in the candidate video set in turn, obtaining 100 recommendation degree values. According to the ranking of the recommendation degree values, the computer device recommends the candidate video corresponding to the first-ranked recommendation degree value as the video corresponding to the seventh time point to the target account.
[0187] For example, in response to the computer device ranking the videos according to their recommendation scores, the video with the highest recommendation score is recommended to the target account as the next video. The currently playing video is played on the user interface, and a recommended video display interface is simultaneously displayed. The recommended video display interface shows recommended videos, which the user can click to switch between playing on the user interface, or the recommended video will automatically play after the currently playing video has finished.
[0188] Optionally, the recommended video display interface may include at least one user interface (UI) card, each user interface card being used to display a recommended video; or, the video display interface may also include at least one window, each window being used to display a recommended video; or, the video display interface may display a list of recommended videos; or, the video display interface may display video information of recommended videos. This application embodiment does not specifically limit the form in which recommended videos are displayed in the video display interface.
[0189] Optionally, the video information displayed on the video display interface may be at least one of the following: a thumbnail of the recommended video, a web link, and a title. For example, for a specific recommended video, the video information may include the thumbnail of the recommended video, a web link, a title, an author, and a summary. This application embodiment does not specifically limit the content of the video information.
[0190] For example, Figure 5 This is a schematic diagram of the recommended video display interface provided in this embodiment. See also... Figure 5 In response to the computer device's ranking based on recommendation scores, the video corresponding to the highest-ranked recommendation score is recommended to the target account as the next video. The currently playing video (502) is played on user interface (501), and simultaneously, a recommended video display interface (503) is displayed. The computer device, based on the recommendation scores between the video recommendation vectors of historical recommended video sequences and some or all of the candidate video vectors in the candidate video set, recommends the video corresponding to the highest-ranked recommendation score to the target account as the next video.
[0191] Optionally, the user can click on a recommended video to switch between playing the recommended video on the user interface, or the recommended video can be played automatically after the video corresponding to the current moment has finished playing.
[0192] In summary, this method obtains the historical recommended video sequence vectors of the target account and the candidate video vectors corresponding to the candidate videos in the candidate video set. Using the historical recommended video sequence vectors as analysis parameters, a first self-attention mechanism network is used to obtain the recommendation similarity value for each video in the historical recommended video vectors, and a second self-attention mechanism network is used to obtain the recommendation anti-similarity value for each video in the historical recommended video vectors. The recommendation similarity and anti-similarity values corresponding to the same video in the historical recommended video sequence vectors are then fused according to weight values to obtain the video recommendation vector corresponding to the historical recommended video sequence vectors. A recommendation degree value is calculated based on the video recommendation vector and the candidate video vectors to obtain the recommendation degree value between the video recommendation vector and the candidate video vectors. Based on the recommendation degree value, candidate videos are recommended to the target account. This application obtains the recommendation similarity and anti-similarity values corresponding to the same video through different self-attention mechanism networks and makes a comprehensive judgment on candidate videos from the perspectives of similarity and anti-similarity, thereby improving the accuracy of video recommendation.
[0193] The video recommendation method involved in this application can be implemented based on a video recommendation model. The scheme includes a video recommendation model generation stage and a video recommendation stage. Figure 6 This is a framework diagram illustrating a video recommendation model generation and video recommendation method, as shown in an exemplary embodiment of this application. Figure 6 As shown, in the video recommendation model generation stage, the video recommendation model generation device 610 obtains a video recommendation model using a pre-set training sample video set, and then generates video recommendation results based on this model. In the video recommendation stage, the video recommendation device 620 processes the received historical recommended video sequences and candidate video sets of the target account based on the video recommendation model to obtain video recommendation results for the historical recommended video sequences, such as determining the recommended video for the next moment corresponding to the historical recommended video sequence.
[0194] The video recommendation model generation device 610 and the video recommendation device 620 mentioned above can be computer devices. For example, the computer device can be a fixed computer device such as a personal computer or a server, or it can be a mobile computer device such as a tablet computer or an e-book reader.
[0195] Optionally, the video recommendation model generation device 610 and the video recommendation device 620 described above can be the same device, or they can be different devices. Furthermore, when the video recommendation model generation device 610 and the video recommendation device 620 are different devices, they can be of the same type, such as both being servers; or they can be of different types, such as the video recommendation device 620 being a personal computer or terminal, while the video recommendation model generation device 610 can be a server, etc. This application embodiment does not limit the specific types of the video recommendation model generation device 610 and the video recommendation device 620.
[0196] The above embodiments illustrate video recommendation methods. The training method for video recommendation models will be described in further detail below.
[0197] Figure 7 This is a flowchart illustrating a training method for a video recommendation model provided in an exemplary embodiment of this application. The method can be executed by a computer device, which may be... Figure 2 The method includes: terminal 100 or server 200.
[0198] Step 702: Obtain the historical recommended video sequence vector of the target account, the positive candidate video sample vector corresponding to the positive candidate video sample in the candidate video set, and the negative candidate video sample vector corresponding to the negative candidate video sample.
[0199] Historical recommended video sequence vectors refer to the feature vectors corresponding to the videos in the historical recommended video sequence.
[0200] The historical recommended video sequence refers to the sequence of recommended videos that the target account received up to the current moment.
[0201] For example, the target account receives a type A recommended video at the first moment, a type B recommended video at the second moment, and a type C recommended video at the third moment. The historical recommended video sequence is determined based on the time order of the recommended videos.
[0202] The candidate video set includes at least one video to be recommended.
[0203] Positive candidate video samples refer to videos that are associated with or similar to videos in the historical recommended video sequence.
[0204] Negative candidate video samples refer to videos that are not associated with the historical recommended video sequence, or videos that are not similar to the videos in the historical recommended video sequence.
[0205] Step 704: Using the historical recommended video sequence vector as analysis parameters, obtain the recommendation similarity value and recommendation anti-similarity value corresponding to each video in the historical recommended video vector.
[0206] The recommendation similarity value is the sum of the similarity values between any video in the historical recommended video sequence and other videos.
[0207] The recommendation anti-similarity value is the sum of the differences between any video in the historical recommended video sequence and other videos.
[0208] The similarity value is used to represent the degree of association between any two videos in the historical recommended video sequence. For example, the higher the similarity value, the higher the degree of association between the two videos.
[0209] For example, the computer device uses the historical recommended video sequence vector as an analysis parameter to calculate the recommendation similarity value corresponding to each video in the historical recommended video vector; and calculates the recommendation anti-similarity value corresponding to each video in the historical recommended video vector.
[0210] For example, the computer device uses 10 historical recommended videos from the historical recommended video sequence vector as analysis parameters, calculates and sums the recommendation similarity values between each video in the historical recommended video vector and other videos, thus obtaining 10 recommendation similarity values; it also calculates and sums the recommendation inverse similarity values between each video in the historical recommended video vector and other videos, thus obtaining 10 recommendation inverse similarity values.
[0211] Step 706: Fuse the recommendation similarity value and recommendation anti-similarity value corresponding to the same video in the historical recommended video sequence vector to obtain the video recommendation vector corresponding to the historical recommended video sequence vector.
[0212] For example, the computer device will fuse the recommendation similarity value and recommendation anti-similarity value corresponding to the same video in the historical recommended video sequence vector to obtain the video recommendation vector corresponding to the historical recommended video sequence vector.
[0213] For example, the computer device uses 10 historical recommended videos from the historical recommended video sequence vector as analysis parameters to calculate 10 recommendation similarity values; it also calculates 10 recommendation anti-similarity values. The computer device then merges the recommendation similarity values and recommendation anti-similarity values corresponding to the same video to obtain the video recommendation vector corresponding to the historical recommended video sequence vector.
[0214] Step 708: Calculate the recommendation degree based on the video recommendation vector and the positive candidate video sample vector to obtain the first recommendation degree between the video recommendation vector and the positive candidate video sample vector; calculate the recommendation degree based on the video recommendation vector and the negative candidate video sample vector to obtain the second recommendation degree between the video recommendation vector and the negative candidate video sample vector.
[0215] The recommendation score is used to represent the degree of correlation between historical recommended video sequences and candidate videos. For example, the higher the recommendation score, the higher the degree of correlation between historical recommended video sequences and candidate videos.
[0216] For example, the computer device calculates the recommendation value based on the video recommendation vector and the positive candidate video sample vector to obtain a first recommendation value between the video recommendation vector and the positive candidate video sample vector.
[0217] The computer device calculates the recommendation degree value based on the video recommendation vector and the negative candidate video sample vector, and obtains a second recommendation degree value between the video recommendation vector and the negative candidate video sample vector.
[0218] Step 710: Calculate the loss function value based on the first recommendation value and the second recommendation value.
[0219] For example, the computer device calculates the loss function value based on the first recommendation value and the second recommendation value.
[0220] Step 712: Update the model parameters of the video recommendation model based on the loss function value.
[0221] For example, the computer device updates the model parameters of the video recommendation model based on the loss function value.
[0222] Model parameter update refers to updating the network parameters in the video recommendation model, or updating the network parameters of each network module in the model, or updating the network parameters of each network layer in the model, but it is not limited to these, and the embodiments of this application do not limit it.
[0223] The model parameters of the video recommendation model include at least one of the following: network parameters of the feature extraction network, network parameters of the first fully connected network, network parameters of the second fully connected network, and network parameters of the feature fusion network.
[0224] In summary, the method provided in this embodiment obtains the historical recommended video sequence vector of the target account, the positive candidate video sample vector corresponding to the positive candidate video sample in the candidate video set, and the negative candidate video sample vector corresponding to the negative candidate video sample. The computer device uses the historical recommended video sequence vector as analysis parameters to obtain the recommendation similarity value and recommendation anti-similarity value corresponding to each video in the historical recommended video sequence vector. The computer device fuses the recommendation similarity value and recommendation anti-similarity value corresponding to the same video in the historical recommended video sequence vector to obtain the video recommendation vector corresponding to the historical recommended video sequence vector. The computer device calculates the recommendation degree value based on the video recommendation vector and the positive candidate video sample vector to obtain a first recommendation degree value between the video recommendation vector and the positive candidate video sample vector. The computer device also calculates the recommendation degree value based on the video recommendation vector and the negative candidate video sample vector to obtain a second recommendation degree value between the video recommendation vector and the negative candidate video sample vector. The computer device calculates the loss function value based on the first and second recommendation degree values. The computer device updates the model parameters of the video recommendation model based on the loss function value, enabling the trained video recommendation model to have higher video recommendation accuracy, thereby obtaining more accurate recommended videos.
[0225] Figure 8 This is a flowchart illustrating a training method for a video recommendation model provided in an exemplary embodiment of this application. The method can be executed by a computer device, which may be... Figure 2 The method includes: terminal 100 or server 200.
[0226] Step 802: Obtain the historical recommended video sequence vector of the target account, the positive candidate video sample vector corresponding to the positive candidate video sample in the candidate video set, and the negative candidate video sample vector corresponding to the negative candidate video sample.
[0227] For example, the computer device obtains the historical recommended video sequence of the target account, and inputs the videos in the historical recommended video sequence into the feature extraction network to extract features, thereby obtaining the historical recommended video sequence vector.
[0228] The historical recommended video sequence refers to the sequence of recommended videos that the target account received up to the current moment.
[0229] Historical recommended video sequence vectors refer to the feature vectors corresponding to the videos in the historical recommended video sequence.
[0230] For example, the historical recommended video sequence corresponding to the target account u is S. u Historical recommended video sequence S u It can be represented as:
[0231] Optionally, the computer device will store historical recommended video sequences S u The length is controlled to be n, if the historical recommended video sequence S u If the length is greater than n, then choose the distance. The most recent n videos; if the historical recommended video sequence S u If the length of the sequence is equal to n, then no selection is needed; if the historical recommended video sequence S... u If the length of the historical recommended video sequence S is less than n, then zero-padding is used to shorten the sequence. u The length is determined by n, for example, n is 10, and the historical recommended video sequence S u If there are only 6 videos in the sequence, then the remaining 4 videos in the sequence will be set to 0.
[0232] Optionally, the historical recommended video sequence vector E∈R |j|*d , where |j| represents the number of videos in the historical recommended video sequence, d represents the embedding vector of the video, and R is a real number.
[0233] Step 804: Using the historical recommended video sequence vector as the analysis parameter, input the historical recommended video sequence vector into the first self-attention mechanism network for calculation to obtain the recommendation similarity value corresponding to each video in the historical recommended video vector.
[0234] In one possible implementation, the computer device uses the historical recommended video sequence vector as an analysis parameter to calculate the similarity value between the video at time i and the videos at other times in the historical recommended video vector, and sums them up to obtain the recommendation similarity value for the video at time i, where i is a positive integer.
[0235] Optionally, the computer device inputs the historical recommended video sequence vector into the first self-attention mechanism network, calculates the similarity value between the video corresponding to time i and the videos corresponding to other times in the historical recommended video vector, and sums them to obtain the recommendation similarity value corresponding to the video at time i, where i is a positive integer.
[0236] For example, the computer device uses 10 historical recommended videos from the historical recommended video sequence vector as analysis parameters, and obtains the recommendation similarity value between each video in the historical recommended video vector and other videos based on the first self-attention mechanism network, and sums them to obtain 10 recommendation similarity values.
[0237] The formula for calculating the similarity value between any video in the historical recommended video sequence and other videos can be expressed as:
[0238]
[0239] Among them, W Q1 W K1 WV1 All three parameters are trainable parameter matrices. These three parameters are the learnable parameter matrices of this network. E is the vector of historical recommended video sequences, and d is the vector length.
[0240] It is understandable that the recommendation similarity value obtained based on the first self-attention mechanism network can be used to obtain the target account's preferred or liked videos in the historical recommended video sequence.
[0241] Step 806: Using the historical recommended video sequence vector as the analysis parameter, input the historical recommended video sequence vector into the second self-attention mechanism network for calculation to obtain the recommendation anti-similarity value corresponding to each video in the historical recommended video vector.
[0242] The recommendation anti-similarity value refers to the sum of the differences between any video in the historical recommended video sequence obtained based on the second self-attention mechanism network and other videos.
[0243] For example, the computer device uses the historical recommended video sequence vector as analysis parameters and obtains the recommendation anti-similarity value corresponding to each video in the historical recommended video vector based on the second self-attention mechanism network.
[0244] In one possible implementation, the computer device uses the historical recommended video sequence vector as the analysis parameter, calculates the difference between the video at time i and the videos at other times in the historical recommended video vector, and sums them to obtain the recommended anti-similarity value of the video at time i, where i is a positive integer.
[0245] Optionally, the computer device inputs the historical recommended video sequence vector into the second self-attention mechanism network, calculates the difference between the video at time i and the videos at other times in the historical recommended video vector, and sums them to obtain the recommendation anti-similarity value of the video at time i.
[0246] For example, the computer device uses 10 historical recommended videos from the historical recommended video sequence vector as analysis parameters, and obtains the recommendation anti-similarity value between each video in the historical recommended video vector and other videos based on the second self-attention mechanism network, and sums them to obtain 10 recommendation anti-similarity values.
[0247] The formula for calculating the difference between any video in the historical recommended video sequence and other videos can be expressed as:
[0248]
[0249] Among them, W Q2 W K2 W V2All three parameters are trainable parameter matrices. These three parameters are the learnable parameter matrices of this network. E is the vector of historical recommended video sequences, and d is the vector length.
[0250] It is understandable that the recommendation anti-similarity value obtained based on the second self-attention mechanism network can be used to identify videos that the target account has deviated from or disliked in the historical recommended video sequence.
[0251] Step 808: Fuse the recommendation similarity value and recommendation anti-similarity value corresponding to the same video in the historical recommended video sequence vector to obtain the video recommendation vector corresponding to the historical recommended video sequence vector.
[0252] For example, the computer device will fuse the recommendation similarity value and recommendation anti-similarity value corresponding to the same video in the historical recommended video sequence vector to obtain the video recommendation vector corresponding to the historical recommended video sequence vector.
[0253] For example, the computer device uses 10 historical recommended videos from the historical recommended video sequence vector as analysis parameters, obtains 10 recommendation similarity values based on the first self-attention mechanism network, and obtains 10 recommendation anti-similarity values based on the second self-attention mechanism network. The computer device then fuses the recommendation similarity values and recommendation anti-similarity values corresponding to the same video to obtain the video recommendation vector corresponding to the historical recommended video sequence vector.
[0254] In one possible implementation, the computer device inputs the recommendation similarity value corresponding to the historical recommended video sequence vector into the first fully connected layer network for nonlinear fitting to obtain the first intermediate video recommendation vector.
[0255] The formula for the non-linear fitting of the recommendation similarity value by the first fully connected layer network can be expressed as:
[0256]
[0257] in, Let S be the trainable parameter matrix in the first fully connected layer of the network. These three parameters are the learnable parameter matrix of this network. sim To recommend similarity values, F sim This is the recommendation vector for the first intermediate video.
[0258] The computer device inputs the recommendation anti-similarity value corresponding to the historical recommended video sequence vector into the second fully connected layer network for nonlinear fitting to obtain the second intermediate video recommendation vector.
[0259] The formula for the nonlinear fitting of the recommendation anti-similarity value by the second fully connected layer network can be expressed as:
[0260]
[0261] in, Let S be the trainable parameter matrix in the second fully connected layer network. These three parameters are the learnable parameter matrix of this network. anti_sim To recommend the anti-similarity value, F anti_sim This is the recommendation vector for the second intermediate video.
[0262] The computer device inputs the first intermediate video recommendation vector and the second intermediate video recommendation vector into the feature fusion network and adds them together according to the weight values to obtain the video recommendation vector corresponding to the historical recommended video sequence vector.
[0263] The formula for calculating video recommendation vectors can be expressed as:
[0264] F = βF sim +(1-β)F anti_sim
[0265] Where F is the video recommendation vector, F sim F is the recommendation vector for the first intermediate video. anti_sim Let β be the recommendation vector for the second intermediate video, 1-β be the weight value corresponding to the recommendation vector for the first intermediate video, and 1-β be the weight value corresponding to the recommendation vector for the second intermediate video.
[0266] Step 810: Calculate the recommendation degree based on the video recommendation vector and the positive candidate video sample vector to obtain the first recommendation degree between the video recommendation vector and the positive candidate video sample vector; calculate the recommendation degree based on the video recommendation vector and the negative candidate video sample vector to obtain the second recommendation degree between the video recommendation vector and the negative candidate video sample vector.
[0267] The recommendation score is used to represent the degree of correlation between historical recommended video sequences and candidate videos. For example, the higher the recommendation score, the higher the degree of correlation between historical recommended video sequences and candidate videos.
[0268] For example, the computer device calculates the recommendation value based on the video recommendation vector and the positive candidate video sample vector to obtain a first recommendation value between the video recommendation vector and the positive candidate video sample vector.
[0269] The formula for calculating the first recommendation score can be expressed as:
[0270]
[0271] Among them, F t This is the video recommendation vector corresponding to the historical recommended video sequence at time t. Let r be the transpose of the vector of positive candidate video samples corresponding to the positive candidate video samples in the candidate video set. o,t This is the highest recommendation value.
[0272] For example, the computer device calculates a recommendation value based on the video recommendation vector and the negative candidate video sample vector to obtain a second recommendation value between the video recommendation vector and the negative candidate video sample vector.
[0273] The formula for calculating the second recommendation value can be expressed as:
[0274]
[0275] Among them, F t This is the video recommendation vector corresponding to the historical recommended video sequence at time t. Let r be the transpose of the negative candidate video sample vector corresponding to the negative candidate video sample in the candidate video set. j,t This is the second recommendation value.
[0276] For example, the candidate video set includes one positive candidate video sample and nine negative candidate video samples. The computer device performs a dot product calculation on the video recommendation vector and the positive candidate video sample vector to obtain the first recommendation value between the video recommendation vector and the positive candidate video sample vector. The computer device then performs a dot product calculation on the video recommendation vector and the nine negative candidate video sample vectors in sequence to obtain nine second recommendation values between the video recommendation vector and the negative candidate video sample vectors.
[0277] Step 812: Calculate the loss function value based on the first recommendation value and the second recommendation value.
[0278] For example, the computer device calculates the loss function value based on the first recommendation value and the second recommendation value.
[0279] The formula for calculating the loss function value can be expressed as:
[0280]
[0281] In the formula, r o,t r is the first recommendation score. j,t The second recommendation value is σ, which is a non-linear function, and S is the second recommendation value. U This represents the current target account, and n is the length of the historical recommended video sequence.
[0282] Step 814: Update the model parameters of the video recommendation model based on the loss function value.
[0283] Model parameter update refers to updating the network parameters in the video recommendation model, or updating the network parameters of each network module in the model, or updating the network parameters of each network layer in the model, but it is not limited to these, and the embodiments of this application do not limit it.
[0284] The model parameters of the video recommendation model include at least one of the following: network parameters of the feature extraction network, network parameters of the first self-attention mechanism network, network parameters of the second self-attention mechanism network, network parameters of the first fully connected network, network parameters of the second fully connected network, and network parameters of the feature fusion network.
[0285] In some embodiments, updating the model parameters of a video recommendation model includes updating the network parameters of all network modules in the video recommendation model, or fixing the network parameters of some network modules in the video recommendation model and updating only the network parameters of the remaining network modules. For example, when updating the model parameters of a video recommendation model, the network parameters of the first self-attention mechanism network, the extraction network, the feature fusion network, and the first fully connected network in the video recommendation model are fixed, and only the network parameters of the second self-attention mechanism network and the second fully connected network are updated.
[0286] Based on the loss function value, the network parameters of the feature extraction network, the first self-attention mechanism network, the second self-attention mechanism network, the first fully connected network, the second fully connected network, and the feature fusion network in the video recommendation model are updated using the loss function value as the training metric until the loss function value converges, thus obtaining the trained video recommendation model.
[0287] The convergence of the loss function value means that the loss function value no longer changes, or that the error difference between two adjacent iterations during the training of the video recommendation model is less than a preset value, or that the training number of the video recommendation model reaches at least one of the preset numbers, but is not limited thereto, and the embodiments of this application do not limit this.
[0288] Optionally, the target condition for training can be that the initial model reaches a target number of training iterations, which can be preset by the technician. Alternatively, the target condition for training can be that the loss value meets a target threshold condition, but it is not limited thereto, and the embodiments of this application do not limit it in this way.
[0289] In summary, the method provided in this embodiment obtains the historical recommended video sequence vector of the target account, the positive candidate video sample vector corresponding to the positive candidate video sample in the candidate video set, and the negative candidate video sample vector corresponding to the negative candidate video sample. The computer device uses the historical recommended video sequence vector as analysis parameters to obtain the recommendation similarity value and recommendation anti-similarity value corresponding to each video in the historical recommended video sequence vector. The computer device fuses the recommendation similarity value and recommendation anti-similarity value corresponding to the same video in the historical recommended video sequence vector to obtain the video recommendation vector corresponding to the historical recommended video sequence vector. The computer device calculates the recommendation degree value based on the video recommendation vector and the positive candidate video sample vector to obtain a first recommendation degree value between the video recommendation vector and the positive candidate video sample vector. The computer device also calculates the recommendation degree value based on the video recommendation vector and the negative candidate video sample vector to obtain a second recommendation degree value between the video recommendation vector and the negative candidate video sample vector. The computer device calculates the loss function value based on the first and second recommendation degree values. The computer device updates the model parameters of the video recommendation model based on the loss function value, enabling the trained video recommendation model to have higher video recommendation accuracy, thereby obtaining more accurate recommended videos.
[0290] It should be noted that all information (including but not limited to object device information, object personal information, etc.), data (including but not limited to data used for analysis, stored data, displayed data, etc.), and signals involved in this application have been authorized by the object or fully authorized by all parties, and the collection, use, and processing of related data must comply with the relevant laws, regulations, and standards of the relevant countries and regions. For example, the historical recommended video sequences and candidate video sets involved in this application were obtained with full authorization.
[0291] In illustrative terms, in conjunction with the above embodiments, the application scenarios of the video recommendation method provided in this application include, but are not limited to, the following scenarios:
[0292] First, in the video playback application, during the playback of a video by the target account, or after the target account finishes playing a video, video recommendations are made to the target account. The video playback application can be a regular video playback application used to play user-generated content (UGC), movies, TV series, variety shows, and other video content. It can also be a short video application, where short videos typically refer to video content that is shorter than a preset duration and is generated through a specified short video application.
[0293] In video playback applications, analysis is performed based on the target account's historical recommended video sequences, which include videos previously played by the target account. Candidate videos are then recommended to the target account based on the video sequences in the historical recommended video sequences.
[0294] Second, in news reading applications, when a target account refreshes news content in a waterfall layout, the system analyzes the target account's historical recommended news sequence, which includes news previously viewed by the target account. Candidate news is then recommended to the target account based on the news sequence in the historical recommended news sequence.
[0295] The aforementioned news recommendations can be implemented in the news reading application described above, or they can be applied to the news reading sections of other applications, such as instant messaging applications, browsers, games, utility applications, etc. This application embodiment does not limit this.
[0296] The two application scenarios described above are merely illustrative examples of this application. The video recommendation method provided in this application can also be applied to other content recommendation schemes, and this application does not limit it in this regard.
[0297] It is worth noting that the video recommendation method provided in this application embodiment can be implemented by a terminal, a server, or a combination of both. The terminal includes at least one of the following: smartphone, tablet, laptop, desktop computer, smart speaker, smart wearable device, etc. The server can be a physical server or a cloud server providing cloud computing services. The server can be a single server or a server cluster or distributed system composed of multiple servers. When the terminal and server collaborate to implement the solution provided in this application embodiment, the terminal and server can be directly or indirectly connected via wired or wireless communication, and this application embodiment does not limit this connection.
[0298] Figure 9 This illustration shows a structural block diagram of a video recommendation apparatus provided in an exemplary embodiment of this application. The apparatus can be implemented as all or part of a computer device through software, hardware, or a combination of both. The apparatus includes:
[0299] The acquisition module 901 is used to acquire the historical recommended video sequence vector of the target account and the candidate video vector corresponding to the candidate video in the candidate video set. The historical recommended video sequence vector includes the feature vector corresponding to the video in the historical recommended video sequence.
[0300] The calculation module 902 is used to obtain the recommendation similarity value and recommendation anti-similarity value corresponding to each video in the historical recommendation video vector using the historical recommendation video sequence vector as analysis parameters. The recommendation similarity value refers to the sum of the similarity values between any video in the historical recommendation video sequence and other videos, and the recommendation anti-similarity value refers to the sum of the difference values between any video in the historical recommendation video sequence and other videos.
[0301] The fusion module 903 is used to fuse the recommendation similarity value and the recommendation anti-similarity value corresponding to the same video in the historical recommended video sequence vector to obtain the video recommendation vector corresponding to the historical recommended video sequence vector;
[0302] The calculation module 902 is further configured to calculate the recommendation degree value based on the video recommendation vector and the candidate video vector, so as to obtain the recommendation degree value between the video recommendation vector and the candidate video vector;
[0303] The recommendation module 904 is used to recommend the candidate video to the target account based on the recommendation score.
[0304] In one possible implementation, the calculation module 902 is further configured to use the historical recommended video sequence vector as an analysis parameter to calculate the similarity value between the video corresponding to time i and the videos corresponding to other times in the historical recommended video vector, and sum them up to obtain the recommended similarity value corresponding to the video corresponding to time i, where i is a positive integer.
[0305] In one possible implementation, the calculation module 902 is further configured to use the historical recommended video sequence vector as an analysis parameter, calculate the similarity value between the video corresponding to time i and the videos corresponding to other times in the historical recommended video vector based on the first self-attention mechanism network, and sum them up to obtain the recommendation similarity value corresponding to the video corresponding to time i.
[0306] In one possible implementation, the calculation module 902 is further configured to use the historical recommended video sequence vector as an analysis parameter to calculate the difference between the video corresponding to time i and the videos corresponding to other times in the historical recommended video vector, and sum them up to obtain the recommended anti-similarity value corresponding to the video corresponding to time i.
[0307] In one possible implementation, the calculation module 902 is further configured to use the historical recommended video sequence vector as an analysis parameter, calculate the difference between the video corresponding to time i and the videos corresponding to other times in the historical recommended video vector based on the second self-attention mechanism network, and sum them up to obtain the recommended anti-similarity value corresponding to the video corresponding to time i.
[0308] In one possible implementation, the fusion module 903 is further configured to input the recommendation similarity value corresponding to the historical recommended video sequence vector into the first fully connected layer network for nonlinear fitting to obtain the first intermediate video recommendation vector.
[0309] In one possible implementation, the fusion module 903 is further configured to input the recommendation anti-similarity value corresponding to the historical recommended video sequence vector into the second fully connected layer network for nonlinear fitting to obtain the second intermediate video recommendation vector.
[0310] In one possible implementation, the fusion module 903 is further configured to add the first intermediate video recommendation vector and the second intermediate video recommendation vector according to the weight values corresponding to the first intermediate video recommendation vector and the second intermediate video recommendation vector, to obtain the video recommendation vector corresponding to the historical recommended video sequence vector.
[0311] In one possible implementation, the acquisition module 901 is further configured to acquire the historical recommended video sequence of the target account; input the videos in the historical recommended video sequence into a feature extraction network for feature extraction to obtain the historical recommended video sequence vector.
[0312] Figure 10 This illustration shows a structural block diagram of a training apparatus for a video recommendation model provided in an exemplary embodiment of this application. The apparatus can be implemented as all or part of a computer device through software, hardware, or a combination of both. The apparatus includes:
[0313] The acquisition module 1001 is used to acquire the historical recommended video sequence vector of the target account, the positive candidate video sample vector corresponding to the positive candidate video sample in the candidate video set, and the negative candidate video sample vector corresponding to the negative candidate video sample in the negative candidate video set. The historical recommended video sequence vector includes the feature vector corresponding to the video in the historical recommended video sequence.
[0314] The calculation module 1002 is used to obtain the recommendation similarity value and recommendation anti-similarity value corresponding to each video in the historical recommendation video vector using the historical recommendation video sequence vector as analysis parameters. The recommendation similarity value refers to the sum of the similarity values between any video in the historical recommendation video sequence and other videos, and the recommendation anti-similarity value refers to the sum of the difference values between any video in the historical recommendation video sequence and other videos.
[0315] The fusion module 1003 is used to fuse the recommendation similarity value and the recommendation anti-similarity value corresponding to the same video in the historical recommendation video sequence vector to obtain the video recommendation vector corresponding to the historical recommendation video sequence vector;
[0316] The calculation module 1002 is further configured to calculate a recommendation degree value based on the video recommendation vector and the positive candidate video sample vector to obtain a first recommendation degree value between the video recommendation vector and the positive candidate video sample vector; and to calculate a second recommendation degree value between the video recommendation vector and the negative candidate video sample vector based on the video recommendation vector and the negative candidate video sample vector.
[0317] The calculation module 1002 is further configured to calculate a loss function value based on the first recommendation value and the second recommendation value;
[0318] The update module 1004 is used to update the model parameters of the video recommendation model based on the loss function value.
[0319] In one possible implementation, the calculation module 1002 is further configured to use the historical recommended video sequence vector as an analysis parameter to calculate the similarity value between the video corresponding to time i and the videos corresponding to other times in the historical recommended video vector, and sum them up to obtain the recommendation similarity value corresponding to the video corresponding to time i, where i is a positive integer. In another possible implementation, the calculation module 1002 is further configured to input the historical recommended video sequence vector into the first self-attention mechanism network, calculate the similarity value between the video corresponding to time i and the videos corresponding to other times in the historical recommended video vector, and sum them up to obtain the recommendation similarity value corresponding to the video corresponding to time i, where i is a positive integer.
[0320] In one possible implementation, the calculation module 1002 is further configured to use the historical recommended video sequence vector as an analysis parameter to calculate the difference between the video corresponding to time i and the videos corresponding to other times in the historical recommended video vector, and sum them up to obtain the recommended anti-similarity value corresponding to the video corresponding to time i, where i is a positive integer.
[0321] In one possible implementation, the calculation module 1002 is further configured to input the historical recommended video sequence vector into the second self-attention mechanism network, calculate the difference between the video corresponding to the i-th time moment and the videos corresponding to other times in the historical recommended video vector, and sum them up to obtain the recommended anti-similarity value corresponding to the video corresponding to the i-th time moment.
[0322] In one possible implementation, the video recommendation model further includes a first fully connected layer network, a second fully connected layer network, and a feature fusion network;
[0323] In one possible implementation, the fusion module 1003 is further configured to input the recommendation similarity value corresponding to the historical recommended video sequence vector into the first fully connected layer network for nonlinear fitting to obtain the first intermediate video recommendation vector.
[0324] In one possible implementation, the fusion module 1003 is further configured to input the recommendation anti-similarity value corresponding to the historical recommended video sequence vector into the second fully connected layer network for nonlinear fitting to obtain the second intermediate video recommendation vector.
[0325] In one possible implementation, the fusion module 1003 is further configured to input the first intermediate video recommendation vector and the second intermediate video recommendation vector into the feature fusion network and add them together according to the weight values to obtain the video recommendation vector corresponding to the historical recommended video sequence vector.
[0326] In one possible implementation, the acquisition module 1001 is further configured to acquire the historical recommended video sequence of the target account; and input the videos in the historical recommended video sequence into a feature extraction network for feature extraction to obtain the historical recommended video sequence vector.
[0327] Figure 11 A structural block diagram of a computer device 1100 illustrated in an exemplary embodiment of this application is shown. This computer device can be implemented as a server as described in the above-described scheme of this application. The image computer device 1100 includes a Central Processing Unit (CPU) 1101, a system memory 1104 including Random Access Memory (RAM) 1102 and Read-Only Memory (ROM) 1103, and a system bus 1105 connecting the system memory 1104 and the CPU 1101. The image computer device 1100 also includes a mass storage device 1106 for storing an operating system 1109, application programs 1110, and other program modules 1111.
[0328] The mass storage device 1106 is connected to the central processing unit 1101 via a mass storage controller (not shown) connected to the system bus 1105. The mass storage device 1106 and its associated computer-readable media provide non-volatile storage for the image computing device 1100. That is, the mass storage device 1106 may include computer-readable media (not shown) such as a hard disk or a compact disc read-only memory (CD-ROM) drive.
[0329] Without loss of generality, the computer-readable medium may include computer storage media and communication media. Computer storage media include volatile and non-volatile, removable and non-removable media implemented using any method or technology for storing information such as computer-readable instructions, data structures, program modules, or other data. Computer storage media include RAM, ROM, erasable programmable read-only memory (EPROM), electrically erasable programmable read-only memory (EEPROM), flash memory or other solid-state storage technologies, CD-ROM, digital versatile disc (DVD) or other optical storage, magnetic tape cassettes, magnetic tape, disk storage, or other magnetic storage devices. Of course, those skilled in the art will recognize that the computer storage media are not limited to the above-mentioned types. The system memory 1104 and mass storage device 1106 described above can be collectively referred to as memory.
[0330] According to various embodiments of this disclosure, the image computing device 1100 can also be connected to a remote computer on a network, such as the Internet. That is, the image computing device 1100 can be connected to a network 1108 via a network interface unit 1107 connected to the system bus 1105, or it can use the network interface unit 1107 to connect to other types of networks or remote computer systems (not shown).
[0331] The memory also includes at least one computer program stored in the memory. The central processing unit 1101 executes the at least one program to implement all or part of the steps in the video recommendation method or video recommendation model training method shown in the above embodiments.
[0332] This application also provides a computer device, which includes a processor and a memory. The memory stores at least one program, which is loaded and executed by the processor to implement the training method or video recommendation method of the video recommendation model provided in the above-described method embodiments.
[0333] This application also provides a computer-readable storage medium storing at least one program, which is loaded and executed by a processor to implement the training method or video recommendation method of the video recommendation model provided in the above-described method embodiments.
[0334] This application also provides a computer program product, which includes a computer program stored in a computer-readable storage medium. The computer program is read from and executed by a processor of a computer device, causing the computer device to perform the training method or video recommendation method of the video recommendation model provided in the above method embodiments.
[0335] It is understood that, in the specific embodiments of this application, the data involved, historical data, and object data processing related to the identity or characteristics of the object, such as portraits, require the permission or consent of the object when the above embodiments of this application are applied to specific products or technologies, and the collection, use and processing of related data must comply with the relevant laws, regulations and standards of the relevant countries and regions.
[0336] It should be understood that "multiple" as used in this article refers to two or more. "And / or" describes the relationship between related objects, indicating that three relationships can exist. For example, A and / or B can represent: A alone, A and B simultaneously, or B alone. The character " / " generally indicates that the preceding and following related objects have an "or" relationship.
[0337] Those skilled in the art will understand that all or part of the steps of the above embodiments can be implemented by hardware or by a program instructing related hardware. The program can be stored in a computer-readable storage medium, such as a read-only memory, a disk, or an optical disk.
[0338] The above description is merely an optional embodiment of this application and is not intended to limit this application. Any modifications, equivalent switching, improvements, etc., made within the spirit and principles of this application should be included within the protection scope of this application.
Claims
1. A video recommendation method, characterized in that, The method includes: Obtain the historical recommended video sequence vector of the target account and the candidate video vector corresponding to the candidate video in the candidate video set. The historical recommended video sequence vector includes the feature vector corresponding to the video in the historical recommended video sequence. Using the historical recommended video sequence vector as analysis parameters, the recommendation similarity value and recommendation anti-similarity value corresponding to each video in the historical recommended video vector are obtained. The recommendation similarity value refers to the sum of the similarity values between any video in the historical recommended video sequence and other videos, and the recommendation anti-similarity value refers to the sum of the difference values between any video in the historical recommended video sequence and other videos. The recommendation similarity value corresponding to the historical recommended video sequence vector is input into the first fully connected layer network for nonlinear fitting to obtain the first intermediate video recommendation vector. The recommendation anti-similarity value corresponding to the historical recommended video sequence vector is input into the second fully connected layer network for nonlinear fitting to obtain the second intermediate video recommendation vector. The first intermediate video recommendation vector and the second intermediate video recommendation vector are added together according to the weight values corresponding to the first intermediate video recommendation vector and the second intermediate video recommendation vector to obtain the video recommendation vector corresponding to the historical recommended video sequence vector. The recommendation score is calculated based on the video recommendation vector and the candidate video vector to obtain the recommendation score between the video recommendation vector and the candidate video vector; Based on the recommendation score, the candidate video is recommended to the target account; The other videos are those in the historical recommended video sequence other than any of the aforementioned videos.
2. The method according to claim 1, characterized in that, The step of using the historical recommended video sequence vector as analysis parameters to obtain the recommendation similarity value corresponding to each video in the historical recommended video vector includes: Using the historical recommended video sequence vector as analysis parameters, the similarity value between the video at time i and the videos at other times in the historical recommended video vector is calculated and summed to obtain the recommended similarity value for the video at time i, where i is a positive integer.
3. The method according to claim 2, characterized in that, The step of using the historical recommended video sequence vector as analysis parameters to calculate the similarity value between the video at time i and the videos at other times in the historical recommended video vector, and summing these values to obtain the recommendation similarity value for the video at time i, includes: Using the historical recommended video sequence vector as analysis parameters, the similarity values between the video at time i and the videos at other times in the historical recommended video vector are calculated based on the first self-attention mechanism network, and then summed to obtain the recommended similarity value of the video at time i.
4. The method according to claim 1, characterized in that, The step of using the historical recommended video sequence vector as analysis parameters to obtain the recommendation anti-similarity value corresponding to each video in the historical recommended video vector includes: Using the historical recommended video sequence vector as analysis parameters, the difference between the video at time i and the videos at other times in the historical recommended video vector is calculated and summed to obtain the recommended anti-similarity value of the video at time i, where i is a positive integer.
5. The method according to claim 4, characterized in that, The step of using the historical recommended video sequence vector as analysis parameters to calculate and sum the differences between the video at time i and the videos at other times in the historical recommended video vector to obtain the recommended anti-similarity value for the video at time i includes: Using the historical recommended video sequence vector as analysis parameters, the difference between the video at time i and the videos at other times in the historical recommended video vector is calculated based on the second self-attention mechanism network, and the differences are summed to obtain the recommended anti-similarity value of the video at time i.
6. The method according to any one of claims 1 to 5, characterized in that, The process of obtaining the historical recommended video sequence vector of the target account includes: Obtain the historical recommended video sequence of the target account; The videos in the historical recommended video sequence are respectively input into the feature extraction network for feature extraction to obtain the historical recommended video sequence vector.
7. A training method for a video recommendation model, characterized in that, The method includes: Obtain the historical recommended video sequence vector of the target account, the positive candidate video sample vector corresponding to the positive candidate video sample in the candidate video set, and the negative candidate video sample vector corresponding to the negative candidate video sample in the candidate video set. The historical recommended video sequence vector includes the feature vectors corresponding to the videos in the historical recommended video sequence. Using the historical recommended video sequence vector as analysis parameters, the recommendation similarity value and recommendation anti-similarity value corresponding to each video in the historical recommended video vector are obtained. The recommendation similarity value refers to the sum of the similarity values between any video in the historical recommended video sequence and other videos, and the recommendation anti-similarity value refers to the sum of the difference values between any video in the historical recommended video sequence and other videos. The video recommendation model includes a first fully connected layer network, a second fully connected layer network, and a feature fusion network; The recommendation similarity value corresponding to the historical recommended video sequence vector is input into the first fully connected layer network for nonlinear fitting to obtain the first intermediate video recommendation vector. The recommendation anti-similarity value corresponding to the historical recommended video sequence vector is input into the second fully connected layer network for nonlinear fitting to obtain the second intermediate video recommendation vector; The first intermediate video recommendation vector and the second intermediate video recommendation vector are input into the feature fusion network and added according to the weight values to obtain the video recommendation vector corresponding to the historical recommended video sequence vector; A recommendation score is calculated based on the video recommendation vector and the positive candidate video sample vector to obtain a first recommendation score between the video recommendation vector and the positive candidate video sample vector; a second recommendation score is calculated based on the video recommendation vector and the negative candidate video sample vector to obtain a second recommendation score between the video recommendation vector and the negative candidate video sample vector. Calculate the loss function value based on the first recommendation value and the second recommendation value; The model parameters of the video recommendation model are updated based on the loss function value; The other videos are those in the historical recommended video sequence other than any of the aforementioned videos.
8. The method according to claim 7, characterized in that, The step of using the historical recommended video sequence vector as analysis parameters to obtain the recommendation similarity value corresponding to each video in the historical recommended video vector includes: Using the historical recommended video sequence vector as analysis parameters, the similarity value between the video at time i and the videos at other times in the historical recommended video vector is calculated and summed to obtain the recommended similarity value for the video at time i, where i is a positive integer.
9. The method according to claim 8, characterized in that, The video recommendation model includes a first self-attention mechanism network; The step of using the historical recommended video sequence vector as analysis parameters to calculate the similarity value between the video at time i and the videos at other times in the historical recommended video vector, and summing these values to obtain the recommendation similarity value for the video at time i, includes: The historical recommended video sequence vector is input into the first self-attention mechanism network. The similarity value between the video corresponding to time i and the videos corresponding to other times in the historical recommended video vector is calculated and summed to obtain the recommendation similarity value corresponding to the video at time i, where i is a positive integer.
10. The method according to claim 7, characterized in that, The step of using the historical recommended video sequence vector as analysis parameters to obtain the recommendation anti-similarity value corresponding to each video in the historical recommended video vector includes: Using the historical recommended video sequence vector as analysis parameters, the difference between the video at time i and the videos at other times in the historical recommended video vector is calculated and summed to obtain the recommended anti-similarity value of the video at time i, where i is a positive integer.
11. The method according to claim 10, characterized in that, The video recommendation model also includes a second self-attention mechanism network; The step of using the historical recommended video sequence vector as analysis parameters to obtain the recommendation anti-similarity value corresponding to each video in the historical recommended video vector includes: The historical recommended video sequence vector is input into the second self-attention mechanism network. The difference between the video at time i and the videos at other times in the historical recommended video vector is calculated and summed to obtain the recommended anti-similarity value of the video at time i.
12. The method according to any one of claims 7 to 11, characterized in that, The video recommendation model also includes a feature extraction network; The process of obtaining the historical recommended video sequence vector of the target account includes: Obtain the historical recommended video sequence of the target account; The videos in the historical recommended video sequence are respectively input into the feature extraction network for feature extraction to obtain the historical recommended video sequence vector.
13. A video recommendation device, characterized in that, The device includes: The acquisition module is used to acquire the historical recommended video sequence vector of the target account and the candidate video vector corresponding to the candidate video in the candidate video set. The historical recommended video sequence vector includes the feature vector corresponding to the video in the historical recommended video sequence. The calculation module is used to obtain the recommendation similarity value and recommendation anti-similarity value corresponding to each video in the historical recommendation video vector as the analysis parameter. The recommendation similarity value refers to the sum of the similarity values between any video in the historical recommendation video sequence and other videos, and the recommendation anti-similarity value refers to the sum of the difference values between any video in the historical recommendation video sequence and other videos. The fusion module is used to input the recommendation similarity value corresponding to the historical recommended video sequence vector into the first fully connected layer network for nonlinear fitting to obtain the first intermediate video recommendation vector. The fusion module is further configured to input the recommendation anti-similarity value corresponding to the historical recommended video sequence vector into the second fully connected layer network for nonlinear fitting to obtain the second intermediate video recommendation vector; The fusion module is further configured to add the first intermediate video recommendation vector and the second intermediate video recommendation vector according to the weight values corresponding to the first intermediate video recommendation vector and the second intermediate video recommendation vector, so as to obtain the video recommendation vector corresponding to the historical recommended video sequence vector; The calculation module is further configured to calculate the recommendation degree value based on the video recommendation vector and the candidate video vector, so as to obtain the recommendation degree value between the video recommendation vector and the candidate video vector; The recommendation module is used to recommend the candidate videos to the target account based on the recommendation score. The other videos are those in the historical recommended video sequence other than any of the aforementioned videos.
14. The apparatus according to claim 13, characterized in that, The calculation module is further configured to use the historical recommended video sequence vector as an analysis parameter to calculate the similarity value between the video corresponding to time i and the videos corresponding to other times in the historical recommended video vector, and sum them up to obtain the recommendation similarity value corresponding to the video corresponding to time i, where i is a positive integer.
15. The apparatus according to claim 14, characterized in that, The calculation module is further configured to use the historical recommended video sequence vector as analysis parameters, calculate the similarity value between the video corresponding to time i and the videos corresponding to other times in the historical recommended video vector based on the first self-attention mechanism network, and sum them up to obtain the recommendation similarity value corresponding to the video corresponding to time i.
16. The apparatus according to claim 13, characterized in that, The calculation module is further configured to use the historical recommended video sequence vector as an analysis parameter to calculate the difference between the video corresponding to time i and the videos corresponding to other times in the historical recommended video vector, and sum them up to obtain the recommended anti-similarity value corresponding to the video corresponding to time i.
17. The apparatus according to claim 16, characterized in that, The calculation module is further configured to use the historical recommended video sequence vector as analysis parameters, calculate the difference between the video corresponding to time i and the videos corresponding to other times in the historical recommended video vector based on the second self-attention mechanism network, and sum them up to obtain the recommended anti-similarity value corresponding to the video corresponding to time i.
18. The apparatus according to any one of claims 13 to 17, characterized in that, The acquisition module is further configured to acquire the historical recommended video sequence of the target account; input the videos in the historical recommended video sequence into the feature extraction network for feature extraction to obtain the historical recommended video sequence vector.
19. A training device for a video recommendation model, characterized in that, The device includes: The acquisition module is used to acquire the historical recommended video sequence vector of the target account, the positive candidate video sample vector corresponding to the positive candidate video sample in the candidate video set, and the negative candidate video sample vector corresponding to the negative candidate video sample. The historical recommended video sequence vector includes the feature vector corresponding to the video in the historical recommended video sequence. The calculation module is used to obtain the recommendation similarity value and recommendation anti-similarity value corresponding to each video in the historical recommendation video vector as the analysis parameter. The recommendation similarity value refers to the sum of the similarity values between any video in the historical recommendation video sequence and other videos, and the recommendation anti-similarity value refers to the sum of the difference values between any video in the historical recommendation video sequence and other videos. The video recommendation model includes a first fully connected layer network, a second fully connected layer network, and a feature fusion network; The fusion module is used to input the recommendation similarity value corresponding to the historical recommended video sequence vector into the first fully connected layer network for nonlinear fitting to obtain the first intermediate video recommendation vector. The fusion module is further configured to input the recommendation anti-similarity value corresponding to the historical recommended video sequence vector into the second fully connected layer network for nonlinear fitting to obtain the second intermediate video recommendation vector; The fusion module is further configured to input the first intermediate video recommendation vector and the second intermediate video recommendation vector into the feature fusion network and add them according to the weight values to obtain the video recommendation vector corresponding to the historical recommended video sequence vector; The calculation module is further configured to calculate a recommendation value based on the video recommendation vector and the positive candidate video sample vector to obtain a first recommendation value between the video recommendation vector and the positive candidate video sample vector; and to calculate a recommendation value based on the video recommendation vector and the negative candidate video sample vector to obtain a second recommendation value between the video recommendation vector and the negative candidate video sample vector. The calculation module is also used to calculate a loss function value based on the first recommendation value and the second recommendation value; An update module is used to update the model parameters of the video recommendation model based on the loss function value; The other videos are those in the historical recommended video sequence other than any of the aforementioned videos.
20. The apparatus according to claim 19, characterized in that, The calculation module is further configured to use the historical recommended video sequence vector as an analysis parameter to calculate the similarity value between the video corresponding to time i and the videos corresponding to other times in the historical recommended video vector, and sum them up to obtain the recommendation similarity value corresponding to the video corresponding to time i, where i is a positive integer.
21. The apparatus according to claim 20, characterized in that, The calculation module is further configured to input the historical recommended video sequence vector into the first self-attention mechanism network, calculate the similarity value between the video corresponding to time i and the videos corresponding to other times in the historical recommended video vector, and sum them up to obtain the recommendation similarity value corresponding to the video corresponding to time i, where i is a positive integer.
22. The apparatus according to claim 19, characterized in that, The calculation module is further configured to use the historical recommended video sequence vector as an analysis parameter to calculate the difference between the video corresponding to time i and the videos corresponding to other times in the historical recommended video vector, and sum them up to obtain the recommended anti-similarity value corresponding to the video corresponding to time i, where i is a positive integer.
23. The apparatus according to claim 22, characterized in that, The calculation module is further configured to input the historical recommended video sequence vector into the second self-attention mechanism network, calculate the difference between the video corresponding to time i and the videos corresponding to other times in the historical recommended video vector, and sum them up to obtain the recommended anti-similarity value corresponding to the video corresponding to time i.
24. The apparatus according to any one of claims 19 to 23, characterized in that, The acquisition module is further configured to acquire the historical recommended video sequence of the target account; input the videos in the historical recommended video sequence into the feature extraction network for feature extraction to obtain the historical recommended video sequence vector.
25. A computer device, characterized in that, The computer device includes a processor and a memory, wherein the memory stores at least one computer program, and the at least one computer program is loaded and executed by the processor to implement the video recommendation method as described in any one of claims 1 to 6, or the training method for the video recommendation model as described in any one of claims 7 to 12.
26. A computer-readable storage medium, characterized in that, The computer-readable storage medium stores at least one computer program, which is loaded and executed by a processor to implement the video recommendation method as described in any one of claims 1 to 6, or the training method for the video recommendation model as described in any one of claims 7 to 12.
27. A computer program product, characterized in that, The computer program product includes a computer program stored in a computer-readable storage medium; the computer program is read from and executed by a processor of a computer device, causing the computer device to perform the video recommendation method as described in any one of claims 1 to 6, or the training method for the video recommendation model as described in any one of claims 7 to 12.
Citation Information
Patent Citations
Content recommendation method and device, electronic equipment and storable medium
CN111046230A
Insulin recommendation method and device and blood glucose level monitoring system
CN114023418A