Short Sequence Augmented Movie Recommendation Method Based on Self-Attention and Integrated Triplet Information
By using the self-attention fusion knowledge graph information short sequence expansion method in the movie recommendation system, the problems of scarce user historical data, cold start and poor recommendation results are solved, and the accuracy and effect of recommendations are improved.
Patent Information
- Application Number
- CN202210588407.5
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2022-05-26
- Publication Date
- 2025-06-20
- Estimated Expiration
- 2042-05-26
AI Technical Summary
The existing movie recommendation system is difficult to effectively solve the problems of sparse user historical data, cold start and poor recommendation results.
The method of expanding movie recommendation based on self-attention is adopted to obtain external information of the movie through graph convolution network, and in combination with the Transformer model for reverse and forward training, generate enhanced data and expand user history sequences.
Improve the accuracy of movie recommendations, solve the short sequence problem, partially solve the cold start problem, and reduce the noise caused by external information.
Smart Images

Figure CN114943010B_ABST
Abstract
Description
Technical Field
[0001] The present invention relates to recommendation systems, movie recommendations, deep learning, and knowledge graphs, and provides a short sequence expansion movie recommendation method based on self-attention that integrates knowledge graph information. Background Art
[0002] With the continuous development of Internet technology, the amount of data is increasing, and there is more and more information of various kinds on the network. People are also exposed to more and more information in their lives. This makes it difficult for people to find the information they want on the network. That is, information overload occurs. The so-called information overload refers to the fact that users' knowledge level and cognitive ability are limited. When facing a vast amount of Internet information, they cannot quickly and accurately find the information they need, and may even be unable to understand and use the information. Therefore, when facing a vast amount of data, how to extract useful data for users has become the focus.
[0003] To solve the problem of information overload, search engines and recommendation systems have emerged. A search engine is a tool that can display the results that users want according to the information that users input what they want to search for. However, a search engine has a drawback. When users are not sure about the keywords they want to input, the search engine is powerless. At this time, the recommendation system comes in handy. The recommendation system does not require users to provide clear interest and demand information. As long as it models users and items by analyzing the historical behavior of users and items, it can recommend items that users may be interested in to users. Summary of the Invention
[0004] In order to overcome the deficiencies of the prior art and to address the problem of movie recommendations, the present invention proposes a short sequence expansion movie recommendation method based on self-attention that integrates knowledge graph information. In previous movie recommendation system solutions, it was difficult to solve problems such as the scarcity of users' historical data, cold start, and poor recommendation effects.
[0005] To solve the above technical problems, the present invention provides the following technical solutions:
[0006] A short sequence expansion movie recommendation method based on self-attention that integrates triple information, the method comprising the following steps:
[0007] 1) Original data processing: Process the original historical data of users watching movies into the format of [user id, movie id, rating, timestamp], and for each movie, create a knowledge graph for each movie according to the pre-set movie relationship schema as the external information of the movie;
[0008] 2) Make a historical movie sequence watched by each user according to the timestamp. Use the first movie item 0 in the sequence as the item to be predicted next, and use [item 1, item 2......item n] as the input sequence. Train the model backward using a unidirectional Transformer model; obtain the backward pre-trained model to generate augmented data. The implementation process is as follows:
[0009] 2.1) Treat each input movie item as the head entity, and use a graph convolutional network to obtain their relationships and the aggregated information kg_embedding of the tail entity as the external information of this item. The GCN formula is defined as:
[0010] π i r = g(i, r)
[0011]
[0012]
[0013] where i ∈ R d and r ∈ R d are the representations of the movie item and the relationship r respectively, d is the dimension of the representation, describes the importance of the relationship r with the movie item, is the normalized item relationship score, e is the representation of the entity in the knowledge graph, N(v) represents a fixed number of neighbor sets, and v i N(v) is the aggregated representation; 2.2) Add the embedding item_embedding of the item and the fused embedding kg_embedding of the item's triple [item_embedding 1 + kg_embedding 1, item_embedding 2 + kg_embedding 2......item_embedding n + kg_embedding n] as Q and K in the Transformer module, and use [item_embedding 1, item_embedding 2......item_embedding n] as V in the Transformer module, and send them into the unidirectional Transformer model for backward training to predict item 0.
[0014]
[0015] where Q and K are the superimposed representations of the item itself and the knowledge graph aggregation, and V is the representation of the item itself;
[0016] 2.3) Calculate the cross-entropy loss based on the output of the unidirectional Transformer module at each position and the ground truth, and optimize the model using the Adam optimizer. The finally trained reverse model is used as the pre-trained model. The following is the loss function.
[0017]
[0018]
[0019]
[0020] where x i,t is the click value of the model output H t and all item matrices, a t is the expected output at time step t, <pad> represents a padding item, s t+1 indicates that the expected output is the next item, and indicates the item to be predicted. LOSS is the cross-entropy loss function, represents the click score of the output of item t and the true expected item, x j,y represents the score of the negative sample;
[0021] 2.4) Predict the previous movie item -1 through the pre-trained model input [item 0, item 1, item 2...... item n], add item -1 to the first position of the sequence to form a new sequence [item -1, item 0, item 1, item 2...... item n], and then send this sequence into the pre-trained model to predict movie item -2. Recursively repeat this operation. Finally, obtain k pseudo-items before the original item sequence, and add these k pseudo-items to the front of the original sequence to obtain the extended sequence [item -k...... item -2, item -1, item 0, item 1, item 2...... item n];
[0022] 3) Send the extended sequence [item -k...... item -2, item -1, item 0, item 1, item 2...... item n-1] into the pre-trained model for fine-tuning of the forward model. Predict the last item item n according to the input sequence of the extended length through the forward Transformer model. The fine-tuning process is the same as the reverse training process. See 2.2) and 2.3). After training and fine-tuning, obtain the forward pre-trained model;
[0023] 4) Use the fine-tuned forward pre-trained model to predict the next movie item n+1 that the user will watch through the input augmented sequence [item -k......item -2,item -1,item 0,item 1,item 2......item n] passing through the forward Transformer model.
[0024] The beneficial effects of the present invention are as follows: 1. Using the knowledge graph of movies as additional information can improve the accuracy of recommendations; 2. Using the reverse Transformer model to predict a certain number of pseudo-samples to increase the user's historical sequence, solving the short sequence problem and partially solving the cold start problem; 3. Instead of fusing the information of the external knowledge graph of movies with the movie sequence information as the input, but using the fused information as the attention weight, which reduces the noise brought by the addition of external information. BRIEF DESCRIPTION OF THE DRAWINGS
[0025] Figure 1 It is a logic flowchart of a short sequence augmented movie recommendation method based on self-attention for fusing triple information. DETAILED DESCRIPTION OF THE INVENTION
[0026] The present invention will be further described below with reference to the accompanying drawings.
[0027] Refer to Figure 1 , a short sequence augmented movie recommendation method based on self-attention for fusing triple information, the method comprising the following steps:
[0028] 1) Original data processing: Process the original historical data of users' movie views into the format of [user id, movie id, rating, timestamp], and for each movie, make a knowledge graph as the external information of the movie according to the pre-set movie relationship schema.
[0029] 2) Make a historical movie sequence watched by each user according to the timestamp, use the first movie item 0 in the sequence as the item to be predicted next, and use [item 1,item 2......item n] as the input sequence, and use the unidirectional Transformer model to train the model in reverse. Obtain the reverse pre-trained model to generate enhanced data, and the implementation process is as described below:
[0030] 2.1) For each input movie item as the head entity, use the graph convolutional network to obtain the aggregated information kg_embedding of their relationships and tail entities as the external information of the item, and its GCN formula is defined as:
[0031] π i r= g(i, r)
[0032]
[0033]
[0034] where \(i\in R\) d and \(r\in R\) d are the representations of movie item and relationship \(r\) respectively, \(d\) is the dimension of the representation describes the importance of relationship \(r\) to the movie item is the normalized item-relationship score, \(e\) is the representation of entities in the knowledge graph, \(N(v)\) represents a fixed number of neighbor sets, \(v\) i N(v) is the aggregated representation
[0035] 2.2) Add the embedding of the item, item_embedding, and the fused embedding of the triples of the item, kg_embedding, [item_embedding 1 + kg_embedding 1, item_embedding 2 + kg_embedding 2...... item_embedding n + kg_embedding n] as Q and K in the Transformer module, and use [item_embedding 1, item_embedding 2...... item_embedding n] as V in the Transformer module, and feed them into the unidirectional Transformer model for backpropagation training to predict item 0;
[0036]
[0037] where Q and K are the superimposed representations of the item itself and the aggregation of the knowledge graph, and V is the representation of the item itself;
[0038] 2.3) Calculate the cross-entropy loss according to the output of the unidirectional Transformer module at each position and the true value, use the Adam optimizer to optimize the model, and finally use the trained backpropagation model as the pre-trained model. The following is the loss function:
[0039]
[0040]
[0041]
[0042] where \(x\) i,t is the model output \(H\) tThe click value of all item matrices, a t Is the expected output at time step t, <pad> represents a padding item, s t+1 Indicates that the expected output is the next item, Indicates the item to be predicted, LOSS is the cross-entropy loss function, Represents the click score of the output of item t and the true expected item, x j,y Represents the score of the negative sample;
[0043] 2.4) Predict the previous movie item -1 through the pre-trained model input [item 0, item 1, item 2...... item n], add item -1 to the first position of the sequence to form a new sequence [item -1, item 0, item 1, item2...... item n], then send this sequence into the pre-trained model to predict movie item -2, and repeat this operation recursively. Finally, obtain the pseudo-items before the k original item sequences, and add these k pseudo-items to the front of the original sequence to obtain the extended sequence [item -k...... item -2, item -1, item 0, item 1, item 2...... item n]:
[0044] 3) Send the extended sequence [item -k...... item -2, item -1, item 0, item 1, item2...... item n-1] into the pre-trained model for fine-tuning of the forward model. Predict the last item item n according to the input sequence of the extended length through the forward Transformer model. The fine-tuning process is the same as the reverse training, and the process is shown in 2.2) and 2.3). After training and fine-tuning, obtain the forward pre-trained model;
[0045] 4) Use the fine-tuned forward pre-trained model to predict the next movie item n+1 that the user will watch through the input extended sequence [item -k...... item -2, item -1, item 0, item 1, item 2...... item n] through the forward Transformer model.
[0046] Finally, it should be noted that the above-described embodiments are only specific embodiments of the present invention, used to illustrate the technical solutions of the present invention, rather than limiting it. The protection scope of the present invention is not limited thereto. Although the present invention has been described in detail with reference to the foregoing embodiments, those of ordinary skill in the art should understand that any person skilled in the art within the technical scope disclosed by the present invention can still modify the technical solutions recorded in the foregoing embodiments, or can easily think of changes, or perform equivalent replacements on some of the technical features; and these modifications, changes or replacements do not make the essence of the corresponding technical solutions deviate from the spirit and scope of the technical solutions of the embodiments of the present invention, and should all be covered within the protection scope of the present invention. Therefore, the protection scope of the present invention should be subject to the protection scope of the claims.
Claims
1. A short sequence expansion movie recommendation method based on self-attention and integrating triple information, characterized in that, The method includes the following steps: 1) Original data processing: Process the original historical data of users' movie watching into the format of [user ID, movie ID, rating, timestamp]. For each movie, create a knowledge graph according to the pre-set movie relationship schema as the external information of the movie; 2) Create a historical movie sequence watched by each user according to the timestamp. Take the first movie item 0 in the sequence as the item to be predicted next, and use [item 1, item 2... item n] as the input sequence. Use a unidirectional Transformer model to train the model in reverse to obtain a reverse pre-trained model for generating augmented data. The implementation process is as follows: 2.1) Treat each input movie item as the head entity, and use a graph convolutional network to obtain the aggregation information kg_embedding of their relationships and tail entities as the external information of the item. The GCN formula is defined as: π i r = g(i, r) where \(i\in R\) d and \(r\in R\) d are the representations of movie item and relation \(r\) respectively, \(d\) is the dimension of the representation, describes the importance of relation \(r\) to the movie item, is the normalized item - relation score, \(e\) is the representation of entities in the knowledge graph, \(N(v)\) represents a fixed number of neighbor sets, and \(v\) i N(v) is the aggregated representation; 2.2) Add the embedding item_embedding of the item and the triple fusion embedding kg_embedding of the item [item_embedding 1 + kg_embedding 1, item_embedding 2 + kg_embedding 2... item_embedding n + kg_embedding n] as Q and K in the Transformer module, and use [item_embedding 1, item_embedding 2... item_embedding n] as V in the Transformer module, and send them into the unidirectional Transformer model for reverse training to predict item 0; Among them, Q and K are the superimposed representations of the item itself and the knowledge graph aggregation, and V is the representation of the item itself; 2.3) Calculate the cross-entropy loss according to the output of the unidirectional Transformer module at each position and the true value, and use the Adam optimizer to optimize the model. The finally trained reverse model is used as the pre-trained model. The following is the loss function: where x i,t is the model output H t and the click value of all item matrices, a t is the expected output at time step t, <pad> represents a padding item, s t+1 indicates that the expected output is the next item, represents the item to be predicted, LOSS is the cross-entropy loss function, represents the click score of the output of item t and the true expected item, x j,y represents the score of the negative sample; 2.4) Predict the previous movie item -1 through the pre-trained model input [item 0, item 1, item 2... item n], add item -1 to the first position of the sequence to form a new sequence [item -1, item 0, item 1, item 2... item n], and then send this sequence into the pre-trained model to predict movie item -2. Recursively repeat this operation. Finally, obtain k pseudo-items before the original item sequence, and add these k pseudo-items to the front of the original sequence to obtain an extended sequence [item -k... item -2, item -1, item0, item 1, item 2... item n]; 3) Feed the augmented sequence [item-k...item-2, item-1, item 0, item 1, item 2...item n-1] into the pre-trained model for fine-tuning the forward model. Predict the last item item n through the forward Transformer model according to the input sequence of the augmented length. The fine-tuning process is the same as the reverse training. The process is shown in 2.2) and 2.3). After training and fine-tuning, obtain the forward pre-trained model; 4) Use the fine-tuned forward pre-trained model. By inputting the augmented sequence [item-k...item-2, item-1, item0, item 1, item 2...item n], predict the next movie item n+1 that the user will watch through the forward Transformer model.
Citation Information
Patent Citations
Knowledge graph completion method and device, equipment and storage medium
CN112035672A
Recommendation method based on knowledge graph and attention mechanism
CN112507132A