A sequential recommendation method using multi-attribute and multi-behavior information
Through the sequence recommendation method of multi-attribute and multi-behavior information, multi-head self-attention and multi-layer perceptron layer structure are used to integrate user attributes and interactive information, solving the data sparsity and cold start problems in the existing system, and improving the accuracy of the recommendation system. sex and personalization.
Patent Information
- Application Number
- CN202310194877.8
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2023-03-03
- Publication Date
- 2024-09-20
- Estimated Expiration
- 2043-03-03
AI Technical Summary
Existing sequence recommendation systems are difficult to effectively integrate item attribute information and user interaction information, resulting in data sparsity and cold start problems, and lack of improvements in recommendation accuracy and personalization.
A sequence recommendation method using multi-attribute and multi-behavior information is adopted. Through the multi-behavior fusion attribute extraction module and the multi-behavior item prediction module, multi-head self-attention and multi-layer perceptron layer structures are used to extract and fuse the user's multiple attribute interests and interactive information. , generate the user's item interest representation, and optimize the model through the cross-entropy loss function.
It improves the accuracy and personalization of the recommendation system, adapts to different data types, improves the cold start problem, enriches sequence interaction information, and solves the problem of data sparsity.
Smart Images

Figure CN116108687B
Abstract
Description
Technical Field
[0001] The present invention belongs to the field of data mining, and specifically is a sequence recommendation method using multi-attribute and multi-behavior information. Background Art
[0002] A sequential recommendation system is a recommendation system that predicts the next behavior of a user based on the user's historical behavior sequence. Compared with traditional recommendation systems, sequential recommendation systems need to consider the temporal nature and historical dependencies of user behavior, so there are some technical difficulties and problems, including: historical information modeling, data sparsity, cold start problems, etc.
[0003] Item attribute information and user interaction information are auxiliary information that can help improve the performance of the recommendation system. However, current research work either focuses on fusing item attribute information, such as FDSA, p-RNN, and ICAI-SR. FDSA applies self-attention on item sequences and attribute sequences respectively, and fuses two feature vectors at the prediction layer. Early work such as p-RNN usually uses simple connections to inject auxiliary information directly into item representations. ICAI-SR fuses attribute information into item representations before the attention layer. Or focus on utilizing multiple user interaction behaviors, such as DIPN and DMT. Models such as DIPN and DMT follow a two-stage aggregation paradigm and only model coarse-grained behavioral-level dependencies. There is no model that can fuse the two types of auxiliary information together. Sequence systems that utilize both item attribute information and user interaction information also have some challenges, such as how to effectively extract item attribute information and how to fuse attribute information and interaction information. Therefore, some effective algorithms and techniques are needed to solve these problems in order to achieve more accurate and personalized recommendation services. Summary of the invention
[0004] The purpose of the present invention is to provide a sequential recommendation method using multi-attribute and multi-behavior information to address the deficiencies in the prior art. This method can use item attributes and user interaction behaviors to solve the data sparsity problem of the sequential recommendation system, improve the cold start problem, and improve the accuracy of recommendations.
[0005] The technical solution for achieving the purpose of the present invention is:
[0006] A sequence recommendation method using multi-attribute and multi-behavior information includes the following steps:
[0007] 1) Data preprocessing and embedding processing:
[0008] Define the set of all users in the system as The set of user behavior types is represented as The set of all items is The set of project properties defined is
[0009] For Users The historical interaction sequence of u is expressed as symbol represents the i-th interaction (also called behavior) performed by user u, and each interaction is represented by Each interaction in the user's historical interaction sequence consists of three parts: project identification, project attributes, and behavior type; the project identification is represented by the project ID. It is the ID of the project; the project attributes include multiple aspects. is the attribute domain of the project; the behavior type refers to the user's interaction method with respect to the project. is the behavior type of the interaction; given a historical interaction sequence of user u with a length of t The task of a recommender system is to predict the next item that a user will interact with.
[0010] Since different users have different levels of activity, the length of their historical interaction sequences will also be different. The model only accepts fixed-length sequences, so it is necessary to convert variable-length interaction sequences into fixed-length sequences. Define n as the maximum length that the model can handle, that is, the sequence length n. If the sequence length is greater than n, take the nearest n items. If the sequence length is less than n, use zero padding on the left side of the sequence until the sequence length is n.
[0011] After converting the variable-length sequence into a fixed-length sequence, the interactive sequence Split into three subsequences, namely project ID sequence Item Attribute Sequence Behavior Type Sequence Then the project ID sequence Item Attribute Sequence Perform embedding operation and convert it into embedding sequence. Embedding refers to embedding vector, which is the dense vector representation of entity items in recommendation algorithms.
[0012] Project ID Sequence After being converted into an embedded sequence, it is expressed as n is the sequence length, d is the embedding dimension; each attribute takes a different value or element, so when embedding the project attributes, each type of attribute is embedded separately, expressed as attribute embedding is the number of attributes contained in the item attribute domain;
[0013] 2) Extracting user’s attribute interests under multiple behaviors:
[0014] This step is implemented through a multi-behavior fusion attribute extraction module, which is composed of multiple multi-behavior multi-head self-attention sub-layers and multi-behavior multi-layer perceptron sub-layers. The input of this module is the attribute embedding sequence and the behavior sequence, and the output is the fusion attribute interest sequence under the behavior sequence. In order to fully capture the user's interest in each attribute, an independent self-attention module is constructed for each attribute. Each self-attention module is only responsible for processing one attribute information, so as to accurately obtain the user interest hidden in the attribute information;
[0015] (1) Multi-behavior multi-head self-attention sub-layer:
[0016] Assume that the attribute f i The lth layer is a multi-behavior multi-head self-attention sublayer, and H is defined (l-1) is the output of the l-1th layer and the input of the lth layer. When l is equal to 1, Define h as the total number of attention heads. For each attention head in the multi-behavior multi-head self-attention sub-layer, H (l-1) Transformed into query vector Q∈R by linear projection n×d , key vector K∈R n×d , value vector V∈R n×d , n is the sequence length, d is the embedding dimension, and the projection transformation formula is (1):
[0017]
[0018] Since the attention method cannot distinguish the relationship between the previous and the next sequence, the rotation position embedding (RoPE) is used to inject position information into the query vector Q, key vector K, and value vector V. The scaled dot product attention of the attention head is calculated as shown in formula (2):
[0019]
[0020] W att ∈R d×d and W agg ∈R d×d It is a parameter matrix generated according to the behavior sequence, which is used to reflect the relationship between the behavior types at different positions in the sequence. att and W agg The generation process is the same as W att For example, create a learnable parameter matrix If the behavior type corresponding to the query vector Q is B i , the behavior type corresponding to the key vector K is B j ,but See formula (3):
[0021]
[0022] The multi-head design can focus on multiple dimensions and aggregate multiple heads before output; definition represents the i-th self-attention head of the multi-head self-attention sub-layer in the l-th layer, h is the number of attention heads, is the parameter matrix of the lth layer. The multi-head aggregation process is shown in formulas (4) and (5):
[0023]
[0024]
[0025] (2) Multi-behavior multi-layer perception machine layer:
[0026] The multi-head self-attention sub-layer aggregation method is based on the linear weighted sum of attention scores, and a multi-layer perceptron is needed to quasi-complement nonlinearity. In order to model the behavior semantics and perform feature conversion, a different multi-layer perceptron sub-layer is specified for each behavior type. X is defined as the input of the multi-layer perceptron. The multi-layer perceptron layer is shown in formula (6):
[0027]
[0028] Multi-behavior multi-head self-attention layer and connection operation Multi-behavior multi-layer perceptron layers are connected through layer normalization and residual connection, see formula (7), (8)
[0029] G (l-1) =LayerNorm(H (l-1) +F msa (H (l-1) )) (7),
[0030] H (l) =LayerNorm(G (l-1) +F mlp (G (l) )) (8),
[0031] (3) Fusion attribute interests:
[0032] The output of the last multi-layer perceptron layer is used as the attribute of the attribute sequence, which includes the output of all behaviors. According to the behavior type of each interaction in the interaction sequence, the output of interest of the corresponding behavior type is selected. For the attribute f i In behavior b j The interest vector extracted under behavior b j Obtaining fusion attribute interest under The process can be obtained by formula (9): is the projection matrix and d is the embedding dimension:
[0033]
[0034] The result is to output the fused attribute interest corresponding to the behavior sequence. The fused attribute interest and behavior sequence will enter the next step of predicting the user-item interest under the specified behavior;
[0035] 3) Predicting user's project interests based on multiple behaviors:
[0036] This step is to predict the user's project interest under the specified behavior, which is called the multi-behavior project prediction module; the fusion attribute interest represents the user's general interest preference, but it cannot be used to predict the user's preference on specific projects. According to the fusion attribute interest, the similarity of each project in the sequence is examined, and the attention mechanism is used to aggregate projects with high similarity. The multi-layer perceptron performs feature transformation. The multi-behavior project prediction module consists of a multi-behavior cross attention layer and a multi-behavior multi-layer perceptron. The input of the module is the fusion attribute interest. Item embedding sequence and behavioral sequences The fused attribute interest is used when calculating the query vector Q, and the item embedding is used when calculating the key vector K and the value vector V, as shown in formula (10):
[0037]
[0038] The method for calculating the attention score is the same as above. It is also necessary to consider the behavior type relationship between the query vector Q and the key vector K, see formula (2). The behavior item prediction module also has a multi-behavior multi-layer perceptron sublayer, see formula (6). The multi-behavior multi-layer perceptron layer outputs the item interest of all behaviors, and selects the output of the corresponding behavior type according to the behavior sequence as the user's item interest.
[0039] 4) Specify the item interest of user behavior and calculate its accuracy:
[0040] The binary cross entropy loss function is used to optimize the model, and the output of the model at time t is O t , the positive example is the real item at the corresponding moment of the historical interaction sequence, denoted by e t , negative examples are randomly selected items that users have not interacted with, denoted as The binary cross entropy loss at this moment is formula (11), where · is the inner product operation:
[0041]
[0042] Define t as the time in the sequence, the total number of which is the length of the sequence N, and the total number of sequences is the total number of users For a single attribute or item, the binary cross entropy loss refers to the sum of the cross entropy of all moments in the entire sequence, see formula (12):
[0043]
[0044] The final loss is the sum of the loss of each attribute and the project loss, see formula (13):
[0045]
[0046] 5) Use deep learning methods to learn parameters and update the model:
[0047] The commonly used gradient descent method, that is, multiple rounds of parameter direction propagation, is used to continuously optimize the model, and Adam is selected as the optimizer.
[0048] The specific effects produced by the present invention are:
[0049] The method of fusing multiple project attribute information invented by this method can adapt to different data types. Multiple attribute information extracts interests separately, and then fuses them into one attribute interest through a multi-layer perceptron. It has good scalability. At the same time, it can improve the cold start problem for new projects.
[0050] The present invention utilizes multiple types of user interaction information, improves the attention mechanism to make it applicable to interactions of different behavior types, enriches the interaction information of the sequence, and helps solve the data sparsity problem.
[0051] The present invention enriches the method of using auxiliary information for sequence recommendation, and also has a significant effect on improving the accuracy of the recommendation system. BRIEF DESCRIPTION OF THE DRAWINGS
[0052] Figure 1 It is a structural diagram of an embodiment. DETAILED DESCRIPTION
[0053] The present invention will be further described below with reference to the embodiments, but the present invention is not limited thereto.
[0054] Example:
[0055] Reference Figure 1 , a sequence recommendation method using multi-attribute and multi-behavior information, comprising the following steps:
[0056] 1) Data preprocessing and embedding processing:
[0057] Define the set of all users in the system as The set of user behavior types is represented as The set of all items is In this case, it is equivalent to the project ID, and the set of defined project attributes is
[0058] For Users The historical interaction sequence of u is expressed as symbol represents the i-th interaction (also called behavior) performed by user u, and each interaction is represented by Each interaction in the user's historical interaction sequence consists of three parts: project identification, project attributes, and behavior type; the project identification is represented by the project ID. It is the ID of the project. The project attributes include multiple aspects. For example, e-commerce products include origin, type, brand, etc. is the attribute domain of the item; the behavior type refers to the way users interact with the item. Taking e-commerce products as an example, possible behavior types include click, purchase, collection, etc. is the behavior type of the interaction; given a historical interaction sequence of user u with a length of t The task of a recommender system is to predict the next item that a user will interact with.
[0059] Since different users have different levels of activity, the length of their historical interaction sequences will also be different. The model only accepts fixed-length sequences, so it is necessary to convert variable-length interaction sequences into fixed-length sequences. Define n as the maximum length that the model can handle, that is, the sequence length n. If the sequence length is greater than n, take the nearest n items. If the sequence length is less than n, use zero padding on the left side of the sequence until the sequence length is n.
[0060] After converting the variable-length sequence into a fixed-length sequence, the interactive sequence Split into three subsequences, namely project ID sequence Item Attribute Sequence Behavior Type Sequence Then the project ID sequence Item Attribute Sequence Perform embedding operation and convert it into embedding sequence. Embedding refers to embedding vector, which is the dense vector representation of entity items in recommendation algorithms.
[0061] Project ID Sequence After being converted into an embedded sequence, it is expressed as n is the sequence length, d is the embedding dimension; taking the item as an e-commerce product as an example, the attribute domain of the product may include brand, price, shipping place, and product category. Each attribute takes a different value or element, so when embedding the item attributes, each type of attribute is embedded separately, which is expressed as attribute embedding is the number of attributes contained in the item attribute domain;
[0062] 2) Extracting user’s attribute interests under multiple behaviors:
[0063] This step is implemented through a multi-behavior fusion attribute extraction module, which is composed of multiple multi-behavior multi-head self-attention sub-layers and multi-behavior multi-layer perceptron sub-layers. The input of this module is the attribute embedding sequence and the behavior sequence, and the output is the fusion attribute interest sequence under the behavior sequence. In order to fully capture the user's interest in each attribute, an independent self-attention module is constructed for each attribute. Each self-attention module is only responsible for processing one attribute information, so as to accurately obtain the user interest hidden in the attribute information;
[0064] (1) Multi-behavior multi-head self-attention sub-layer:
[0065] Assume that the attribute f i The lth layer is a multi-behavior multi-head self-attention sub-layer, defining H( l-1 ) is the output of the l-1th layer, the input of the lth layer, and when l is equal to 1, Define h as the total number of attention heads. For each attention head in the multi-behavior multi-head self-attention sub-layer, H( l-1 ) is transformed into the query vector Q∈R through linear projection n×d , key vector K∈R n×d , value vector V∈R n×d , n is the sequence length, d is the embedding dimension, and the projection transformation formula is (1):
[0066]
[0067] Since the attention method cannot distinguish the relationship between the previous and the next sequence, the rotation position embedding (RoPE) is used to inject position information into the query vector Q, key vector K, and value vector V. The scaled dot product attention of the attention head is calculated as shown in formula (2):
[0068]
[0069] W att ∈R d×d and W agg ∈R d×d It is a parameter matrix generated according to the behavior sequence, which is used to reflect the relationship between the behavior types at different positions in the sequence. att and W agg The generation process is the same as W att For example, create a learnable parameter matrix If the behavior type corresponding to the query vector Q is B i , the behavior type corresponding to the key vector K is B j ,but See formula (3):
[0070]
[0071] The multi-head design can focus on multiple dimensions and aggregate multiple heads before output; definition represents the i-th self-attention head of the multi-head self-attention sub-layer in the l-th layer, h is the number of attention heads, is the parameter matrix of the lth layer. The multi-head aggregation process is shown in formulas (4) and (5):
[0072]
[0073]
[0074] (2) Multi-behavior multi-layer perception machine layer:
[0075] The multi-head self-attention sub-layer aggregation method is based on the linear weighted sum of attention scores, and a multi-layer perceptron is needed to quasi-complement nonlinearity. In order to model the behavior semantics and perform feature conversion, a different multi-layer perceptron sub-layer is specified for each behavior type. X is defined as the input of the multi-layer perceptron. The multi-layer perceptron layer is shown in formula (6):
[0076]
[0077] Multi-behavior multi-head self-attention layer and connection operation Multi-behavior multi-layer perceptron layers are connected through layer normalization and residual connection, see formula (7), (8)
[0078] G (l-1) =LayerNorm(H (l-1) +F msa (H (l-1) )) (7),
[0079] H (l) =LayerNorm(G (l-1) +F mlp (G (l) )) (8),
[0080] (3) Fusion attribute interests:
[0081] The output of the last multi-layer perceptron layer is used as the attribute of the attribute sequence, which includes the output of all behaviors. According to the behavior type of each interaction in the interaction sequence, the output of interest of the corresponding behavior type is selected. For the attribute f i In behavior b j The interest vector extracted under behavior b j Obtaining fusion attribute interest under The process can be obtained by formula (9): is the projection matrix and d is the embedding dimension:
[0082]
[0083] The result is to output the fused attribute interest corresponding to the behavior sequence. The fused attribute interest and behavior sequence will enter the next step of predicting the user-item interest under the specified behavior;
[0084] 3) Predicting user's project interests based on multiple behaviors:
[0085] This step is to predict the user's project interest under the specified behavior, which is called the multi-behavior project prediction module; the fusion attribute interest represents the user's general interest preference, but it cannot be used to predict the user's preference on specific projects. According to the fusion attribute interest, the similarity of each project in the sequence is examined, and the attention mechanism is used to aggregate projects with high similarity. The multi-layer perceptron performs feature transformation. The multi-behavior project prediction module consists of a multi-behavior cross attention layer and a multi-behavior multi-layer perceptron. The input of the module is the fusion attribute interest. Item embedding sequence and behavioral sequences The fused attribute interest is used when calculating the query vector Q, and the item embedding is used when calculating the key vector K and the value vector V, as shown in formula (10):
[0086]
[0087] The method for calculating the attention score is the same as above. It is also necessary to consider the behavior type relationship between the query vector Q and the key vector K, see formula (2). The behavior item prediction module also has a multi-behavior multi-layer perceptron sublayer, see formula (6). The multi-behavior multi-layer perceptron layer outputs the item interest of all behaviors, and selects the output of the corresponding behavior type according to the behavior sequence as the user's item interest.
[0088] 4) Specify the item interest of user behavior and calculate its accuracy:
[0089] The binary cross entropy loss function is used to optimize the model, and the output of the model at time t is O t , the positive example is the real item at the corresponding moment of the historical interaction sequence, denoted by e t , negative examples are randomly selected items that users have not interacted with, denoted as The binary cross entropy loss at this moment is formula (11), where · is the inner product operation:
[0090]
[0091] Define t as the time in the sequence, the total number of which is the length of the sequence N, and the total number of sequences is the total number of users For a single attribute or item, the binary cross entropy loss refers to the sum of the cross entropy of all moments in the entire sequence, see formula (12):
[0092]
[0093] The final loss is the sum of the loss of each attribute and the project loss, see formula (13):
[0094]
[0095] 5) Use deep learning methods to learn parameters and update the model:
[0096] The commonly used gradient descent method, that is, multiple rounds of parameter direction propagation, is used to continuously optimize the model, and Adam is selected as the optimizer.
Claims
1. A sequence recommendation method using multi-attribute and multi-behavior information, characterized in that: The steps include: 1) Data preprocessing and embedding processing: Define the set of all users in the system as The set of user behavior types is represented as The set of all items is The set of project properties defined is For Users The historical interaction sequence of u is expressed as symbol represents the i-th interaction of user u, and each interaction is expressed as Each interaction in the user's historical interaction sequence consists of three parts: project identification, project attributes, and behavior type; the project identification is represented by the project ID. It is the ID of the project; the project attributes include multiple aspects. is the attribute domain of the project; the behavior type refers to the user's interaction method with respect to the project. is the behavior type of the interaction; given a historical interaction sequence S of user u with a length of t u , the task of a recommender system is to predict the next item that a user will interact with Since different users have different levels of activity, the length of their historical interaction sequences will also be different. The model only accepts fixed-length sequences, so it is necessary to convert variable-length interaction sequences into fixed-length sequences. Define n as the maximum length that the model can handle, that is, the sequence length. If the sequence length is greater than n, take the nearest n items. If the sequence length is less than n, use zero padding on the left side of the sequence until the sequence length is n. After converting the variable-length sequence into a fixed-length sequence, the interaction sequence S u Split into three subsequences, namely project ID sequence Item Attribute Sequence Behavior Type Sequence Then the project ID sequence Item Attribute Sequence Perform embedding operation and convert it into embedding sequence. Embedding refers to embedding vector, which is the dense vector representation of entity items in recommendation algorithms. Project ID Sequence After being converted into an embedded sequence, it is expressed as n is the sequence length, d is the embedding dimension; each attribute takes a different value or element, so when embedding the project attributes, each type of attribute is embedded separately, expressed as attribute embedding is the number of attributes contained in the item attribute domain; 2) Extracting user’s attribute interests under multiple behaviors: This step is implemented through a multi-behavior fusion attribute extraction module, which is composed of multiple multi-behavior multi-head self-attention sub-layers and multi-behavior multi-layer perceptron sub-layers. The input of this module is the attribute embedding sequence and the behavior sequence, and the output is the fusion attribute interest sequence under the behavior sequence. In order to fully capture the user's interest in each attribute, an independent self-attention module is constructed for each attribute. Each self-attention module is only responsible for processing one attribute information, so as to accurately obtain the user interest hidden in the attribute information; (1) Multi-behavior multi-head self-attention sub-layer: Assume that the attribute f i The lth layer is a multi-behavior multi-head self-attention sublayer, and H is defined (l-1) is the output of the l-1th layer and the input of the lth layer. When l is equal to 1, Define h as the total number of attention heads. For each attention head in the multi-behavior multi-head self-attention sub-layer, H (l-1) Transformed into query vector Q∈R by linear projection n×d , key vector K∈R n×d , value vector V∈R n×d , n is the sequence length, d is the embedding dimension, and the projection transformation formula is (1): Since the attention method cannot distinguish the relationship between the previous and the next sequence, the rotated position embedding is used to inject position information into the query vector Q, key vector K, and value vector V. The scaled dot product attention of the attention head is calculated as shown in formula (2): W att ∈R d×d and W agg ∈R d×d It is a parameter matrix generated according to the behavior sequence, which is used to reflect the relationship between the behavior types at different positions in the sequence. att and W agg The generation process of W is the same; att During the generation process, we create learnable parameter matrix If the behavior type corresponding to the query vector Q is B i , the behavior type corresponding to the key vector K is B j ,but See formula (3): The multi-head design can focus on multiple dimensions and aggregate multiple heads before output; definition represents the i-th self-attention head of the multi-head self-attention sub-layer in the l-th layer, h is the number of attention heads, is the parameter matrix of the lth layer. The multi-head aggregation process is shown in formulas (4) and (5): (2) Multi-behavior multi-layer perception machine layer: The multi-head self-attention sub-layer aggregation method is based on the linear weighted sum of attention scores, and a multi-layer perceptron is needed to quasi-complement nonlinearity. In order to model the behavior semantics and perform feature conversion, a different multi-layer perceptron sub-layer is specified for each behavior type. X is defined as the input of the multi-layer perceptron. The multi-layer perceptron layer is shown in formula (6): Multi-behavior multi-head self-attention layer and connection operation Multi-behavior multi-layer perceptron layers are connected through layer normalization and residual connection, see formula (7), (8) G (l-1) =LayerNorm(H (l-1) +F msa (H (l-1) )) (7), H (l) =LayerNorm(G (l-1) +F mlp (G (l) )) (8), (3) Fusion attribute interests: The output of the last multi-layer perceptron layer is used as the attribute of the attribute sequence, which includes the output of all behaviors. According to the behavior type of each interaction in the interaction sequence, the output of interest of the corresponding behavior type is selected. For the attribute f i In behavior b j The interest vector extracted under behavior b j Obtaining fusion attribute interest under The process can be obtained by formula (9): is the projection matrix and d is the embedding dimension: The result is to output the fused attribute interest corresponding to the behavior sequence. The fused attribute interest and behavior sequence will enter the next step of predicting the user-item interest under the specified behavior; 3) Predicting user's project interests based on multiple behaviors: This step is to predict the user's project interest under the specified behavior, which is called the multi-behavior project prediction module; the fusion attribute interest represents the user's general interest preference, but it cannot be used to predict the user's preference on specific projects. According to the fusion attribute interest, the similarity of each project in the sequence is examined, and the attention mechanism is used to aggregate projects with high similarity. The multi-layer perceptron performs feature transformation. The multi-behavior project prediction module consists of a multi-behavior cross attention layer and a multi-behavior multi-layer perceptron. The input of the module is the fusion attribute interest. Item embedding sequence and behavioral sequences The fused attribute interest is used when calculating the query vector Q, and the item embedding is used when calculating the key vector K and the value vector V, as shown in formula (10): The method for calculating the attention score is the same as above. It is also necessary to consider the behavior type relationship between the query vector Q and the key vector K, see formula (2). The behavior item prediction module also has a multi-behavior multi-layer perceptron sublayer, see formula (6). The multi-behavior multi-layer perceptron layer outputs the item interest of all behaviors, and selects the output of the corresponding behavior type according to the behavior sequence as the user's item interest. 4) Specify the item interest of user behavior and calculate its accuracy: The binary cross entropy loss function is used to optimize the model, and the output of the model at time t is O t , the positive example is the real item at the corresponding moment of the historical interaction sequence, denoted by e t , negative examples are randomly selected items that users have not interacted with, denoted as The binary cross entropy loss at this moment is formula (11), where · is the inner product operation: Define t as the time in the sequence, the total number of which is the length of the sequence N, and the total number of sequences is the total number of users For a single attribute or item, the binary cross entropy loss refers to the sum of the cross entropy of all moments in the entire sequence, see formula (12): The final loss is the sum of the loss of each attribute and the project loss, see formula (13): 5) Use deep learning methods to learn parameters and update the model: The commonly used gradient descent method, that is, multiple rounds of parameter direction propagation, is used to continuously optimize the model, and Adam is selected as the optimizer.
