A fair recommendation algorithm based on knowledge graph

By introducing knowledge graphs and sensitive attribute filtering networks into the recommendation system, high-order paths of users and projects are extracted and user representation is optimized, and the problems of sparse user data and lack of fairness are solved, and more fair and efficient recommendation results are achieved.

CN116340595BActive Publication Date: 2025-08-29ZHEJIANG LAB
View PDF 2 Cites 0 Cited by

Patent Information

Application Number
CN202310199815.6
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2023-02-27
Publication Date
2025-08-29
Estimated Expiration
2043-02-27

AI Technical Summary

Technical Problem

The existing recommendation system has shortcomings in processing sparse and lack of fairness of user data, and cannot effectively remove the influence of user sensitive attributes, resulting in unfair recommendation results.

Method used

Using the knowledge graph to extract higher-order paths between users and projects, filter sensitive attributes in user representations through sensitive attribute filter networks, combine cyclic attention neural networks and adversarial training to optimize user and project representations to achieve fair recommendations.

Benefits of technology

It improves the fairness of the recommendation system, alleviates the problem of user data sparseness, and maintains recommendation performance, which can effectively remove the influence of sensitive factors such as user gender and age.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN116340595B_ABST
    Figure CN116340595B_ABST
Patent Text Reader

Abstract

A fair recommendation algorithm based on a knowledge graph comprises the following steps: step 1, constructing a knowledge graph; step 2, merging the knowledge graph with a user-project interaction graph to form a user-project knowledge graph, wherein the user-project knowledge graph is the user input; step 3, extracting the user-project path from the user-project knowledge graph; step 4, inputting the path information into a recurrent attention neural network to model the user's representation; step 5, filtering out sensitive attributes in the user representation through a sensitive attribute filtering network; step 6, obtaining the final representation and calculating the loss function; step 7, determining whether a set number of training times has been reached; step 8, terminating the training and using the trained model to generate fair recommended items for the user. The present invention can achieve fair recommendation of user items, alleviate the problem of user data, and effectively remove the influence of user sensitive attributes on recommendations, playing an important role in the field of recommendation methods.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present invention belongs to the technical field of recommendation algorithm application, and relates to a fairness recommendation algorithm based on knowledge graph. Background Art

[0002] The success of recommender systems has led to their ubiquity in online applications such as search engines, e-commerce, social media sites, and news portals. Nearly every service providing content to users is equipped with a recommender system. Recommender systems predict user preferences based on user behavior. While traditional collaborative filtering-based recommendation algorithms are effective and versatile, they fail to model side information such as item attributes, user profiles, and context, and therefore perform poorly in sparse scenarios where user-item interactions are rare. In recent years, the introduction of knowledge graphs into recommender systems has attracted increasing attention. Knowledge graphs are heterogeneous networks that contain a vast amount of real-world knowledge. In a graph, nodes represent entities, and edges represent relationships between entities. By mining internal connections in a knowledge graph, high-order connectivity information between users and items can be extracted. Paths between users and items can provide rich complementary information to their sparse interaction data. Path information also contains a wealth of semantic information about entities and relationships, enabling more effective modeling of user representations.

[0003] As recommendation systems develop, users are placing higher demands on them. Fairness has long been an overlooked issue. For example, some users are sensitive to gender and would prefer that recommendation systems disregard gender when making recommendations. For example, if women typically purchase pink clothing, the recommendation system will be trained to recommend more pink clothing to women and fewer pink clothing to men. This recommendation result is unfair to women who prefer other colors and men who prefer pink. Furthermore, other factors such as age and occupation can also be sensitive factors when using recommendation systems. Therefore, a fair recommendation system is crucial for improving the user experience. Existing fairness algorithms primarily focus on group fairness, emphasizing that recommendation metrics should be similar across different groups. These algorithms fail to effectively remove the influence of user-sensitive attributes in recommendation systems. Furthermore, removing user-sensitive attributes essentially loses some user data. Therefore, maintaining recommendation performance while removing user data remains a challenge. Summary of the Invention

[0004] The purpose of this invention is to achieve fair recommendation for user projects and solve the problem of sparse user data faced by existing recommendation methods. A fair recommendation algorithm based on knowledge graph is proposed, which can achieve fair recommendation for user projects, alleviate the problem of user data, and at the same time can effectively remove the influence of user sensitive attributes on recommendations, which plays an important role in the field of recommendation methods.

[0005] The technical key of this invention lies in using the knowledge graph to extract high-order paths between users and items to further enrich the user representation; then filtering the sensitive attributes corresponding to the user through the sensitive attribute filtering network, and finally obtaining the optimized user and item representation through multiple iterations, thereby achieving fair recommendations.

