Session recommendation method and device, equipment and storage medium
By constructing historical sessions as hypergraphs and single sessions as session graphs, using deep learning models to generate multi-view session representations, the problem of inability to distinguish the importance of semantic information to projects in the prior art is solved, and a more comprehensive user interest representation and session recommendation effects are achieved.
Patent Information
- Application Number
- CN202411849035.2
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2024-12-13
- Publication Date
- 2025-05-30
AI Technical Summary
The prior art cannot effectively distinguish the importance of different semantic information to the project in session recommendations, resulting in the inability to fully represent the user's global and local interests at different moments.
By constructing historical sessions and individual sessions into hypergraphs and session graphs, the hypergraph convolutional network and graph attention network are used to generate the first session representation from the hypergraph perspective and the second session representation from the session graph perspective respectively, and the fusion process is performed to generate the target session representation for session recommendation.
The sparsity of the session graph in the prior art is significantly improved, the feature representation of the central node is enriched, and the global and local interests of the user at different moments can be more comprehensively expressed, thereby improving the accuracy of session recommendations.
Smart Images

Figure CN120067429A_ABST
Abstract
Description
Technical Field
[0001] The embodiments of the present application relate to the field of network security technology, and in particular, to a session recommendation method, apparatus, device, and storage medium. Background Art
[0002] Traditional personalized recommendation technologies can be divided into content-based recommendation technologies and collaborative filtering-based recommendation technologies. They often need to use users' personal information, which is very likely to touch on users' personal privacy and there are risks in terms of privacy security. Session recommendation mainly utilizes information such as session ID, item ID, item attributes, timestamp, etc., and does not include user ID. Therefore, to a certain extent, users' privacy is protected. With the development of deep learning, the existing technologies mainly use recurrent neural networks or graph neural networks to implement session recommendation tasks.
[0003] However, such technologies only consider the continuous or discontinuous relationships within a session to semantically make up for the lack of data, and cannot distinguish the importance of different semantic information to items. Summary of the Invention
[0004] The embodiments of the present application provide a session recommendation method, apparatus, device, and storage medium.
[0005] In a first aspect, the embodiments of the present application provide a session recommendation method, and the method includes:
[0006] Constructing the historical session and each individual session in the historical session into a hypergraph and a session graph respectively;
[0007] Processing the hypergraph through a hypergraph convolutional network to obtain a first session representation from the perspective of the hypergraph; and processing each session graph through a graph attention network to obtain a second session representation from the perspective of the session graph;
[0008] Performing fusion processing according to the first session representation and the second session representation to generate a target session representation;
[0009] Performing session recommendation according to the target session representation.
[0010] Optionally, the constructing the historical session and each individual session in the historical session into a hypergraph and a session graph respectively includes:
[0011] Constructing the historical session into a hypergraph and constructing each individual session in the historical session into a session graph.
[0012] Optionally, the hypergraph includes nodes and hyperedges, and the nodes include first nodes and second nodes.
[0013] Optionally, the processing of the hypergraph by the hypergraph convolutional network to obtain the first session representation from the hypergraph perspective includes:
[0014] Processing the hypergraph by the hypergraph convolutional network to obtain the first item representation from the hypergraph perspective;
[0015] Obtaining the first session representation from the hypergraph perspective through the soft attention mechanism and the first item representation.
[0016] Optionally, the processing of the hypergraph by the hypergraph convolutional network to obtain the first session representation from the hypergraph perspective includes:
[0017] Processing the hypergraph by the hypergraph convolutional network to obtain the first item representation from the hypergraph perspective;
[0018] Obtaining the first session representation from the hypergraph perspective through the soft attention mechanism and the first item representation.
[0019] Optionally, the processing of the hypergraph by the hypergraph convolutional network to obtain the first item representation from the hypergraph perspective includes:
[0020] Processing the hypergraph by the hypergraph convolutional network to obtain an item representation matrix and a propagation matrix;
[0021] Setting the nodes within the same hyperedge as similar nodes;
[0022] Obtaining the feature representation of each item according to the similar nodes;
[0023] When any first node and second node are in the same session, processing the input of the first layer and the output of the last layer of the hypergraph convolutional network through the highway network to obtain the first item representation from the hypergraph perspective.
[0024] Optionally, the processing of each session graph by the graph attention network to obtain the second session representation from the session graph perspective includes:
[0025] Generating the attention weights between the node pairs in each session graph through the graph attention network;
[0026] Converting the semantic information of the attributes of each item into an attribute vector through the word vector mechanism;
[0027] Fusing the item feature vector and the attribute vector of each item to obtain the second item representation from the session graph perspective;
[0028] Generating the second session representation through the pre-set attribute-aware attention mechanism and the second item representation.
[0029] Optionally, the fusion processing according to the first session representation and the second session representation to generate a target session representation includes:
[0030] Performing fusion processing on the first session representation and the second session representation according to a pre-trained contrastive learning model, and outputting a target session representation.
[0031] In a second aspect, an embodiment of the present application provides a session recommendation method device, and the device includes:
[0032] A construction module for constructing a hypergraph and a session graph from a historical session and a single session in the historical session respectively;
[0033] A first processing module for processing the hypergraph through a hypergraph convolutional network to obtain a first session representation from the perspective of the hypergraph; and, processing each session graph through a graph attention network to obtain a second session representation from the perspective of the session graph;
[0034] A second processing module for performing fusion processing according to the first session representation and the second session representation to generate a target session representation;
[0035] A recommendation module for performing session recommendation according to the target session representation.
[0036] Optionally, the construction module includes:
[0037] A construction sub-module for constructing a hypergraph from a historical session and constructing a session graph from a single session in the historical session.
[0038] Optionally, the hypergraph includes nodes and hyperedges, and the nodes include first nodes and second nodes.
[0039] Optionally, the first processing module includes:
[0040] A first processing sub-module for processing the hypergraph through a hypergraph convolutional network to obtain a first item representation from the perspective of the hypergraph;
[0041] A second processing sub-module for obtaining a first session representation from the perspective of the hypergraph through a soft attention mechanism and the first item representation.
[0042] Optionally, the first processing sub-module includes:
[0043] A first processing unit for processing the hypergraph through a hypergraph convolutional network to obtain an item representation matrix and a propagation matrix;
[0044] A second processing unit for setting the nodes within the same hyperedge as similar nodes;
[0045] A third processing unit, configured to obtain a feature representation of each item according to the similar nodes;
[0046] A fourth processing unit, configured to, when any first node and second node are in the same session, process the input of the first layer and the output of the last layer of the hypergraph convolutional network through a highway network to obtain a first item representation from the hypergraph perspective.
[0047] Optionally, the first processing module includes:
[0048] A third processing sub-module, configured to generate attention weights between node pairs in each of the session graphs through a graph attention network;
[0049] A fourth processing sub-module, configured to convert the semantic information of the attributes of each item into an attribute vector through a word vector mechanism;
[0050] A fifth processing sub-module, configured to fuse the item feature vector and the attribute vector of each item to obtain a second item representation from the session graph perspective;
[0051] A sixth processing sub-module, configured to generate a second session representation through a preset attribute-aware attention mechanism and the second item representation.
[0052] Optionally, the second processing module includes:
[0053] A seventh processing sub-module, configured to perform a fusion process on the first session representation and the second session representation according to a pre-trained contrastive learning model, and output a target session representation.
[0054] In a third aspect, an embodiment of the present application further provides an electronic device, including: a processor; and a memory for storing executable instructions of the processor, where the processor is configured to execute the instructions to implement the session recommendation method as described in any one of the above.
[0055] In a fourth aspect, an embodiment of the present application further provides a storage medium, when the instructions in the storage medium are executed by a processor of an electronic device, enabling the electronic device to execute the session recommendation method as described in any one of the above.
[0056] In the embodiments of the present application, the historical session and individual sessions in the historical session are respectively constructed into a hypergraph and a session graph; the hypergraph is processed by a hypergraph convolutional network to obtain a first session representation from the perspective of the hypergraph; and, each session graph is processed by a graph attention network to obtain a second session representation from the perspective of the session graph; a fusion process is performed according to the first session representation and the second session representation to generate a target session representation; session recommendations are made according to the target session representation. That is, in the embodiments of the present application, session representations are encoded from two different dimensional perspectives, namely the hypergraph perspective and the session graph perspective, which can more comprehensively represent the global and local interests of the user at different times; because the present invention constructs the historical session into a hypergraph and uses the technical means of the hypergraph neural network, a many-to-many high-order conversion relationship between items is established, significantly improving the sparsity of the session graph established in the prior art and achieving the purpose of enriching the feature representation of the central node.
[0057] The above description is only an overview of the technical solution of the present application. In order to be able to understand the technical means of the present application more clearly, it can be implemented according to the content of the specification. And in order to make the above and other purposes, features and advantages of the present application more obvious and understandable, the following specific embodiments of the present application are specifically cited. Brief Description of the Drawings
[0058] By reading the following detailed description of the preferred embodiments, various other advantages and benefits will become clear to those of ordinary skill in the art. The drawings are only for the purpose of showing the preferred embodiments and are not considered to be a limitation of the present application. And throughout the drawings, the same reference numerals are used to represent the same components. In the drawings:
[0059] Figure 1 is a flowchart of the steps of a session recommendation method provided by an embodiment of the present application;
[0060] Figure 2 is a block diagram of a device of a session recommendation method device provided by an embodiment of the present application;
[0061] Figure 3 is a structural diagram of an electronic device provided by an embodiment of the present application;
[0062] Figure 4 is a schematic diagram of the basic structure of an exemplary recurrent neural network provided by an embodiment of the present application;
[0063] Figure 5 is a schematic diagram of a comparison between an exemplary hypergraph and an ordinary graph provided by an embodiment of the present application;
[0064] Figure 6 is a schematic diagram of an exemplary hypergraph constructed from sessions and its incidence matrix provided by an embodiment of the present application;
[0065] Figure 7 It is a schematic diagram of an exemplary session graph provided by an embodiment of the present application;
[0066] Figure 8 It is a schematic flowchart of an exemplary session recommendation method provided by an embodiment of the present application. Detailed implementation manners
[0067] Hereinafter, exemplary embodiments of the present application will be described in more detail with reference to the accompanying drawings. Although the exemplary embodiments of the present application are shown in the drawings, it should be understood that the present application can be implemented in various forms and should not be limited by the embodiments set forth herein. On the contrary, these embodiments are provided so that the present application can be more thoroughly understood and the scope of the present application can be fully conveyed to those skilled in the art.
[0068] Figure 1 It is a step flowchart of a session recommendation method provided by an embodiment of the present application, as Figure 1 shown, the method includes:
[0069] Step 101, constructing a hypergraph and a session graph for the historical session and individual sessions in the historical session respectively;
[0070] It should be noted that in the embodiments of the present application, a session refers to a set of a series of short-term interaction activities carried out by a user within a certain time period. These activities (such as browsing, clicking, or purchasing behaviors) are divided into different sequences according to a custom time interval (such as half an hour, one day, or one week). Within a session, a user can repeatedly access the same item.
[0071] Further, the constructing a hypergraph and a session graph for the historical session and individual sessions in the historical session respectively includes:
[0072] Constructing a hypergraph for the historical session and constructing a session graph for individual sessions in the historical session.
[0073] The present invention enhances the feature representation of items by splicing item attribute information. In addition, since the items included in a session are limited and the session length is short, the present invention mainly constructs multiple sessions into a hypergraph, exceeding the establishment of only pairwise item relationships in a conventional session graph. Each hyperedge connects all items within the current session, expanding the number of edges in the graph and enriching the high-order feature representation of the central node, mainly solving the problem in the prior art that the graph constructed for a single session is sparse, resulting in an incomplete establishment of high-order conversion relationships between items.
[0074] Specifically, constructing a hypergraph and a session graph for the historical session and individual sessions respectively, specifically, can refer to Figure 8 .
[0075] First, construct the session data of historical sessions into a hypergraph, which can refer to Figure 5 , and define the following formula 1:
[0076] G h =(V, E h )(Formula 1)
[0077] where the hyperedge can connect any number of nodes. The relationship between nodes and hyperedges is represented by the incidence matrix H ∈ R n×m , specifically, it can refer to Figure 6 , n represents the number of nodes, and m represents the number of hyperedges. When the hyperedge ∈ contains the node v i , set the matrix element H i∈ to 1, otherwise 0. The degree of the hyperedge constitutes the diagonal matrix B ∈ R m×m . In addition, each hyperedge contains a weight W ∈∈ . The weights of all hyperedges correspond to a weight matrix W ∈ R m×m , which is a diagonal matrix. The degree of a node is no longer described by out-degree and in-degree, but by , which constitutes the diagonal matrix D ∈ R n×n .
[0078] Second, construct a session graph for a single session, which can refer to Figure 7 , as shown in the following formula 2:
[0079] G s =(V, E s )(Formula 2)
[0080] where the session graph is constructed from a session sequence, and the order and direction of information propagation are maintained by connecting two adjacent items within the session, realizing the modeling of the sequential relationship between paired adjacent items. Add a self-loop edge that points to itself for each node in the session graph. There are four types of edges in the session graph, e in , e out , e in-out , e self . Taking the nodes v i and v j as an example, e in means that there is only an edge from v j to v i , e out means that there is only an edge from v i to v j , e in-out means that there is a bidirectional connection between v i and v j , and e self means the information transfer relationship of the node itself.
[0081] Step 102, process the hypergraph through a hypergraph convolutional network to obtain a first session representation from the hypergraph perspective; and, process each session graph through a graph attention network to obtain a second session representation from the session graph perspective;
[0082] It should be noted that after the graph construction is completed, in the embodiments of the present application, encoding is performed from two dimensions, that is, encoding from the hypergraph perspective and encoding from the session graph perspective.
[0083] Specifically, from the hypergraph perspective, the number of edges in the graph is expanded, and a hypergraph convolutional network is used to generate global-level item representations and session representations.
[0084] From the session graph perspective, a graph attention network is used to learn the attention weights between item pairs, and item attributes are fused to generate local-level item representations and session representations, expanding the available information.
[0085] Furthermore, the hypergraph includes nodes and hyperedges, and the nodes include first nodes and second nodes.
[0086] Furthermore, the process of obtaining the first session representation from the hypergraph perspective by processing the hypergraph through a hypergraph convolutional network includes:
[0087] Process the hypergraph through a hypergraph convolutional network to obtain a first item representation from the hypergraph perspective;
[0088] Obtain the first session representation from the hypergraph perspective through a soft attention mechanism and the first item representation.
[0089] It should be noted that in the embodiments of the present application, reference can be made to Figure 4 , Figure 4 is a basic structure of a recurrent neural network, while the present application uses a hypergraph neural network. Among them, a hypergraph neural network refers to a deep learning model specifically used to process hypergraph-structured data. Different from traditional graph neural networks, hypergraphs allow for multi-edge relationships between nodes, that is, a hyperedge can connect more than two nodes, which enables hypergraphs to more comprehensively express complex multi-element relationships and enhances the model's non-linear high-order relationship modeling ability.
[0090] Furthermore, the process of obtaining the first item representation from the hypergraph perspective by processing the hypergraph through a hypergraph convolutional network includes:
[0091] Process the hypergraph through a hypergraph convolutional network to obtain an item representation matrix and a propagation matrix;
[0092] Set the nodes within the same hyperedge as similar nodes;
[0093] Obtain the feature representation of each item according to the similar nodes;
[0094] When any first node and second node are in the same session, the input of the first layer and the output of the last layer of the hypergraph convolutional network are processed through the highway network to obtain the first project representation from the hypergraph perspective.
[0095] The hypergraph convolutional network is used to process the graph structure, and the specific calculation process is as follows:
[0096] I (l+1) = D -1 HWB -1 P (l) (Formula 3)
[0097] P (l) = H T I (l) (Formula 4)
[0098] Among them, in the above Formulas 3 and 4, I represents the project representation matrix, and P is the propagation matrix, indicating the aggregation of node feature information on the hyperedge. In this technology, the weight of the hyperedge W ∈∈ is set to 1, and the nodes within the same hyperedge are regarded as nodes with similar features so that information can be propagated between similar nodes. Specifically for each node, the feature representation of each project is learned, and the calculation formula is as follows:
[0099]
[0100] Among them, in the above Formula 5, when the nodes v i and v j belong to the same session, H i∈ H j∈ is equal to 1, otherwise it is equal to 0, that is, v i ∈∈, v j ∈∈. To solve the problem of gradient disappearance, a highway network is introduced to process the input of the first layer and the output of the last layer of the hypergraph convolutional network. The calculation formula for the final project representation from the hypergraph perspective is as follows:
[0101]
[0102] Among them, W h ∈R d×2d is a learnable parameter matrix, is the output after passing through the L-layer hypergraph convolutional network. The weight π i is related to the initial embedding of the project and the output of the L-layer hypergraph convolution. All projects included in the current session are counted, and the average value of these project representations represents the feature vector of this session. The calculation formula is as follows:
[0103]
[0104] Different positions in the conversation have different impacts on user preferences. It is necessary to consider the location information and add the item representation to the location embedding vector:
[0105]
[0106] p i represents the embedding vector of the i-th position. Considering that the item features containing the location embedding vector may have different priorities, a soft attention mechanism is used to learn the weights of each item. The item features are linearly combined with the conversation information to obtain the conversation representation s from the perspective of the hypergraph h , and the calculation formula is as follows:
[0107]
[0108] Among them, in the above formula 11, W 1 ,W 2 ∈R d×d , q, b ∈ R d are all learnable parameters. σ represents the softmax activation function.
[0109] Furthermore, the processing of each session graph by the graph attention network to obtain the second session representation from the perspective of the session graph includes:
[0110] Generating the attention weights between node pairs in each session graph through the graph attention network;
[0111] Converting the semantic information of the attributes of each item into an attribute vector through the word vector mechanism;
[0112] Fusing the item feature vector and the attribute vector of each item to obtain the second item representation from the perspective of the session graph;
[0113] Generating the second session representation through the pre-set attribute-aware attention mechanism and the second item representation.
[0114] For each session graph, the graph attention network (GAT) is used to generate the attention weights between node pairs, and the calculation formula is as follows:
[0115]
[0116] e ij represents the type embedding vector of the edge (v i , v j ). When l = 1, is equal to the initial item embedding vector v i , and the feature vectors of neighboring nodes are weighted and summed to represent the feature vector of the central node:
[0117]
[0118] Each item can contain multiple attributes, represented by A = {a i1 , a i2 , …, a ik} for the attribute set of item v i . Using word2vec to convert the semantic information of attributes into vectors a i , and fusing the item feature vectors and attribute vectors, from the perspective of the conversation graph, the calculation formula for the final item representation is as follows:
[0119]
[0120] W s ∈ R d×2d are learnable parameters.
[0121] Design an attribute-aware attention mechanism to calculate the attention scores of each item under different attributes. First, perform a non-linear transformation on the item-attribute pairs, and then use the softmax function to normalize the attention scores. The calculation formula is as follows:
[0122]
[0123] From the perspective of the conversation graph, the item representation fused with item attributes and the attribute-aware attention scores represent the user's interests. The calculation formula for the conversation representation is as follows:
[0124]
[0125] Step 103: Perform a fusion process based on the first conversation representation and the second conversation representation to generate a target conversation representation;
[0126] Furthermore, the performing a fusion process based on the first conversation representation and the second conversation representation to generate a target conversation representation includes:
[0127] Performing a fusion process on the first conversation representation and the second conversation representation according to a pre-trained contrastive learning model, and outputting a target conversation representation.
[0128] Step 104: Perform conversation recommendation based on the target conversation representation.
[0129] Conversation recommendation refers to a recommendation technique that uses the implicit feedback of anonymous users (such as purchase records, click behaviors, etc.) to predict the next item that the user may be interested in. It models the transition relationship between items in a conversation and does not rely on the user ID, thus protecting the user's privacy to a certain extent.
[0130] First, weight and combine the two conversation representations to obtain the final conversation representation:
[0131] S = λs h +(1 - λ)s s (Formula 17)
[0132] λ ranges from 0 to 1 and is used to control the weights of each session representation from two perspectives. The value of λ can be adjusted according to the specific task and the performance of the model. At the beginning of training, more weights will be given to the global session information s h to capture the long-term preferences of users; as the model's understanding of user behavior deepens, the weights of the local session information s s may be gradually increased to better capture the immediate interests of users.
[0133] By calculating the inner product of the initial embedding vector v of the item i and the session representation S, and after normalization, the probability of each item being recommended is obtained. The calculation formula is as follows:
[0134]
[0135] The model is trained by constructing the cross-entropy loss function of the recommendation probability:
[0136]
[0137] y i is a one-hot vector. The cross-entropy value can measure the similarity between the true value and the predicted value. The method of contrastive learning is used to supervise and refine the generation of session representations, aiming to maximize the mutual information between session representations in two views and complement each other. The model is trained using the standard binary cross-entropy loss function:
[0138]
[0139] Among them, in the above formula 20, s h,k and s s,k are positive samples obtained from the same session, and are negative samples. This method can improve the problem of sparse session data in the case where the session consists of only a small number of items. Unify the session recommendation task and contrastive learning in a main learning framework, combine the two loss functions, and the final loss function is defined as:
[0140]
[0141] Among them, in formula 21, γ is responsible for controlling the size of the contrastive learning task.
[0142] With the continuous development of big data and artificial intelligence technologies, personalized recommendation systems have become a standard feature of many Internet products and services. The method of the present invention can be widely applied to multiple fields such as e-commerce platforms, video streaming media, news and information, etc., providing users with more accurate and personalized recommendation services, thereby enhancing the user stickiness, conversion rate and overall competitiveness of enterprises.
[0143] In addition, it should be noted that in the embodiments of the present application, by adopting the technology of contrastive learning, compared with the prior art, the session representation under the dual perspectives is refined, the mutual information between session representations is increased, and the user's intention can be more fully mined.
[0144] In the embodiments of the present application, the historical session and a single session in the historical session are respectively constructed into a hypergraph and a session graph; the hypergraph is processed by a hypergraph convolutional network to obtain a first session representation from the hypergraph perspective; and, each session graph is processed by a graph attention network to obtain a second session representation from the session graph perspective; fusion processing is performed according to the first session representation and the second session representation to generate a target session representation; session recommendation is performed according to the target session representation. That is, in the embodiments of the present application, the session representation is encoded from two different dimensional perspectives, namely the hypergraph perspective and the session graph perspective, which can more comprehensively represent the user's global and local interests at different times. Because the present invention constructs the historical session into a hypergraph and uses the technical means of hypergraph neural network, a many-to-many high-order conversion relationship between items is established, significantly improving the sparsity of the session graph established in the prior art and achieving the purpose of enriching the feature representation of the central node.
[0145] Figure 2 It is a block diagram of a device for a session recommendation method provided by an embodiment of the present application, as Figure 2 shown, the device includes:
[0146] A construction module 201, configured to respectively construct the historical session and a single session in the historical session into a hypergraph and a session graph;
[0147] A first processing module 202, configured to process the hypergraph through a hypergraph convolutional network to obtain a first session representation from the hypergraph perspective; and, process each session graph through a graph attention network to obtain a second session representation from the session graph perspective;
[0148] A second processing module 203, configured to perform fusion processing according to the first session representation and the second session representation to generate a target session representation;
[0149] A recommendation module 204, configured to perform session recommendation according to the target session representation.
[0150] Optionally, the construction module includes:
[0151] A construction sub-module, configured to construct a historical session into a hypergraph and construct an individual session in the historical session into a session graph.
[0152] Optionally, the hypergraph includes nodes and hyperedges, and the nodes include first nodes and second nodes.
[0153] Optionally, the first processing module includes:
[0154] A first processing sub-module, configured to process the hypergraph through a hypergraph convolutional network to obtain a first item representation from the perspective of the hypergraph;
[0155] A second processing sub-module, configured to obtain a first session representation from the perspective of the hypergraph through a soft attention mechanism and the first item representation.
[0156] Optionally, the first processing sub-module includes:
[0157] A first processing unit, configured to process the hypergraph through a hypergraph convolutional network to obtain an item representation matrix and a propagation matrix;
[0158] A second processing unit, configured to set the nodes within the same hyperedge as similar nodes;
[0159] A third processing unit, configured to obtain a feature representation of each item according to the similar nodes;
[0160] A fourth processing unit, configured to, when any first node and second node are in the same session, process the input of the first layer and the output of the last layer of the hypergraph convolutional network through a highway network to obtain a first item representation from the perspective of the hypergraph.
[0161] Optionally, the first processing module includes:
[0162] A third processing sub-module, configured to generate attention weights between node pairs in each session graph through a graph attention network;
[0163] A fourth processing sub-module, configured to convert the semantic information of the attributes of each item into an attribute vector through a word vector mechanism;
[0164] A fifth processing sub-module, configured to fuse the item feature vector and the attribute vector of each item to obtain a second item representation from the perspective of the session graph;
[0165] A sixth processing sub-module, configured to generate a second session representation through a preset attribute-aware attention mechanism and the second item representation.
[0166] Optionally, the second processing module includes:
[0167] A seventh processing sub-module, configured to perform fusion processing on the first session representation and the second session representation according to a pre-trained contrastive learning model, and output a target session representation.
[0168] In the embodiment of the present application, the historical session and a single session in the historical session are respectively constructed into a hypergraph and a session graph; the hypergraph is processed by a hypergraph convolutional network to obtain a first session representation from the perspective of the hypergraph; and each session graph is processed by a graph attention network to obtain a second session representation from the perspective of the session graph; fusion processing is performed according to the first session representation and the second session representation to generate a target session representation; and session recommendation is performed according to the target session representation. That is, in the embodiment of the present application, session representations are encoded from two different dimensional perspectives, namely the hypergraph perspective and the session graph perspective, which can more comprehensively represent the global and local interests of the user at different times. Because the present invention constructs the historical session into a hypergraph and uses the technical means of the hypergraph neural network, a many-to-many high-order conversion relationship between items is established, significantly improving the sparsity of the session graph established in the prior art and achieving the purpose of enriching the feature representation of the central node.
[0169] Figure 3 It is a structural diagram of an electronic device M00 provided by an embodiment of the present application. In the figure, the electronic device M00 includes a processor M01 and a memory M02. The electronic device includes: a processor; a memory for storing executable instructions of the processor, wherein the processor is configured to execute the instructions to implement the session recommendation method described in any one of the above, and can achieve the same technical effects. To avoid repetition, it will not be elaborated here.
[0170] In an embodiment of the present application, the memory M02 can be used to store software programs and various data. The memory M02 mainly includes a first storage area for storing programs or instructions and a second storage area for storing data. Among them, the first storage area can store an operating system, applications or instructions required for at least one function (such as a sound playback function, an image playback function, etc.). In addition, the memory M02 can include a volatile memory or a non-volatile memory, or the memory M02 can include both a volatile memory and a non-volatile memory. Among them, the non-volatile memory can be a read-only memory (ROM), a programmable read-only memory (PROM), an erasable programmable read-only memory (EPROM), an electrically erasable programmable read-only memory (EEPROM), or a flash memory. The volatile memory can be a random access memory (RAM), a static random access memory (SRAM), a dynamic random access memory (DRAM), a synchronous dynamic random access memory (SDRAM), a double data rate synchronous dynamic random access memory (DDR SDRAM), an enhanced synchronous dynamic random access memory (ESDRAM), a synchronous link dynamic random access memory (SLDRAM), and a direct rambus random access memory (DRRAM). The memory M02 in the embodiment of the present application includes but is not limited to these and any other suitable types of memories.
[0171] The processor M01 can include one or more processing units; optionally, the processor M01 integrates an application processor and a modem processor. Among them, the application processor mainly processes operations related to the operating system, user interface, and applications, etc., and the modem processor mainly processes wireless communication signals, such as a baseband processor. It can be understood that the above modem processor may not be integrated into the processor M01.
[0172] The embodiment of the present application also provides a readable storage medium, on which a program or instruction is stored. When the program or instruction is executed by a processor, it implements each process of the above embodiment of the session recommendation method and can achieve the same technical effect. To avoid repetition, it will not be elaborated here.
[0173] Among them, the processor is the processor in the electronic device described in the above embodiments. The readable storage medium includes computer-readable storage media such as computer read-only memory ROM, random access memory RAM, magnetic disks, or optical discs, etc.
[0174] Another embodiment of the present application provides a chip, which includes a processor and a communication interface. The communication interface is coupled to the processor. The processor is used to run programs or instructions to implement each process of the above embodiment of the session recommendation method, and can achieve the same technical effects. To avoid repetition, it will not be elaborated here.
[0175] It should be understood that the chip involved in the embodiments of the present application can also be referred to as a system-on-chip, system chip, chip system, or system-on-chip, etc.
[0176] The embodiments of the present application also provide a storage medium. When the instructions in the storage medium are executed by the processor of the electronic device, the electronic device can execute any of the above session recommendation methods.
[0177] The embodiments of the present application provide a computer program product. The program product is stored in a storage medium and is executed by at least one processor to implement each process of the above embodiment of the session recommendation method, and can achieve the same technical effects. To avoid repetition, it will not be elaborated here.
[0178] The embodiments of the present application also provide a vehicle, which includes the session recommendation method device as described above.
[0179] It should be noted that in this article, the terms "include", "comprise" or any other variant thereof are intended to cover non-exclusive inclusion, so that a process, method, article or device including a series of elements not only includes those elements, but also includes other elements not expressly listed, or further includes elements inherent to such process, method, article or device. Without further limitation, an element defined by the statement "including one..." does not exclude the existence of additional identical elements in the process, method, article or device including that element. In addition, it should be pointed out that the scope of the methods and devices in the embodiments of the present application is not limited to performing functions in the order shown or discussed. It may also include performing functions in a substantially simultaneous manner or in a reverse order according to the functions involved. For example, the described methods can be executed in an order different from that described, and various steps can be added, omitted, or combined. In addition, the features described with reference to certain examples can be combined in other examples.
[0180] Through the description of the above embodiments, those skilled in the art can clearly understand that the methods of the above embodiments can be implemented by means of software plus a necessary general hardware platform. Of course, they can also be implemented by hardware, but in many cases the former is a better implementation method. Based on such an understanding, the technical solution of the present application, in essence or the part that contributes to the related technology, can be embodied in the form of a computer software product. The computer software product is stored in a storage medium (such as ROM / RAM, magnetic disk, optical disk) and includes several instructions for causing a terminal (which can be a mobile phone, computer, server, or network device, etc.) to execute the methods described in various embodiments of the present application.
[0181] The embodiments of the present application have been described above in conjunction with the accompanying drawings. However, the present application is not limited to the above specific implementation manners. The above specific implementation manners are merely illustrative and not restrictive. Under the inspiration of the present application, those of ordinary skill in the art can also make many forms without departing from the purpose of the present application and the scope protected by the claims, and all of them belong to the protection scope of the present application.
Claims
1. A conversation recommendation method, characterized in that: The method comprises: Constructing the historical session and the individual session in the historical session into a hypergraph and a session graph respectively; Processing the hypergraph through a hypergraph convolutional network to obtain a first session representation from the perspective of the hypergraph; and processing each of the session graphs through a graph attention network to obtain a second session representation from the perspective of the session graph; Performing fusion processing according to the first conversation representation and the second conversation representation to generate a target conversation representation; A conversation recommendation is performed according to the target conversation representation.
2. The method according to claim 1, characterized in that The constructing the historical session and the single session in the historical session into a hypergraph and a session graph respectively comprises: The historical sessions are constructed as a hypergraph, and the individual sessions in the historical sessions are constructed as a session graph.
3. The method according to claim 1, characterized in that The hypergraph includes nodes and hyperedges, and the nodes include a first node and a second node.
4. The method according to claim 3, characterized in that Processing the hypergraph through a hypergraph convolutional network to obtain a first session representation from the hypergraph perspective includes: Processing the hypergraph through a hypergraph convolutional network to obtain a first item representation from the perspective of the hypergraph; Through the soft attention mechanism and the first item representation, a first session representation from a hypergraph perspective is obtained.
5. The method according to claim 4, characterized in that The step of processing the hypergraph through a hypergraph convolutional network to obtain a first project representation from the hypergraph perspective includes: Processing the hypergraph through a hypergraph convolutional network to obtain an item representation matrix and a propagation matrix; Setting the nodes within the same hyperedge as similar nodes; Obtaining a feature representation of each item based on the similar nodes; When any first node and second node are in the same session, the input of the first layer and the output of the last layer of the hypergraph convolutional network are processed through the highway network to obtain the first item representation from the hypergraph perspective.
6. The method according to claim 1, characterized in that The processing of each of the session graphs by the graph attention network to obtain a second session representation from the perspective of the session graph includes: Generate attention weights between each pair of nodes in the session graph through a graph attention network; The semantic information of each item's attributes is converted into an attribute vector through the word embedding mechanism; fusing the project feature vector and the attribute vector of each of the projects to obtain a second project representation from the perspective of the conversation graph; A second session representation is generated by a preset attribute-aware attention mechanism and the second item representation.
7. The method according to claim 1, characterized in that The generating a target session representation by fusing the first session representation and the second session representation comprises: The first session representation and the second session representation are fused according to a pre-trained contrastive learning model, and a target session representation is output.
8. A conversation recommendation method and device, characterized in that: The device comprises: A construction module, used to construct the historical session and a single session in the historical session into a hypergraph and a session graph respectively; A first processing module is used to process the hypergraph through a hypergraph convolutional network to obtain a first session representation from the perspective of the hypergraph; and to process each of the session graphs through a graph attention network to obtain a second session representation from the perspective of the session graph; a second processing module, configured to perform fusion processing according to the first conversation representation and the second conversation representation to generate a target conversation representation; A recommendation module is used to make a session recommendation according to the target session representation.
9. An electronic device, characterized in that: include: processor; a memory for storing instructions executable by the processor; The processor is configured to execute the instructions to implement the conversation recommendation method as described in any one of claims 1-7.
10. A computer storage medium, a readable storage medium, for storing a program, characterized in that: When the program is executed by a processor, the conversation recommendation method as described in any one of claims 1 to 7 is implemented.
Citation Information
Cited By
Session recommendation method and system, electronic equipment and storage medium
CN120372096A