Multi-level view contrast learning movie recommendation method, system, device and storage medium
By employing a multi-level view comparison learning method, combined with user-item interaction graphs and knowledge graphs, data augmentation and knowledge representation are performed, solving the problems of long-tail effect and noise interference in existing movie recommendation systems, thereby improving recommendation accuracy and user experience.
Patent Information
- Application Number
- CN202311108256.X
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2023-08-30
- Publication Date
- 2026-01-23
- Estimated Expiration
- 2043-08-30
AI Technical Summary
Most existing movie recommendation systems based on knowledge graphs adopt a supervised learning paradigm, which relies heavily on labeled data, leading to long-tail effects and noise interference, which affect the accuracy of recommendation results.
We employ a multi-level view contrastive learning approach, constructing user-item interaction graphs, knowledge graphs, and collaborative knowledge graphs to perform data augmentation and knowledge representation. By combining local and global contrastive learning, we establish a recommendation model and utilize graph neural networks and path-aware GNNs for knowledge embedding, reducing noise interference and improving recommendation accuracy.
It effectively solves the problem of sparse supervision signals in recommendation systems, reduces the long-tail effect, and improves the accuracy of recommendation results and user experience.
Smart Images

Figure CN117149993B_ABST
Abstract
Description
Technical Field
[0001] This invention relates to the fields of artificial intelligence and natural language processing, specifically to a multi-level view comparison learning method, system, device, and storage medium for movie recommendation. Background Technology
[0002] With the continuous development of information technology and the internet environment, the advanced network has brought massive amounts of data to people, greatly enriching their lives. However, it has also generated a large amount of redundant information, making it difficult for people to quickly filter out the content they truly need or are interested in. This problem of decreased efficiency caused by the explosive growth of information is also known as "information overload." To alleviate this problem and improve user experience, the research and application of recommendation systems have received increasing attention.
[0003] Recommender systems, as an effective means of solving the "information overload" problem, have been widely used. The task of a recommender system is to connect users with information, helping users discover valuable information while ensuring that information is presented to users who are interested in it, thus achieving a win-win situation for both information consumers and producers. While satisfying their basic needs, people are also paying more attention to their spiritual pursuits, with reading and watching movies becoming popular choices for enriching their leisure time. Therefore, with the development of the film industry, research on movie recommendation systems is receiving increasing attention. Traditional movie recommendation algorithms often face the cold start problem due to a lack of new item information, limited interaction data between users and items leading to data sparsity, and the difficulty for users to discover many long-tail items. These problems all affect the performance metrics of the recommendation.
[0004] Considering the abundance of supplementary information between users and items, various auxiliary information can be introduced to improve recommendation accuracy. Knowledge graphs, as heterogeneous networks containing rich semantic information, can be combined with recommendation algorithms to enhance the accuracy, diversity, and interpretability of recommendation systems. However, most existing movie recommendation systems based on knowledge graphs employ supervised learning paradigms, heavily relying on labeled data. This leads to long-tail effects and noise interference, impacting the accuracy of recommendation results. Summary of the Invention
[0005] To address the problems in existing knowledge graph-based movie recommendation systems, which mostly employ supervised learning paradigms and heavily rely on labeled data, leading to long-tail effects, noise interference, and reduced accuracy of recommendation results, this invention provides a multi-level view comparison learning method, system, device, and storage medium for movie recommendation.
[0006] To achieve the above objectives, the present invention employs the following technical solution:
[0007] This invention provides a multi-level view comparison learning method for movie recommendation, comprising the following steps:
[0008] S1: Obtain the dataset and construct a user-project interaction graph, knowledge graph, and collaborative knowledge graph based on the dataset; wherein, the dataset originates from the MovieLens-1 M dataset and includes usernames, movie names, rating data, movie metadata information, and user attribute information;
[0009] S2: Perform data augmentation on the user-project interaction graph and the knowledge graph respectively to obtain the data augmentation view of the user-project interaction graph and the data augmentation view of the knowledge graph;
[0010] S3: Represent the knowledge graph data augmentation view, the user-item interaction graph data augmentation view, and the collaborative knowledge graph respectively to obtain the user and item knowledge representations of two local views and a global view;
[0011] S4: Perform local-level contrastive learning on the user and item knowledge representations of the two local views respectively to obtain the local-level contrastive loss and the optimized user and item knowledge representations of the two local views;
[0012] S5: Perform global-level comparative learning between the user and item knowledge representations of the two optimized local views and the user and item knowledge representations of the global view to obtain the global-level comparative loss, the second-optimized user and item knowledge representations of the local views, and the optimized user and item knowledge representations of the global views;
[0013] S6: Based on the local-level contrastive loss, the global-level contrastive loss, the knowledge representation of users and items in the local view after secondary optimization, and the knowledge representation of users and items in the global view after optimization, perform multi-task training to build a recommendation model;
[0014] S7: Use the recommendation model to obtain the user's movie recommendation list.
[0015] Furthermore, the specific method of S1 is as follows:
[0016] Based on user rating data for movies, define user-project interaction without interaction and user-project interaction with interaction, and construct a user-project interaction graph;
[0017] Based on the movie and movie metadata information, set the relationship attributes between entities to obtain triples containing structured knowledge of head entity-relationship-tail entity, and construct a knowledge graph;
[0018] By aligning user-project interaction graphs and knowledge graphs with entities and integrating them, a collaborative knowledge graph is obtained.
[0019] Furthermore, the specific method of S2 is as follows:
[0020]
[0021] Among them, G k Let G be the set of the entire knowledge graph, (e,r,i)∈G k The triple representing the project's dependency, where e represents the entity, r represents the relation, and i represents the project; define the mask vector. As a probabilistic binary indicator to indicate whether a specific knowledge triple is selected during sampling, KG1(G k ) and KG2 (G k (This is an augmented view of knowledge graph data;)
[0022] Computational knowledge graph data augmentation view KG1(G k ) and Knowledge Graph Data Augmentation View KG2 (G k Consistency in each project ensures consistency in the knowledge graph structure.
[0023] C i =s(f k (x i ,KG1(G k )),f k (x i ,KG2(G k (2)
[0024] Among them, f k This represents a relation-aware knowledge aggregation scheme used to aggregate the knowledge of item i in different augmented views KG1(G k ) and KG2 (G k Generate embedding vectors in each of the following: and s(f k (x i ,KG1(G k )),f k (x i ,KG2(G k ))) indicates that it is used for calculation and The similarity cosine function between them, C i To ensure consistency in the knowledge graph structure;
[0025] Based on the consistency of the knowledge graph structure, data augmentation is performed on the user-item interaction graph using C. i Two mask vectors are obtained For user-project interaction diagram G u ={v,ε}, the user-project interaction graph data augmentation methods are as follows:
[0026]
[0027] Based on the consistency of knowledge graph structure C i Inferred probability to discard users - Project interaction graph G u The user-item interaction records in the edge set ε are used to obtain the user-item interaction graph data augmentation view UI1(G) u ) and UI2 (G u ).
[0028] Furthermore, the specific method of S3 is as follows:
[0029] Augmenting Knowledge Graph Data to View KG1(G k ) and KG2 (G k User-Project Interaction Graph Data Enhancement View UI1 (G) u ) and UI2 (G u The two partial views (KG1(G)) are recombined to obtain two partial views (KG1(G)). k ), UI1(G u )) and (KG2(G k ), UI2(G u ));
[0030] And for the two partial views (KG1(G) k ), UI1(G u )) and (KG2(G k ), UI2(G u Knowledge representation is performed to obtain the knowledge representations of the user and the project in the two partial views.
[0031] Simultaneously, knowledge representation is performed on the collaborative knowledge graph to obtain user and project knowledge representations for a global view;
[0032] Graph neural networks are used to embed users, items, and entities from user-item interaction graphs, knowledge graphs, and collaborative knowledge graphs into low-dimensional vectors, respectively.
[0033] Knowledge graphs are embedded into low-dimensional vectors using relation-aware knowledge embedding, specifically as follows:
[0034] Throughout the knowledge graph G k In this process, a message aggregation mechanism is constructed between projects and their connected entities to generate knowledge-aware project embeddings based on a heterogeneous attention aggregator, as follows:
[0035]
[0036]
[0037] Where, N i Project i in Knowledge Graph Gk Based on different relations r e,i The neighbor set of adjacent entities, x i and x e These are the embedded representations of items and entities, respectively, α(e,r) e,i i) is the attention relevance specific to entities and relationships estimated during the knowledge aggregation process, which encodes the different semantics of the relationships between items and entities. W is the parameterized weight matrix that represents the specific items and entities in the input. The LeakyReLU activation function is used to perform nonlinear transformations.
[0038] The knowledge representation of the user-item interaction graph is performed using vector embedding based on the message propagation strategy of LightGCN. The specific operation is as follows:
[0039]
[0040] in, and N represents the knowledge representations of user u and item i in the propagation layer of graph l, respectively. u and N i Let i represent the set of items that interact with user u and the set of users that interact with item i, respectively.
[0041] By using path-aware GNNs, the path information of the collaborative knowledge graph is encoded into nodes and embedded into low-dimensional vectors. Then, neighbor information is aggregated multiple times while retaining the path information, thus completing the knowledge representation of the collaborative knowledge graph.
[0042] Furthermore, the specific method of S4 is as follows:
[0043] For any node in one view, a positive sample is formed by the knowledge representation of the same node learned in another view; all other node knowledge representations are defined as negative samples. To map the knowledge representations of users and items to the space for calculating contrastive loss, the knowledge representations are first fed into an MLP with one hidden layer. and Then the comparative loss is calculated as follows:
[0044]
[0045]
[0046] The total local contrast loss is as follows:
[0047]
[0048] Where s(·) represents the cosine similarity calculation, and τ represents the temperature parameter. This indicates the local user-contrast learning loss. This represents the local-level item-contrast learning loss, where k represents negative sample items, i represents positive sample items, and L... local The total bureau-level comparison loss is represented by N, where N represents the number of projects and M represents the number of users.
[0049] Furthermore, the specific method of S5 is as follows:
[0050] The optimized user and item knowledge representations of the local view are compared and learned globally with the user and item knowledge representations of the global view. The corresponding nodes in different views are regarded as positive samples, and the rest of the nodes are regarded as negative samples.
[0051] The knowledge representations of users and items are mapped to a space for computing contrastive loss. The knowledge representations are first fed into an MLP with a hidden layer, resulting in... and The comparative loss is calculated as follows:
[0052]
[0053]
[0054] The user's contrast loss is calculated as follows:
[0055]
[0056]
[0057] The overall global contrast loss is calculated as follows:
[0058]
[0059] in, To obtain an optimized user knowledge representation through local-level contrastive learning. To obtain an optimized project knowledge representation through local-level contrastive learning. To facilitate collaborative knowledge graph user knowledge representation, To facilitate knowledge representation in collaborative knowledge graph projects. This represents the item comparison loss calculated from the global view. The item contrast loss is calculated from the partial view, where N is the number of items and M is the number of users. For user contrast loss calculated from the global view, User contrast loss calculated from a partial view.
[0060] Furthermore, the specific method of S6 is as follows:
[0061] The recommendation task uses the BPR loss function to reconstruct historical data, as follows:
[0062]
[0063] By combining global and local contrastive losses with BPR loss, the model parameters are learned by minimizing the following objective function, resulting in the recommendation model:
[0064]
[0065] Among them, O={(u,i,j)|(u,i)∈O + ,(u,j)∈O -} is the observed interaction O + and unobserved interactions O - The training dataset consists of σ, the sigmoid function; θ, the model parameter set; α, a hyperparameter used to determine the ratio of local to global contrastive loss; β, a hyperparameter used to control the contrastive loss; and λ, a hyperparameter used for L2 regularization. RKGMCL L represents the total loss during multi-task training. BPR The BPR loss for the recommendation task, The difference between the model's predicted score and the actual score.
[0066] A multi-level view comparison learning movie recommendation system includes:
[0067] The data acquisition and graph construction module is used to acquire datasets and construct user-project interaction graphs, knowledge graphs, and collaborative knowledge graphs based on the datasets. The datasets are derived from the MovieLens-1 M dataset and include usernames, movie names, rating data, movie metadata information, and user attribute information.
[0068] Data Augmentation Module: Used to augment the user-project interaction graph and knowledge graph respectively, resulting in augmented views of the user-project interaction graph and knowledge graph.
[0069] The knowledge representation module is used to represent the knowledge graph data augmentation view, the user-item interaction graph data augmentation view, and the collaborative knowledge graph respectively, resulting in two local views of user and item knowledge representations and one global view of user and item knowledge representations.
[0070] Local-level contrastive learning module: This module performs local-level contrastive learning on the user and item knowledge representations of the two local views respectively, resulting in local-level contrastive loss and the optimized user and item knowledge representations of the two local views.
[0071] Global Comparative Learning Module: This module performs global-level comparative learning between the user and item knowledge representations of two optimized local views and the user and item knowledge representations of the global view, resulting in a global-level comparative loss, a second-optimized user and item knowledge representation of the local view, and an optimized user and item knowledge representation of the global view.
[0072] Model building module: used to perform multi-task training and build a recommendation model based on local-level contrastive loss, global-level contrastive loss, knowledge representations of users and items in the local view of secondary optimization, and knowledge representations of users and items in the global view of optimization;
[0073] Movie recommendation module: Used to generate a list of recommended movies for the user using a recommendation model.
[0074] A terminal device includes a memory, a processor, and a computer program stored in the memory and executable on the processor, wherein the processor executes the computer program to perform the steps of the method described above.
[0075] A computer-readable storage medium storing a computer program that, when executed by a processor, implements the steps of the method described above.
[0076] Compared with the prior art, the present invention has the following beneficial effects:
[0077] This invention discloses a multi-level view contrastive learning method for movie recommendation. The method involves acquiring a dataset to build a knowledge graph, then performing data augmentation and knowledge representation on the graph. Finally, a movie recommendation list is calculated through multi-level contrastive learning and multi-task training. Employing a multi-level view and using different knowledge representation learning methods for different views allows for better integration of users, items, and their auxiliary information into the recommendation system. Using two different data augmentation methods avoids the limitations of single-method data augmentation, and employing data augmentation guided by knowledge graph structure consistency preserves the semantic information of the knowledge graph and reduces noise interference. The use of multi-level view contrastive learning introduces a self-supervised learning paradigm into the knowledge graph-based recommendation system, addressing the problem of sparse supervision signals, reducing the long-tail effect, and improving the accuracy of recommendation results, thereby enhancing user experience and satisfaction.
[0078] This invention employs a multi-level view of user-item interaction graph, knowledge graph, and collaborative knowledge graph, which can better integrate users and items and their auxiliary information into the recommendation system.
[0079] Random data augmentation of the knowledge graph can generate subgraphs with different augmented structural views, identifying items that are less sensitive to structural changes and more tolerant of noisy entity connections. These identified items are less ambiguous in features and better at capturing relevant user preferences. Knowledge-aware guided data augmentation of the user-item interaction graph leverages the structural consistency of items within the knowledge graph to guide data augmentation, mitigating the limitations of purely random discarding methods in retaining useful interactions for comparative learning. This approach identifies more useful interaction information and reduces noise interference. Using two different data augmentation methods avoids the problem of data augmentation being singular.
[0080] We employ relation-aware knowledge embedding low-dimensional vectors to reflect the relational heterogeneity in the knowledge graph's connection structure. We transform the context related to entities and relations into a specific representation with a parameterized attention matrix to address the limitations of manually designing path generation in knowledge graphs.
[0081] This invention also provides a multi-level view comparison learning movie recommendation system. Through the setup of a data acquisition and graph construction module, a data augmentation module, a knowledge representation module, a local-level comparison learning module, a global comparison learning module, a model building module, and a movie recommendation module, the system achieves data acquisition, construction of a multi-level graph, data augmentation and knowledge representation of the graph, optimization through local-level and global-level comparison learning, and finally, movie recommendations for users. This system is highly operable and provides highly accurate recommendation results, thereby improving user experience and satisfaction.
[0082] A terminal device includes a memory, a processor, and a computer program stored in the memory and executable on the processor, characterized in that the processor implements the steps of the above-described method when executing the computer program.
[0083] A computer-readable storage medium storing a computer program, characterized in that the computer program, when executed by a processor, implements the steps of the above-described method. Attached Figure Description
[0084] Figure 1 This is a schematic diagram of a multi-level view comparison learning movie recommendation method according to the present invention.
[0085] Figure 2 This is a data augmentation structure diagram for a multi-level view comparison learning movie recommendation method according to the present invention.
[0086] Figure 3This invention provides a comparative learning structure diagram for a multi-level view comparative learning movie recommendation method, where a represents a user-user comparative learning diagram in different diagrams, and b represents a project-project comparative learning diagram in different diagrams.
[0087] Figure 4 This is a structural diagram of a multi-level view comparison learning movie recommendation system according to the present invention. Detailed Implementation
[0088] To make the objectives, technical solutions, and advantages of the embodiments of the present invention clearer, the technical solutions of the embodiments of the present invention will be clearly and completely described below with reference to the accompanying drawings. Obviously, the described embodiments are only some embodiments of the present invention, and not all embodiments. The components of the embodiments of the present invention described and shown in the accompanying drawings can generally be arranged and designed in various different configurations.
[0089] Therefore, the following detailed description of the embodiments of the invention provided in the accompanying drawings is not intended to limit the scope of the claimed invention, but merely to illustrate selected embodiments of the invention. All other embodiments obtained by those skilled in the art based on the embodiments of the invention without inventive effort are within the scope of protection of the invention.
[0090] It should be noted that similar labels and letters in the following figures indicate similar items. Therefore, once an item is defined in one figure, it does not need to be further defined and explained in subsequent figures.
[0091] In the description of the embodiments of the present invention, it should be noted that if terms such as "upper," "lower," "horizontal," or "inner" indicate the orientation or positional relationship based on the orientation or positional relationship shown in the accompanying drawings, or the orientation or positional relationship commonly used when the product of the invention is in use, they are only for the convenience of describing the present invention and simplifying the description, and do not indicate or imply that the device or element referred to must have a specific orientation, or be constructed and operated in a specific orientation, and therefore should not be construed as a limitation of the present invention. Furthermore, terms such as "first" and "second" are only used to distinguish descriptions and should not be construed as indicating or implying relative importance.
[0092] Furthermore, the use of the term "horizontal" does not imply that the component must be absolutely horizontal, but rather that it can be slightly tilted. For example, "horizontal" simply means that its direction is more horizontal than "vertical," and does not mean that the structure must be completely horizontal, but can be slightly tilted.
[0093] In the description of the embodiments of the present invention, it should also be noted that, unless otherwise explicitly specified and limited, the terms "set," "install," "connect," and "link" should be interpreted broadly. For example, they can refer to a fixed connection, a detachable connection, or an integral connection; they can refer to a mechanical connection or an electrical connection; they can refer to a direct connection or an indirect connection through an intermediate medium; and they can refer to the internal connection of two components. Those skilled in the art can understand the specific meaning of the above terms in the present invention according to the specific circumstances.
[0094] The present invention will be further described in detail below with reference to specific embodiments. These descriptions are for explanation purposes only and are not intended to limit the scope of the invention.
[0095] See Figures 1 to 3 This invention discloses a multi-level view comparison learning method for movie recommendation, comprising the following steps:
[0096] S1: Obtain the dataset and construct a user-project interaction graph, knowledge graph, and collaborative knowledge graph based on the dataset, specifically:
[0097] Based on user rating data for movies, define user-project interaction without interaction and user-project interaction with interaction, and construct a user-project interaction graph;
[0098] Based on movie and movie metadata information, the relationship attributes between entities are set to obtain triples containing structured knowledge of head entity-relationship-tail entity, and a knowledge graph is constructed.
[0099] By aligning user-project interaction graphs and knowledge graphs with entities and integrating them, a collaborative knowledge graph is obtained.
[0100] For example, select 6040 users and 3625 movies from the dataset. Based on the users' movie rating data of 1-5 points, define 1-3 points as no user-project interaction and mark it as 0; and define users' movie rating of 4-5 points as user-project interaction and mark it as 1. In this way, construct a user-project interaction graph.
[0101] The dataset selects projects (movies) and their metadata information (style, type, year, director, etc.) to construct a knowledge graph. Relationship attributes between entities are set to obtain triples containing structured knowledge, such as "head entity-relationship-tail entity". This knowledge graph contains a total of 79,386 entities, 12 types of relations, and 385,936 triples.
[0102] By aligning film projects to entities, the user-project interaction graph and knowledge graph are constructed into a collaborative knowledge graph containing users, film projects, and film metadata information as entities.
[0103] The dataset is derived from the MovieLens-1M dataset and includes usernames, movie names, rating data, movie metadata information, and user attribute information. The MovieLens-1M dataset contains user rating data for movies, the movie metadata information includes genre and year, and the user attribute information includes age and gender.
[0104] Preferably, the dataset is divided into a training set and a test set in an 8:2 ratio, with no overlap between the training set and the test set.
[0105] S2: Perform data augmentation on the user-item interaction graph and the knowledge graph respectively, resulting in two augmented views of the user-item interaction graph and two augmented views of the knowledge graph, denoted as KG1(G). k ) and KG2 (G k ) and User-Project Interaction Graph Data Augmentation View UI1 (G u ) and UI2 (G u Specifically:
[0106] First, a random data augmentation method is applied to the constructed knowledge graph to obtain two related augmented views, as follows:
[0107]
[0108] Among them, G k Let G be the set of the entire knowledge graph, (e,r,i)∈G k The triple representing the project's dependency, where e represents the entity, r represents the relation, and i represents the project; define the mask vector. As a probabilistic binary indicator to indicate whether a specific knowledge triple is selected during sampling, KG1(G k ) and KG2 (G k This enhances the view of the knowledge graph data; by doing so, knowledge graph subgraphs with different enhanced structural views are generated to identify items that are less sensitive to structural changes and more tolerant of noisy entity connections. These identified items are less ambiguous in features and are more helpful in capturing the preferences of relevant users.
[0109] Computational knowledge graph data augmentation view KG1(G k ) and Knowledge Graph Data Augmentation View KG2 (G k Consistency across each project ensures a consistent knowledge graph architecture. The method is as follows:
[0110] G i =s(f k (x i ,KG1(G k )),f k (xi ,KG2(G k (2)
[0111] Among them, f k This represents a relation-aware knowledge aggregation scheme used to aggregate the knowledge of item i in different augmented views KG1(G k ) and KG2 (G k Generate embedding vectors in each of the following: and s(f k (x i ,KG1(G k )),f k (x i ,KG2(G k ))) indicates that it is used for calculation and The similarity cosine function between them, C i For knowledge graph architecture consistency, if an item receives a high structural consistency score, it is less sensitive to changes in topological information. Therefore, if item i is affected by more knowledge graph noise than item i′, and i and i′ represent different items, it is likely that C... i <C i′ C i and C i′ This indicates that different projects receive different knowledge graph structure consistency scores. This knowledge graph structure consistency for each project can serve as a guide to combat knowledge graph dependencies and user-project interaction noise, and is achieved through auxiliary self-supervised signals.
[0112] Based on the consistency of the knowledge graph architecture, data augmentation is performed on the user-item interaction graph using C. i Two mask vectors are obtained For user-project interaction diagram G u ={v,ε}, the user-project interaction graph data augmentation methods are as follows:
[0113]
[0114] Based on the consistency of knowledge graph structure C i Inferred probability to discard users - Project interaction graph G u The user-item interaction records in the edge set ε are used to obtain the user-item interaction graph data augmentation view UI1(G) u ) and UI2 (G u );
[0115] Projects with higher knowledge graph structure consistency scores will involve less noise and contribute to the genuine interest of more modeling users.
[0116] S3: Represent the knowledge graph data augmentation view, the user-item interaction graph data augmentation view, and the collaborative knowledge graph separately to obtain the user and item knowledge representations of two local views and one collaborative knowledge graph, i.e., the global view, of user and item knowledge representations. Specifically:
[0117] Augmenting Knowledge Graph Data to View KG1(G k ) and KG2 (G k ) and User-Project Interaction Graph Data Augmentation View UI1 (G u ) and UI2 (G u The two partial views are recombined and denoted as (KG1(G)). k ), UI1(G u )) and (KG2(G k ), UI2(G u ));
[0118] Knowledge representations of the user and the project are constructed from the two local views, denoted as ,
[0119] The global view, i.e., the collaborative knowledge graph, is represented to obtain user and project knowledge representations of the collaborative knowledge graph. The method is as follows:
[0120] Graph neural networks are used to embed users, items, and entities from user-item interaction graphs, knowledge graphs, and collaborative knowledge graphs into low-dimensional vectors, respectively.
[0121] Relation-aware knowledge embedding is used to embed knowledge graphs into low-dimensional vectors to reflect the relational heterogeneity in the connection structure of knowledge graphs. Specifically:
[0122] Transforming the context associated with entities and relationships into a specific representation with a parameterized attention matrix addresses the limitations of manually designed path generation in knowledge graphs, across the entire knowledge graph and G... k In this process, a message aggregation mechanism is constructed between projects and their connected entities to generate knowledge-aware project embeddings based on a heterogeneous attention aggregator, as follows:
[0123]
[0124]
[0125] Where, N i Project i in Knowledge Graph G k Based on different relations r e,i The neighbor set of adjacent entities, x i and x e These are the embedded representations of items and entities, respectively, α(e,r) e,ii) is the attention relevance specific to entities and relationships estimated during the knowledge aggregation process, which encodes the different semantics of the relationships between items and entities. W is the parameterized weight matrix that represents the specific items and entities in the input. The LeakyReLU activation function is used to perform nonlinear transformations.
[0126] To further enhance the multi-relational semantic representation space of item-entity dependencies, alternative training is performed between the relation-aware aggregator and TransE. The overall idea of this translation-based knowledge graph embedding is to embed the head entity into x. h and relational embedding x r The sum should be as close as possible to the tail entity embedding x t Therefore, define f d (·) serves as an L1-norm-based similarity measurement function between embedded vectors, i.e.:
[0127] f d =||x h +x r -x t || (6)
[0128] Formally, the translation-based optimization loss function L TE As shown below:
[0129]
[0130] Among them, the negative sample t′ is obtained by randomly replacing the knowledge graph G. k It is generated from the tail entity t in the triple (h,r,t).
[0131] The LightGCN message propagation strategy is used to perform vector embedding of the indication representation of the user-item interaction graph. The specific operation is as follows:
[0132]
[0133] in, and N represents the knowledge representations of user u and item i in the propagation layer of graph l, respectively. u and N i Let i represent the set of items that interact with user u and the set of users that interact with item i, respectively.
[0134] By leveraging path-aware Generative Neural Networks (GNNs), path information is encoded into nodes within low-dimensional vectors in the collaborative knowledge graph. Neighbor information is then aggregated multiple times while retaining path information, thus completing the knowledge representation of the collaborative knowledge graph. For example: User-Interaction Item-Relationship-Entity. The formula is as follows:
[0135]
[0136] in and These are the knowledge representations of item i and entity v, respectively, and they store (l-1) of each, where (l-1) is the relation signal propagated by the previous layer of the l-th hop neighbor, thus storing the semantic information of the multi-hop path. β(i,r,v) is the attention weight, designed to weight each relation and entity, and its calculation is as follows:
[0137]
[0138] Here, || represents the concatenation operation. Let N(i) represent the set of adjacent entities N(i) and item i itself, where i represents the item, r represents the relationship, and v represents the entity.
[0139] S4: Perform local-level contrastive learning on the user and item knowledge representations of the two local views respectively to obtain the local-level contrastive loss and the optimized user and item knowledge representations of the two local views; specifically:
[0140] From the knowledge graph data augmentation view KG1(G) k ) and KG2 (G k ) and User-Project Interaction Graph Data Augmentation View UI1 (G u ) and UI2 (G u This results in two augmented data views (KG1(G)) including users, projects, and entities. k ),KG2(G k )) and (UI1(G u ),UI2(G u And construct knowledge representations for users and projects. Local-level contrastive learning is performed to supervise the learning of discriminative representations between two views. To map the knowledge representations of users and items to the space for computing contrastive loss, the knowledge representations are first fed into an MLP with one hidden layer. Specifically, for any node in one view, a positive sample is formed by the knowledge representation of the same node learned in the other view; all other node knowledge representations are defined as negative samples. To further map the knowledge representations of users and items to the space for computing contrastive loss, the knowledge representations are first fed into an MLP with one hidden layer, resulting in... and The method is as follows:
[0141]
[0142] Among them, W (2) W (1) b (1) and b (2) σ is a trainable parameter, and σ is an ELU nonlinear function.
[0143] Then the comparative loss is calculated as follows:
[0144]
[0145]
[0146] The total local contrast loss is as follows:
[0147]
[0148] Where s(·) represents the cosine similarity calculation, and τ represents the temperature parameter. This indicates the local user-contrast learning loss. This represents the local-level item-contrast learning loss, where k represents negative sample items, i represents positive sample items, and L... local The total bureau-level comparison loss is represented by N, where N represents the number of projects and M represents the number of users.
[0149] S5: Perform global comparative learning between the optimized user-project knowledge graph representation and the optimized user-project interaction graph representation, and the collaborative knowledge graph representation, to obtain the global comparative loss, the secondary optimized user-project knowledge graph representation, and the secondary optimized user-project interaction graph representation. Specifically:
[0150] The optimized user and item knowledge representations of the knowledge graph and the optimized user-item interaction graph user and item knowledge representations are compared globally with the collaborative knowledge graph user and item knowledge representations. Nodes corresponding to different views are considered positive samples, and all other nodes are considered negative samples. First, the user and item knowledge representations are mapped to a space for calculating the contrastive loss. The knowledge representations are first fed into an MLP with one hidden layer to obtain... and Specifically:
[0151]
[0152]
[0153] The comparative loss of the project is calculated as follows:
[0154]
[0155]
[0156] The user's contrast loss is calculated as follows:
[0157]
[0158]
[0159] The overall global contrast loss is calculated as follows:
[0160]
[0161] in, To obtain an optimized user knowledge representation through local-level contrastive learning. To obtain an optimized project knowledge representation through local-level contrastive learning. To facilitate collaborative knowledge graph user knowledge representation, To provide knowledge representation for collaborative knowledge graph projects. This represents the item comparison loss calculated from the global view. The item contrast loss is calculated for the partial view, where N is the number of items and M is the number of users. The user contrast loss is calculated from the global view. The user contrast loss is calculated from the partial view;
[0162] S6: Based on the local-level contrastive loss, the global-level contrastive loss, the knowledge representations of users and items in the secondary optimized local view, and the knowledge representations of users and items in the optimized global view, multi-task training is performed to build a recommendation model, specifically as follows:
[0163] After global comparative learning, multiple knowledge representations of user u are obtained, namely... and Similarly, multiple knowledge representations of project i are obtained, namely... and By summing and concatenating the above knowledge representations, the final user and item knowledge representations are obtained, and their matching scores are predicted using the inner product, as follows:
[0164]
[0165] For knowledge graph-aware recommendation tasks, pairwise BPR loss is used to reconstruct historical data, as follows:
[0166]
[0167] By combining global and local contrastive losses with BPR loss, the model parameters are learned by minimizing the following objective function, resulting in the recommendation model:
[0168]
[0169] Among them, O={(u,i,j)|(u,i)∈O + ,(u,j)∈O -} is the observed interaction O +and unobserved interactions O - The training dataset consists of σ, the sigmoid function; θ, the model parameter set; α, a hyperparameter used to determine the ratio of local to global contrastive loss; β, a hyperparameter used to control the contrastive loss; and λ, a hyperparameter used for L2 regularization. RKGMCL L represents the total loss during multi-task training. BPR The BPR loss for the recommendation task, The difference between the model's predicted score and the actual score.
[0170] S7: Use the recommendation model to obtain the user's movie recommendation list.
[0171] See Figure 4 This invention provides a multi-level view comparison learning movie recommendation system, comprising:
[0172] The data acquisition and graph construction module is used to acquire datasets and construct user-project interaction graphs, knowledge graphs, and collaborative knowledge graphs based on the datasets. The datasets are derived from the MovieLens-1 M dataset and include usernames, movie names, rating data, movie metadata information, and user attribute information.
[0173] Data Augmentation Module: Used to augment the user-project interaction graph and knowledge graph respectively, resulting in augmented views of the user-project interaction graph and knowledge graph.
[0174] The knowledge representation module is used to represent the knowledge graph data augmentation view, the user-item interaction graph data augmentation view, and the collaborative knowledge graph respectively, resulting in two local views of user and item knowledge representations and one global view of user and item knowledge representations.
[0175] Local-level contrastive learning module: This module performs local-level contrastive learning on the user and item knowledge representations of the two local views respectively, resulting in local-level contrastive loss and the optimized user and item knowledge representations of the two local views.
[0176] Global Comparative Learning Module: This module performs global-level comparative learning between the user and item knowledge representations of two optimized local views and the user and item knowledge representations of the global view, resulting in a global-level comparative loss, a second-optimized user and item knowledge representation of the local view, and an optimized user and item knowledge representation of the global view.
[0177] Model building module: used to perform multi-task training and build a recommendation model based on local-level contrastive loss, global-level contrastive loss, knowledge representations of users and items in the local view of secondary optimization, and knowledge representations of users and items in the global view of optimization;
[0178] Movie recommendation module: Used to generate a list of recommended movies for the user using a recommendation model.
[0179] This invention provides a terminal device comprising: a processor, a memory, and a computer program stored in the memory and executable on the processor. When the processor executes the computer program, it implements the steps in the various method embodiments described above. Alternatively, when the processor executes the computer program, it implements the functions of each module / unit in the various device embodiments described above.
[0180] The computer program can be divided into one or more modules / units, which are stored in the memory and executed by the processor to complete the present invention.
[0181] The terminal device may be a desktop computer, laptop, handheld computer, or cloud server, etc. The terminal device may include, but is not limited to, a processor and a memory.
[0182] The processor may be a central processing unit (CPU), or other general-purpose processors, digital signal processors (DSPs), application-specific integrated circuits (ASICs), field-programmable gate arrays (FPGAs), or other programmable logic devices, discrete gate or transistor logic devices, discrete hardware components, etc.
[0183] The memory can be used to store the computer program and / or module. The processor implements various functions of the terminal device by running or executing the computer program and / or module stored in the memory and calling the data stored in the memory.
[0184] If the modules / units integrated into the terminal device are implemented as software functional units and sold or used as independent products, they can be stored in a computer-readable storage medium. Based on this understanding, all or part of the processes in the methods of the above embodiments can also be implemented by a computer program instructing related hardware. The computer program can be stored in a computer-readable storage medium, and when executed by a processor, it can implement the steps of the various method embodiments described above. The computer program includes computer program code, which can be in the form of source code, object code, executable files, or certain intermediate forms. The computer-readable medium can include: any entity or device capable of carrying the computer program code, recording media, USB flash drives, portable hard drives, magnetic disks, optical disks, computer memory, read-only memory (ROM), random access memory (RAM), electrical carrier signals, telecommunication signals, and software distribution media, etc. It should be noted that the content included in the computer-readable medium can be appropriately added or removed according to the requirements of legislation and patent practice in the jurisdiction. For example, in some jurisdictions, according to legislation and patent practice, computer-readable media do not include electrical carrier signals and telecommunication signals.
[0185] In summary, this invention provides a multi-level view contrastive learning method, system, device, and storage medium for movie recommendation. It designs different knowledge representation learning methods based on different views, better integrating knowledge graph information into the recommendation system. Furthermore, it optimizes the knowledge representation of nodes through data augmentation and contrastive learning, exploring the enormous potential of self-supervised learning in knowledge graph-based recommendation systems and advancing research on recommendation models.
[0186] The above description is merely a preferred embodiment of the present invention and is not intended to limit the technical solution of the present invention in any way. Those skilled in the art should understand that, without departing from the spirit and principles of the present invention, the technical solution can be modified and replaced in several simple ways, and these modifications and replacements are all within the scope of protection covered by the claims.
Claims
1. A multi-level view comparison learning method for movie recommendation, characterized in that, Includes the following steps: S1: Obtain the dataset and construct a user-project interaction graph, knowledge graph, and collaborative knowledge graph based on the dataset; wherein, the dataset originates from the MovieLens-1M dataset and includes usernames, movie names, rating data, movie metadata information, and user attribute information; S2: Perform data augmentation on the user-project interaction graph and the knowledge graph respectively to obtain the data augmentation view of the user-project interaction graph and the data augmentation view of the knowledge graph; S3: Represent the knowledge graph data augmentation view, the user-item interaction graph data augmentation view, and the collaborative knowledge graph respectively to obtain the user and item knowledge representations of two local views and one global view, specifically: Enhance the view of knowledge graph data and Enhanced view of user-project interaction graph data and Recombining them yields two partial views. and ; And for the two partial views and Knowledge representation is performed to obtain the knowledge representations of the user and the project in the two partial views. ; Simultaneously, knowledge representation is performed on the collaborative knowledge graph to obtain user and project knowledge representations for a global view; Graph neural networks are used to embed users, items, and entities from user-item interaction graphs, knowledge graphs, and collaborative knowledge graphs into low-dimensional vectors, respectively. Knowledge graphs are embedded into low-dimensional vectors using relation-aware knowledge embedding, specifically as follows: Throughout the knowledge graph In this process, a message aggregation mechanism is constructed between projects and their connected entities to generate knowledge-aware project embeddings based on a heterogeneous attention aggregator, as follows: in, It is a project In knowledge graph Based on different relationships The neighbor set of adjacent entities, and These are embedded representations of projects and entities, respectively. It is an entity- and relationship-specific attention relevance estimated during the knowledge aggregation process, encoding the different semantics of the relationships between items and entities. It is a parameterized weight matrix that represents specific input items and entities, and the LeakyReLU activation function is used to perform nonlinear transformations; The knowledge representation of the user-item interaction graph is performed using vector embedding based on the message propagation strategy of LightGCN. The specific operation is as follows: in, and Representing the first Users in the graph propagation layer and projects Knowledge representation, and Respectively representing users Interactive project collections and projects A collection of interacting users; By using path-aware GNNs, the path information of the collaborative knowledge graph is encoded into nodes and embedded into low-dimensional vectors. Then, neighbor information is aggregated multiple times while retaining the path information, thus completing the knowledge representation of the collaborative knowledge graph. S4: Perform local-level contrastive learning on the user and item knowledge representations of the two local views respectively to obtain the local-level contrastive loss and the optimized user and item knowledge representations of the two local views; S5: Perform global-level comparative learning between the user and item knowledge representations of the two optimized local views and the user and item knowledge representations of the global view to obtain the global-level comparative loss, the second-optimized user and item knowledge representations of the local views, and the optimized user and item knowledge representations of the global views; S6: Based on the local-level contrastive loss, the global-level contrastive loss, the knowledge representation of users and items in the local view after secondary optimization, and the knowledge representation of users and items in the global view after optimization, perform multi-task training to build a recommendation model; S7: Use the recommendation model to obtain the user's movie recommendation list.
2. The multi-level view comparison learning movie recommendation method according to claim 1, characterized in that, The specific method for S1 is as follows: Based on user rating data for movies, define user-project interaction with no interaction and user-project interaction with interaction, and construct a user-project interaction graph; Based on the movie and movie metadata information, set the relationship attributes between entities to obtain triples containing structured knowledge of head entity-relationship-tail entity, and construct a knowledge graph; By aligning the user-project interaction graph and the knowledge graph with entities, a collaborative knowledge graph is obtained.
3. The multi-level view comparison learning movie recommendation method according to claim 1, characterized in that, The specific method for S2 is as follows: in, For the entire knowledge graph collection, The triplets to which the project belongs. Representing entities, Representative relationship, Representative project; Define mask vector As a probabilistic binary indicator, it indicates whether a specific knowledge triple is selected during sampling. and Enhance views of knowledge graph data; Computational knowledge graph data augmentation view and knowledge graph data augmented view Consistency in each project results in consistency in the knowledge graph structure. in, Represents a relation-aware knowledge aggregation scheme used for projects. In different enhanced views and Generate embedding vectors respectively and , Indicates the use of calculation and The cosine similarity function between them To ensure consistency in the knowledge graph structure; Based on the structural consistency of the knowledge graph, data augmentation is performed on the user-item interaction graph, through... Two mask vectors are obtained Used for user-project interaction diagrams The user-project interaction graph data enhancement methods are as follows: Based on the consistency of knowledge graph structure Inferred probability to discard users - Project interaction diagram edge set in From the user-project interaction records, we obtain an augmented view of the user-project interaction graph data. and .
4. The multi-level view comparison learning movie recommendation method according to claim 1, characterized in that, The specific method for S4 is as follows: For any node in one view, a positive sample is formed by the knowledge representation of the same node learned in another view; all other node knowledge representations are defined as negative samples. To map the knowledge representations of users and items to the space for calculating contrastive loss, the knowledge representations are first fed into an MLP with one hidden layer. and Then, the contrast loss is calculated as follows: The total local contrast loss is as follows: in, This indicates the calculation of cosine similarity. Indicates temperature parameter, This indicates the local user-contrast learning loss. Let represent the local-level item-versus-item learning loss, where k represents negative sample items and i represents positive sample items. The total bureau-level comparison loss is represented by N, where N represents the number of projects and M represents the number of users.
5. The multi-level view comparison learning movie recommendation method according to claim 1, characterized in that, The specific method for S5 is as follows: The optimized user and item knowledge representations of the local view are compared and learned globally with the user and item knowledge representations of the global view. The corresponding nodes in different views are regarded as positive samples, and the rest of the nodes are regarded as negative samples. The knowledge representations of users and items are mapped to a space for computing contrastive loss. The knowledge representations are first fed into an MLP with a hidden layer, resulting in... , , and The comparative loss is calculated as follows: The user's contrast loss is calculated as follows: The overall global contrast loss is calculated as follows: in, To obtain an optimized user knowledge representation through local-level contrastive learning. To obtain an optimized project knowledge representation through local-level contrastive learning. To facilitate collaborative knowledge graph user knowledge representation, To facilitate knowledge representation in collaborative knowledge graph projects. This represents the item comparison loss calculated from the global view. The item contrast loss is calculated from the partial view, where N is the number of items and M is the number of users. For user contrast loss calculated from the global view, User contrast loss calculated from a partial view.
6. The multi-level view comparison learning movie recommendation method according to claim 1, characterized in that, The specific method for S6 is as follows: The recommendation task uses the BPR loss function to reconstruct historical data, as follows: By combining global and local contrastive losses with BPR loss, the model parameters are learned by minimizing the following objective function, resulting in the recommendation model: in, It is the observed interaction and unobserved interactions The training dataset consists of It is the sigmoid function; It is the model parameter set. It is a hyperparameter used to determine the ratio of local to global contrast loss. These are hyperparameters used to control contrast loss. It is used for Hyperparameters of the regularization term, The total loss during multi-task training. The BPR loss for the recommendation task, The difference between the model's predicted score and the actual score.
7. A multi-level view comparison learning movie recommendation system, characterized in that, include: Data acquisition and map construction module; Used to acquire datasets and construct user-project interaction graphs, knowledge graphs, and collaborative knowledge graphs based on the datasets; wherein, the datasets are derived from the MovieLens-1M dataset, including usernames, movie names, rating data, movie metadata information, and user attribute information; Data Augmentation Module: Used to augment the user-project interaction graph and knowledge graph respectively, resulting in augmented views of the user-project interaction graph and knowledge graph. The knowledge representation module is used to represent the knowledge graph data augmentation view, the user-item interaction graph data augmentation view, and the collaborative knowledge graph, respectively, to obtain the user and item knowledge representations in two local views and a global view. Specifically: Enhance the view of knowledge graph data and Enhanced view of user-project interaction graph data and Recombining them yields two partial views. and ; And for the two partial views and Knowledge representation is performed to obtain the knowledge representations of the user and the project in the two partial views. ; Simultaneously, knowledge representation is performed on the collaborative knowledge graph to obtain user and project knowledge representations for a global view; Graph neural networks are used to embed users, items, and entities from user-item interaction graphs, knowledge graphs, and collaborative knowledge graphs into low-dimensional vectors, respectively. Knowledge graphs are embedded into low-dimensional vectors using relation-aware knowledge embedding, specifically as follows: Throughout the knowledge graph In this process, a message aggregation mechanism is constructed between projects and their connected entities to generate knowledge-aware project embeddings based on a heterogeneous attention aggregator, as follows: in, It is a project In knowledge graph Based on different relationships The neighbor set of adjacent entities, and These are embedded representations of projects and entities, respectively. It is an entity- and relationship-specific attention relevance estimated during the knowledge aggregation process, encoding the different semantics of the relationships between items and entities. It is a parameterized weight matrix that represents specific input items and entities, and the LeakyReLU activation function is used to perform nonlinear transformations; The knowledge representation of the user-item interaction graph is performed using vector embedding based on the message propagation strategy of LightGCN. The specific operation is as follows: in, and Representing the first Users in the graph propagation layer and projects Knowledge representation, and Respectively representing users Interactive project collections and projects A collection of interacting users; By using path-aware GNNs, the path information of the collaborative knowledge graph is encoded into nodes and embedded into low-dimensional vectors. Then, neighbor information is aggregated multiple times while retaining the path information, thus completing the knowledge representation of the collaborative knowledge graph. Local-level contrastive learning module: This module performs local-level contrastive learning on the user and item knowledge representations of the two local views respectively, resulting in local-level contrastive loss and the optimized user and item knowledge representations of the two local views. Global Comparative Learning Module: This module performs global-level comparative learning between the user and item knowledge representations of two optimized local views and the user and item knowledge representations of the global view, resulting in a global-level comparative loss, a second-optimized user and item knowledge representation of the local views, and an optimized user and item knowledge representation of the global view. Model building module: used to perform multi-task training and build a recommendation model based on local-level contrastive loss, global-level contrastive loss, knowledge representations of users and items in the local view after secondary optimization, and knowledge representations of users and items in the global view after optimization. Movie recommendation module: Used to generate a list of recommended movies for the user using a recommendation model.
8. A terminal device, comprising a memory, a processor, and a computer program stored in the memory and executable on the processor, characterized in that, When the processor executes the computer program, it implements the steps of the method as described in any one of claims 1-6.
9. A computer-readable storage medium storing a computer program, characterized in that, When the computer program is executed by a processor, it implements the steps of the method as described in any one of claims 1-6.
Citation Information
Patent Citations
Animation recommendation method and device, equipment and storage medium
CN115114522A
Multi-contrast learning recommendation method based on knowledge graph
CN116010708A