[0006] A fairness recommendation algorithm based on knowledge graph, characterized by comprising the following steps:

[0007] Step 1: Build a knowledge graph;

[0008] Step 2: Merge the knowledge graph and the user-project interaction graph to form a user-project knowledge graph, which is the user's input;

[0009] Step 3: Extract the user-project path from the user-project knowledge graph;

[0010] Step 4: Input the path information into the recurrent attention neural network to model the user’s representation;

[0011] Step 5: Filter out sensitive attributes in the user representation through the sensitive attribute filtering network;

[0012] Step 6: Get the final representation and calculate the loss function;

[0013] Step 7: Determine whether the set number of training times has been reached;

[0014] Step 8: End the training and use the trained model to generate fair recommended items for users.

[0015] Furthermore, step 2 specifically includes: first matching the items in the user-item interaction graph with the entities in the knowledge graph, and then merging all triples directly related to the matched entities with the user-item interaction graph to finally form the user-item knowledge graph.

[0016] Furthermore, step 3 specifically includes: for each user-item interaction (u, i), the present invention uses a deep search algorithm to extract multiple paths with u as the starting node and i as the ending node in the user-item knowledge graph, which meet different length values, to form a path set P(u, i) = {p1, p2, ... p n}.

[0017] Furthermore, step 4 specifically includes: for a path p={e1, r1, e2, r2, ..., e m}, entity embedding e j , the corresponding entity category embedding et j and relation category embedding r j combination of As the input unit of the recurrent attention neural network; fill an empty relation after the last entity. The input unit contains not only sequence information, but also semantic information due to the introduction of relation embedding; get the embedding {x1, x2, ..., x} corresponding to the path p m The update formula of the recurrent attention neural network step l is as follows:

[0018] h l =LSTM(h l-1 , x k ), (1)

[0019] In formula (1), represents the output of the recurrent attention neural network at step l-1, d is the dimension of the hidden state of the recurrent attention neural network; at the same time, considering that the hidden layer output of each step of the recurrent attention neural network is consistent with the final output of the hidden layer h L The attention mechanism is used to calculate the hidden layer output H = {h1, h2, ...h L For h L The contribution of , to generate the final path representation s:

[0020]

[0021]

[0022] s=[s′,h L ], (4)

[0023] Among them, σ represents the activation function, att l,L Represents the hidden layer output h l For the final output of the hidden layer h L For each user-item interaction pair (u, i) corresponding to the path set, the set of all path corresponding representations S(u, i) = {s1, s2, ...s n}; Then, all the project paths of the user interaction can be merged to obtain the path set S(u) corresponding to the user = {s1, s2, ...s N Considering that different user paths contribute differently to user representation, the self-attention mechanism is used to calculate the contribution of different paths and generate the final user representation S u :

[0024] Q=W Q S(u), (5)

[0025] K=W K S(u), (6)

[0026] V=W V S(u), (7)

[0027]

[0028] Among them, in formulas (5)-(7), W Q 、W K and Represents a trainable parameter matrix.

[0029] Furthermore, step 5 specifically includes: introducing a sensitive attribute filtering network so that the user's sensitive attributes are independent of the user embedding; the sensitive attribute filtering network is composed of multiple fully connected networks; the sensitive attribute filtering network can selectively filter out sensitive attributes, and for the jth sensitive attribute, its corresponding filtering network is defined as f j , by f j Training can filter out the corresponding sensitive attributes; at the same time, by combining the filtering networks corresponding to different sensitive attributes, multiple sensitive attributes can be selectively removed for the user. The user representation S′ obtained by the M-type attribute combination filtering network u as follows:

[0030]

[0031] During training, binary masks are sampled from all sets of sensitive attributes to determine the sensitive attribute combinations to be removed during each iteration. The binary mask sampling distribution can be set to a Bernoulli distribution or a specific distribution for other applications. The training method of randomly sampling binary masks to determine the sensitive attribute combinations can be generalized to uncommon sensitive attribute combinations during inference.

[0032] Furthermore, step 6 specifically includes: in order to train the sensitive attribute filtering network, a set of discriminators are trained using the adversarial training method. For the jth sensitive attribute, the corresponding discriminator is trained to try to predict its corresponding sensitive attribute z from the user embedding. j The goal of the sensitive attribute filtering network is to make it difficult for the discriminator network to predict sensitive attributes from user embeddings, while the goal of the discriminator network is to make the sensitive attribute filtering network ineffective. The two goals will be optimized together during the training process. The loss function of the recommendation task is defined as Select the pairwise ranking function or the mean square error function according to the recommendation task; at the same time, the discriminator loss function is defined as Select cross entropy function; overall loss function The definition is as follows:

[0033]

[0034] Among them, λ is a hyperparameter used to balance the recommendation performance and fairness performance; in the adversarial training process, batch training data is input into the model to obtain and The parameters of the discriminator network are then fixed to minimize the loss function Then the parameters of the recurrent attention neural network and the sensitive attribute filtering network are fixed to minimize the loss

[0035] Furthermore, step 7 specifically includes:

[0036] Step 7.1: If the set number of iterations is reached, proceed to step 8;

[0037] In step 7.2, if the set number of iterations has not been reached, execute step 4.

[0038] The present invention also includes a fairness recommendation device based on a knowledge graph, comprising:

[0039] Knowledge graph construction module, used to build knowledge graph;

[0040] The user-project knowledge graph construction module is used to merge the knowledge graph and the user-project interaction graph to form the user-project knowledge graph. The user-project knowledge graph is the user's input;

[0041] User-project path extraction module, used to extract user-project paths from the user-project knowledge graph;

[0042] User representation modeling module, used to input path information into the recurrent attention neural network to model the user's representation;

[0043] Sensitive attribute filtering module, used to filter out sensitive attributes in user representations through a sensitive attribute filtering network;

[0044] The loss function representation module is used to obtain the final representation of the loss function;

[0045] The training times judgment module is used to judge whether the set training times have been reached;

[0046] The fair recommendation item generation module is used to generate fair recommendation items for users using the trained model at the end of training.

[0047] A fairness recommendation device based on a knowledge graph of the present invention includes: a memory and one or more processors, wherein the memory stores executable code, and when the one or more processors execute the executable code, it is used for a fairness recommendation algorithm based on a knowledge graph of the present invention.

[0048] The present invention also includes a computer-readable storage medium on which a program is stored. When the program is executed by a processor, a fairness recommendation algorithm based on a knowledge graph of the present invention is implemented.

[0049] The present invention uses the path information between users and items in the knowledge graph as auxiliary information for user representation. It then uses a sensitive attribute detection framework to model fair user representations in an end-to-end manner, achieving fair recommendations. The sensitive attribute filtering framework can effectively filter sensitive attributes in user information, thereby reducing the impact of sensitive factors such as user gender and age on recommendation results. Finally, through multiple iterations, optimized user and item representations are obtained, thereby achieving fair recommendations. With respect to the prior art, the present invention considers the issues of user data sparsity and lack of fairness faced by traditional recommendation methods. The sparsity of user data is reflected in the fact that the data only contains direct interaction information between users and items. Therefore, the present invention introduces a knowledge graph to alleviate the sparsity of user data by extracting path information between users and items in the graph. The lack of fairness is reflected in the fact that existing recommendation models do not consider the impact of removing sensitive attributes such as gender and age in user representations on recommendation results. Therefore, the present invention designs a sensitive attribute filtering framework to remove sensitive attributes from user representations while maintaining recommendation performance, thereby improving the fairness of recommendations.

[0050] The beneficial effects of the present invention are:

[0051] This paper addresses the user data sparsity and lack of fairness issues inherent in recommendation methods and proposes a fair recommendation algorithm based on a knowledge graph. This algorithm addresses the user data sparsity issue by extracting user paths from the knowledge graph. A sensitive attribute filtering network is utilized to effectively remove sensitive attributes from user representations. The proposed method can effectively improve recommendation fairness and, with appropriate improvements, can be extended to a variety of recommendation tasks, demonstrating promising application prospects in the recommendation field. BRIEF DESCRIPTION OF THE DRAWINGS

[0052] Figure 1 This is a schematic diagram of the execution flow of a fairness recommendation algorithm based on knowledge graph proposed in an embodiment of the present invention.

[0053] Figure 2 This is a structural diagram of a fairness recommendation device based on knowledge graph proposed in an embodiment of the present invention.

[0054] Figure 3It is an example diagram of the user-project knowledge graph proposed in an embodiment of the present invention.

[0055] Figure 4 It is a structural diagram of the user representation modeling module proposed in an embodiment of the present invention.

[0056] Figure 5 This is a structural diagram of the sensitive attribute filtering module proposed in an embodiment of the present invention. DETAILED DESCRIPTION

[0057] The following will clearly and completely describe the technical solutions in the embodiments of the present invention in conjunction with the accompanying drawings. Obviously, the described embodiments are only part of the embodiments of the present invention, not all of the embodiments. Based on the embodiments of the present invention, all other embodiments obtained by ordinary technicians in this field without making creative efforts are within the scope of protection of the present invention.

[0058] It should be noted that, unless there is any conflict, the features in the following embodiments and implementations may be combined with each other.

[0059] Figure 1 The present invention provides a user movie recommendation method based on a fairness recommendation algorithm of a knowledge graph, which includes the following steps:

[0060] Step 1: Build a knowledge graph. Specifically, we use the open source Freebase knowledge graph as the knowledge graph for this application. The nodes in the knowledge graph represent entities, and the edges in the graph represent relationships. The knowledge graph is defined as

[0061] Step 2: Merge the knowledge graph and the user-movie interaction graph to form the user-movie knowledge graph. Specifically, we use the user's movie watching records to form the user-movie interaction graph. Here, the user-movie interaction graph is defined as G1 = {(u, y ui , i)|u∈U, i∈I)}, U and I represent the set of users and the set of movies respectively, y ui =1 means user u watched movie i; otherwise y ui = 0. The present invention first matches the movies in the user-movie interaction graph with the entities in the knowledge graph, and then merges all triples directly related to the matched entities with the user-movie interaction graph to finally form the user-movie knowledge graph; the user-movie knowledge graph is defined as in

[0062] Step 3: Extract the paths connecting users and movies from the user movie knowledge graph. Specifically, for each movie i watched by user u, the present invention uses a deep search algorithm to extract multiple paths with u as the starting node and i as the ending node in the user movie knowledge graph, which meet different length values, to form a path set P(u, i) = {p1, p2, ... p n}.

[0063] Step 4: Input the path information into the recurrent attention neural network to model the user's representation. Specifically, for a path p = {e1, r1, e2, r2, ..., e m}, entity embedding e j , the corresponding entity category embedding et j and relation category embedding r j combination of As the input unit of the recurrent attention neural network. For the last entity, an empty relation will be filled in after it. The input unit contains not only sequence information, but also semantic information due to the introduction of relation embedding. The path p corresponding to the embedding {x1, x2, ..., x m The update formula of the recurrent attention neural network in step 1 is as follows:

[0064] h l =LSTM(h l-1 , x k ), (1)

[0065] In formula (1), represents the output of the recurrent attention neural network at step l-1, d is the dimension of the hidden state of the recurrent attention neural network. At the same time, considering that the hidden layer output of each step of the recurrent attention neural network is consistent with the final output of the hidden layer h L The present invention uses the attention mechanism to calculate the hidden layer output H = {h1, h2, ... h L For h L The contribution of , to generate the final path representation s:

[0066]

[0067]

[0068] s=[s′,h L ], (4)

[0069] Among them, σ represents the activation function, att l,L Represents the hidden layer output h l For the final output of the hidden layer h LFor each user-movie interaction pair (u, i) corresponding to the path set, through formulas (1)-(4) we can get the set of all path corresponding representations S(u, i) = {s1, s2, ...s n Then, we can merge the path representations of all movies watched by the user to obtain the path set S(u) corresponding to the user = {s1, s2, ...s N Considering that different user paths contribute to different degrees of user representation, the present invention uses a self-attention mechanism to calculate the contribution of different paths and generate the final user representation S u :

[0070] Q=W Q S(u), (5)

[0071] K=W K S(u), (6)

[0072] V=W V S(u), (7)

[0073]

[0074] Among them, in formulas (5)-(7), W Q 、W K and Represents a trainable parameter matrix.

[0075] Step 5: Filter out the sensitive attribute of gender in the user representation through the sensitive attribute filtering network. The present invention hopes that the recommendation made by the model does not depend on the gender of the user. Therefore, the present invention introduces a filtering network to make the gender of the user independent of the user embedding. Here, the gender filtering network can be composed of a fully connected network. For the gender attribute, its corresponding filtering network is defined as f, and the gender attribute can be filtered out by training f. At the same time, it can be further expanded. By combining the filtering networks corresponding to different sensitive attributes, multiple sensitive attributes can be selectively removed for the user. The user representation S′ obtained by the M-type attribute combination filtering network u as follows:

[0076]

[0077] During training, a binary mask can be sampled from all sensitive attribute sets to determine which sensitive attribute combinations to remove during each iteration. The binary mask sampling distribution can be set to a Bernoulli distribution or a specific distribution for other applications. This training approach of randomly sampling binary masks to determine sensitive attribute combinations makes it easy to generalize to uncommon sensitive attribute combinations during inference.

[0078] Step 6: Get the final representation and calculate the loss function. In order to train the sensitive attribute filtering network, the present invention uses the adversarial training method to train a set of discriminators. For the jth sensitive attribute, the corresponding discriminator is trained to try to predict its corresponding sensitive attribute z from the user embedding. j The goal of the sensitive attribute filtering network is to make it difficult for the discriminator network to predict sensitive attributes from user embeddings, while the goal of the discriminator network is to make the sensitive attribute filtering network ineffective. The above two goals will be optimized together during the training process. The loss function of the recommendation task is defined as You can choose a pairwise ranking function or a mean square error function based on the recommendation task. At the same time, the discriminator loss function is defined as Here we choose the cross entropy function. The overall loss function The definition is as follows:

[0079]

[0080] Among them, λ is a hyperparameter used to balance the recommendation performance and fairness performance. In the adversarial training process, batches of training data are input into the model to obtain and The parameters of the discriminator network are then fixed to minimize the loss function Then the parameters of the recurrent attention neural network and the sensitive attribute filtering network are fixed to minimize the loss

[0081] Step 7: Determine whether the set number of training times has been reached;

[0082] Step 7.1: If the set number of iterations is reached, proceed to step 8;

[0083] Step 7.2: If the set number of iterations has not been reached, execute step 4;

[0084] Step 8: End the training and get the trained model;

[0085] Step 9: Input user features into the trained recommendation model to achieve fair movie recommendations for users. When a new user node or a new movie node is required, this application will add the new user node or movie node to the existing graph structure and fine-tune the existing trained model to obtain new user and movie representations to provide fair movie recommendations for new users.

[0086] Figure 2 The present invention shows a fairness recommendation device based on knowledge graph, including:

[0087] Knowledge graph construction module, used to build knowledge graph;

[0088] The user-project knowledge graph construction module is used to merge the knowledge graph and the user-project interaction graph to form the user-project knowledge graph. The user-project knowledge graph is the user's input;

[0089] User-project path extraction module, used to extract user-project paths from the user-project knowledge graph;

[0090] User representation modeling module, used to input path information into the recurrent attention neural network to model the user's representation;

[0091] Sensitive attribute filtering module, used to filter out sensitive attributes in user representations through a sensitive attribute filtering network;

[0092] The loss function representation module is used to obtain the final representation of the loss function;

[0093] The training times judgment module is used to judge whether the set training times have been reached;

[0094] The fair recommendation item generation module is used to generate fair recommendation items for users using the trained model at the end of training.

[0095] A fairness recommendation device based on a knowledge graph of the present invention includes: a memory and one or more processors, wherein the memory stores executable code, and when the one or more processors execute the executable code, it is used for a fairness recommendation algorithm based on a knowledge graph of the present invention.

[0096] The present invention also includes a computer-readable storage medium on which a program is stored. When the program is executed by a processor, a fairness recommendation algorithm based on a knowledge graph of the present invention is implemented.

[0097] like Figure 2 As mentioned above, at the hardware level, the sparse knowledge graph embedding device based on meta-learning includes a processor, an internal bus, a network interface, a memory, and a non-volatile memory, and may also include other hardware required for the business. The processor reads the corresponding computer program from the non-volatile memory into the memory and then runs it to achieve the above Figure 1 Of course, in addition to software implementation, the present invention does not exclude other implementation methods, such as logic devices or a combination of software and hardware, etc., that is, the execution subject of the following processing flow is not limited to each logic unit, but can also be hardware or logic devices.

[0098] Improvements to a technology can be clearly distinguished as either hardware improvements (for example, improvements to circuit structures such as diodes, transistors, and switches) or software improvements (improvements to process flows). However, with technological advancements, many process flow improvements today can now be considered direct improvements to hardware circuit structures. Designers almost always program the improved process flow into the hardware circuit to obtain the corresponding hardware circuit structure. Therefore, it cannot be said that a process flow improvement cannot be implemented using a hardware module. For example, a programmable logic device (PLD), such as a field programmable gate array (FPGA), is an integrated circuit whose logical function is determined by user programming. Designers can "integrate" a digital system on a PLD by programming it themselves, without having to hire a chip manufacturer to design and manufacture a dedicated integrated circuit chip. Moreover, nowadays, instead of manually manufacturing integrated circuit chips, this programming is mostly done using "logic compiler" software. This is similar to the software compiler used when developing programs. Before compilation, the original code must also be written in a specific programming language, called a hardware description language (HDL). There is not just one HDL, but many, such as ABEL (Advanced Boolean Expression Language), AHDL (Altera Hardware Description Language), Confluence, CUPL (Cornell University Programming Language), HDCal, JHDL (Java Hardware Description Language), Lava, Lola, MyHDL, PALASM, RHDL (Ruby Hardware Description Language), etc. The most commonly used ones are VHDL (Very-High-Speed ​​Integrated Circuit Hardware Description Language) and Verilog. Those skilled in the art will also understand that by simply programming the method flow in one of these hardware description languages ​​and then programming it into an integrated circuit, a hardware circuit that implements the logic method flow can be easily obtained.

[0099] The controller can be implemented in any suitable manner. For example, the controller can take the form of a microprocessor or processor and a computer-readable medium storing computer-readable program code (e.g., software or firmware) executable by the (micro)processor, logic gates, switches, application-specific integrated circuits (ASICs), programmable logic controllers, and embedded microcontrollers. Examples of controllers include, but are not limited to, the following microcontrollers: ARC 625D, Atmel AT91SAM, Microchip PIC18F26K20, and Silicone Labs C8051F320. The memory controller can also be implemented as part of the control logic of the memory. Those skilled in the art will also know that in addition to implementing the controller in a purely computer-readable program code format, the controller can be implemented in the form of logic gates, switches, application-specific integrated circuits, programmable logic controllers, and embedded microcontrollers by logically programming the method steps. Therefore, such a controller can be considered a hardware component, and the devices included therein for implementing various functions can also be considered as structures within the hardware component. Or even, the devices for implementing various functions can be considered as both software modules that implement the method and structures within the hardware component.

[0100] The systems, devices, modules, or units described in the above embodiments may be implemented by computer chips or entities, or by products having certain functions. A typical implementation device is a computer. Specifically, the computer may be, for example, a personal computer, a laptop computer, a cellular phone, a camera phone, a smartphone, a personal digital assistant, a media player, a navigation device, an email device, a game console, a tablet computer, a wearable device, or a combination of any of these devices.

[0101] For the convenience of description, the above device is described as being divided into various units according to their functions. Of course, when implementing the present invention, the functions of each unit can be implemented in the same or multiple software and / or hardware.

[0102] It will be understood by those skilled in the art that embodiments of the present invention may be provided as methods, systems, or computer program products. Thus, the present invention may take the form of an entirely hardware embodiment, an entirely software embodiment, or an embodiment combining software and hardware. Furthermore, the present invention may take the form of a computer program product implemented on one or more computer-usable storage media (including but not limited to magnetic disk storage, CD-ROM, optical storage, etc.) containing computer-usable program code.

[0103] The present invention is described with reference to flowcharts and / or block diagrams of methods, devices (systems), and computer program products according to embodiments of the present invention. It should be understood that each process and / or block in the flowcharts and / or block diagrams, as well as combinations of processes and / or blocks in the flowcharts and / or block diagrams, can be implemented by computer program instructions. These computer program instructions can be provided to a processor of a general-purpose computer, a special-purpose computer, an embedded processor, or other programmable data processing device to produce a machine, so that the instructions executed by the processor of the computer or other programmable data processing device generate instructions for implementing the processes in the flowcharts and / or block diagrams. Figure 1 a process or multiple processes and / or boxes Figure 1 A device that provides the functions specified in a block or multiple blocks.

[0104] These computer program instructions may also be stored in a computer readable memory that can direct a computer or other programmable data processing device to work in a specific manner, so that the instructions stored in the computer readable memory produce an article of manufacture comprising an instruction device, which implements the process Figure 1 a process or multiple processes and / or boxes Figure 1 The function specified in one or more boxes.

[0105] These computer program instructions can also be loaded onto a computer or other programmable data processing device so that a series of operational steps are executed on the computer or other programmable device to produce a computer-implemented process, thereby providing the instructions executed on the computer or other programmable device for implementing the process. Figure 1 a process or multiple processes and / or boxes Figure 1 A step that specifies a function in one or more boxes.

[0106] In a typical configuration, a computing device includes one or more processors (CPUs), input / output interfaces, network interfaces, and memory.

[0107] Memory may include non-permanent storage in a computer-readable medium, random access memory (RAM) and / or non-volatile memory in the form of read-only memory (ROM) or flash RAM. Memory is an example of a computer-readable medium.

[0108] Computer-readable media includes permanent and non-permanent, removable and non-removable media that can be implemented by any method or technology to store information. The information can be computer-readable instructions, data structures, program modules or other data. Examples of computer storage media include, but are not limited to, phase change memory (PRAM), static random access memory (SRAM), dynamic random access memory (DRAM), other types of random access memory (RAM), read-only memory (ROM), electrically erasable programmable read-only memory (EEPROM), flash memory or other memory technology, compact disc read-only memory (CD-ROM), digital versatile disc (DVD) or other optical storage, magnetic cassettes, magnetic tape, magnetic disk storage or other magnetic storage devices or any other non-transmission media that can be used to store information that can be accessed by a computing device. As defined herein, computer-readable media does not include transitory computer-readable media (transitory media), such as modulated data signals and carrier waves.

[0109] It should also be noted that the terms "comprises," "includes," or any other variations thereof are intended to encompass non-exclusive inclusion, such that a process, method, commodity, or apparatus that includes a series of elements includes not only those elements but also other elements not explicitly listed, or includes elements inherent to such process, method, commodity, or apparatus. In the absence of further limitations, an element defined by the phrase "comprises a ..." does not exclude the presence of other identical elements in the process, method, commodity, or apparatus that includes the element.

[0110] Those skilled in the art will appreciate that embodiments of the present invention may be provided as methods, systems, or computer program products. Thus, the present invention may take the form of an entirely hardware embodiment, an entirely software embodiment, or an embodiment combining software and hardware aspects. Furthermore, the present invention may take the form of a computer program product implemented on one or more computer-usable storage media (including but not limited to magnetic disk storage, CD-ROM, optical storage, etc.) containing computer-usable program code.

[0111] The present invention may be described in the general context of computer-executable instructions, such as program modules, executed by a computer. Generally, program modules include routines, programs, objects, components, data structures, and the like that perform specific tasks or implement specific abstract data types. The present invention may also be practiced in distributed computing environments where tasks are performed by remote processing devices connected via a communications network. In a distributed computing environment, program modules may be located in both local and remote computer storage media, including storage devices.

[0112] The various embodiments of the present invention are described in a progressive manner. Similar portions between the various embodiments can be referred to in conjunction with each other. Each embodiment focuses on the differences between the other embodiments. In particular, the system embodiment is generally similar to the method embodiment, so its description is relatively simple. For relevant portions, refer to the description of the method embodiment.

[0113] The specific embodiments described above further illustrate the objectives, technical solutions and beneficial effects of the present invention in detail. It should be understood that the above are only specific embodiments of the present invention and are not intended to limit the present invention. Any modifications, equivalent substitutions, improvements, etc. made within the spirit and principles of the present invention should be included in the scope of protection of the present invention.

Claims

1. A fair recommendation algorithm based on knowledge graph, characterized by: The following steps are involved: Step 1: Build a knowledge graph; Step 2: Merge the knowledge graph and the user-project interaction graph to form a user-project knowledge graph, which is the user's input; Step 3: Extract the user-project path from the user-project knowledge graph; Step 4: Input the path information into the recurrent attention neural network to model the user's representation; Including: For a path p={e1,r1,e2,r2,…,e m }, entity embedding e j , the corresponding entity category embedding et j and relation category embedding r j combination of As the input unit of the recurrent attention neural network; fill an empty relation after the last entity. The input unit contains not only sequence information, but also semantic information due to the introduction of relation embedding; get the embedding {x1,x2,…,x m The update formula of the recurrent attention neural network step l is as follows: h l =LSTM(h l-1 ,x k ), (1) In formula (1), represents the output of the recurrent attention neural network at step l-1, d is the dimension of the hidden state of the recurrent attention neural network; at the same time, considering that the hidden layer output of each step of the recurrent attention neural network is consistent with the final output of the hidden layer h L The attention mechanism is used to calculate the hidden layer output H = {h1,h2,…h L For h L The contribution of , to generate the final path representation s: s=[s′,h L ], (4) Among them, σ represents the activation function, att l,L Represents the hidden layer output h l For the final output of the hidden layer h L For each user-item interaction pair (u,i), the set of paths corresponding to each path can be obtained by formulas (1)-(4): S(u,i)={s1,s2,…s n }; then merge all the project path representations of the user interaction to obtain the path set S(u) corresponding to the user = {s1, s2, ...s N Considering that different user paths contribute differently to user representation, the self-attention mechanism is used to calculate the contribution of different paths and generate the final user representation S u : Q=W Q S(u), (5) K=W K S(u), (6) V=W V S(u), (7) Among them, in formulas (5)-(7), W Q 、W K and Represents a trainable parameter matrix; Step 5: Filter out sensitive attributes in the user representation through the sensitive attribute filtering network; Step 6: Get the final representation and calculate the loss function; Step 7: Determine whether the set number of training times has been reached; Step 8: End the training and use the trained model to generate fair recommended items for users.

2. The fairness recommendation algorithm based on knowledge graph according to claim 1, characterized in that: Step 2 specifically includes: first matching the items in the user-item interaction graph with the entities in the knowledge graph, then merging all triples directly related to the matched entities with the user-item interaction graph, and finally forming the user-item knowledge graph.

3. The fairness recommendation algorithm based on knowledge graph according to claim 1, characterized in that: Step 3 specifically includes: for each user-item interaction (u, i), the present invention uses a deep search algorithm to extract multiple paths with u as the starting node and i as the ending node in the user-item knowledge graph, which meet different length values, to form a path set P(u, i) = {p1, p2, ... p n }.

4. The fairness recommendation algorithm based on knowledge graph according to claim 1, characterized in that: Step 5 specifically includes: introducing a sensitive attribute filtering network so that the user's sensitive attributes are independent of the user embedding; the sensitive attribute filtering network is composed of multiple fully connected networks; the sensitive attribute filtering network can selectively filter out sensitive attributes, and for the jth sensitive attribute, its corresponding filtering network is defined as f j , by f j Training can filter out the corresponding sensitive attributes; at the same time, by combining the filtering networks corresponding to different sensitive attributes, multiple sensitive attributes can be selectively removed for users. The user representation S′ obtained by the M-type attribute combination filtering network u as follows: During training, binary masks are sampled from all sets of sensitive attributes to determine the sensitive attribute combinations to be removed during each iteration. The binary mask sampling distribution can be set to a Bernoulli distribution or a specific distribution for other applications. The training method of randomly sampling binary masks to determine the sensitive attribute combinations can be generalized to uncommon sensitive attribute combinations during inference.

5. The fairness recommendation algorithm based on knowledge graph according to claim 1, characterized in that: Step 6 specifically includes: In order to train the sensitive attribute filtering network, a set of discriminators are trained using the adversarial training method. For the jth sensitive attribute, the corresponding discriminator is trained to try to predict its corresponding sensitive attribute z from the user embedding. j The goal of the sensitive attribute filtering network is to make it difficult for the discriminator network to predict sensitive attributes from user embeddings, while the goal of the discriminator network is to make the sensitive attribute filtering network ineffective. The two goals will be optimized together during the training process. The loss function of the recommendation task is defined as Select the pairwise ranking function or the mean square error function according to the recommendation task; at the same time, the discriminator loss function is defined as Select cross entropy function; overall loss function The definition is as follows: Among them, λ is a hyperparameter used to balance the recommendation performance and fairness performance; in the adversarial training process, batch training data is input into the model to obtain and The parameters of the discriminator network are then fixed to minimize the loss function Then the parameters of the recurrent attention neural network and the sensitive attribute filtering network are fixed to minimize the loss 6. The fairness recommendation algorithm based on knowledge graph according to claim 1, characterized in that: Step 7 specifically includes: Step 7.1: If the set number of iterations is reached, proceed to step 8; In step 7.2, if the set number of iterations has not been reached, execute step 4.

7. A fairness recommendation device based on a knowledge graph, used to implement a fairness recommendation algorithm based on a knowledge graph according to any one of claims 1 to 6, characterized in that: include: Knowledge graph construction module, used to build knowledge graph; The user-project knowledge graph construction module is used to merge the knowledge graph and the user-project interaction graph to form the user-project knowledge graph. The user-project knowledge graph is the user's input; User-project path extraction module, used to extract user-project paths from the user-project knowledge graph; User representation modeling module, used to input path information into the recurrent attention neural network to model the user's representation; Sensitive attribute filtering module, used to filter out sensitive attributes in user representations through a sensitive attribute filtering network; The loss function representation module is used to obtain the final representation of the loss function; The training times judgment module is used to judge whether the set training times have been reached; The fair recommendation item generation module is used to generate fair recommendation items for users using the trained model at the end of training.

8. A fairness recommendation device based on knowledge graph, characterized in that: include: A memory and one or more processors, wherein the memory stores executable code, and when the one or more processors execute the executable code, they are used to implement a fairness recommendation algorithm based on a knowledge graph as described in any one of claims 1 to 6.

9. A computer-readable storage medium, characterized in that A program is stored thereon, and when the program is executed by a processor, it implements a fairness recommendation algorithm based on a knowledge graph as described in any one of claims 1-6.

Citation Information

Patent Citations

  • Music recommendation method and system based on knowledge graph

    CN113032618A

  • Data information recommendation method and device based on hierarchical attention map neural network

    CN114637923A