Next point of interest recommendation method based on multi-granularity self-attention
Through the multi-grained self-attention network model combining POI sequences and business district sequences, the next interest point is predicted, which solves the problem of ignoring business district transfer mode in the existing technology and improves the accuracy of interest point recommendations.
Patent Information
- Application Number
- CN202011616569.2
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2020-12-30
- Publication Date
- 2024-12-27
- Estimated Expiration
- 2040-12-30
AI Technical Summary
The existing next point of interest recommendation method focuses on the transfer mode on the POI sequence, ignoring the transfer mode between POI business districts, resulting in low recommendation accuracy.
Using a multi-grained self-attention network model, combining POI sequences and POI business district sequences, predicting the user's next point of interest by perceptually encoding and decoding the time and space characteristics, and introducing the user's next POI type and category to predict the next POI type and category. Auxiliary tasks, comprehensive results are recommended.
It effectively improves the model expression ability, captures the ordered transfer mode of two granularities, and improves the accuracy of the recommendation of the next point of interest.
Smart Images

Figure CN112632404B_ABST
Abstract
Description
Technical Field
[0001] The present invention relates to the field of information processing technology. More specifically, the present invention relates to a next point of interest recommendation method based on multi-granularity self-attention. Background Art
[0002] With the rapid development of smart devices, social networks such as WeChat, Weibo, and Facebook have attracted billions of users to exchange and share information. In recent years, a significant advancement in social network applications is the introduction of positioning systems, which has led to the emergence of location-based social networks (LBSNs) such as Foursquare and Yelp. Point of interest (POI) recommendation systems play a vital role in social networks, which can help users discover interesting local attractions or facilities. In addition, it can also help service providers recommend personalized services (such as advertisements) based on users' check-in sequences. However, most next POI recommendations only focus on the transfer pattern on the POI sequence, but ignore the transfer pattern between POI business circles, resulting in low accuracy of next POI recommendation. Summary of the invention
[0003] An object of the present invention is to solve at least the above problems and to provide at least the advantages which will be described hereinafter.
[0004] Another object of the present invention is to provide a next point of interest recommendation method based on multi-granularity self-attention, which can more accurately recommend the next point of interest by applying a multi-granularity self-attention network after comprehensively considering the POI sequence and the POI business district sequence.
[0005] In order to achieve these purposes and other advantages according to the present invention, a next point of interest recommendation method based on multi-granularity self-attention is provided, which includes:
[0006] Constructing a multi-granularity self-attention network model, the multi-granularity self-attention network model comprising: a first encoder for perceptually encoding time, a second encoder for perceptually encoding space, and a decoder for decoding POI features;
[0007] Collecting historical check-in data of multiple users, using the historical check-in data of some users as a training set to train the multi-granularity self-attention network model, using the historical check-in data of another part of users as a test set, and using the trained multi-granularity self-attention network model to predict the user's next point of interest;
[0008] The training set training process and the test set testing process include: extracting a POI sequence containing time features and space features according to the user's historical check-in data, and extracting a POI business district sequence containing time features and space features according to the user's historical check-in data;
[0009] The POI sequence and the POI business district sequence are used as input sequences, and the user's next POI id is obtained by processing the multi-granularity self-attention network model.
[0010] Preferably, the user's historical check-in data includes user ID, POI ID, check-in time, POI category, POI type and POI geographical location.
[0011] Preferably, the decoder comprises a first decoder for decoding the type of POI, a second decoder for decoding the category to which the POI belongs, and a third decoder for decoding the POI id.
[0012] Preferably, the first encoder and the second encoder are both composed of a feature layer, an aggregation layer and a self-attention network.
[0013] Preferably, the process of taking the POI sequence and the POI business district sequence as input sequences and obtaining the user's next POI ID through the multi-granularity self-attention network model includes:
[0014] The time features in the POI sequence are encoded using a first encoder to obtain a time-aware encoding of the POI sequence, the space features in the POI sequence are encoded using a second encoder to obtain a space-aware encoding of the POI sequence, and the time-aware encoding of the POI sequence and the space-aware encoding of the POI sequence are combined to obtain a POI sequence representation;
[0015] The time features in the POI business district sequence are encoded using the first encoder to obtain the time-aware encoding of the POI business district sequence, the space features in the POI business district sequence are encoded using the second encoder to obtain the space-aware encoding of the POI business district sequence, and the time-aware encoding of the POI business district sequence and the space-aware encoding of the POI business district sequence are combined to obtain the POI business district sequence representation;
[0016] The time-aware coding of the POI sequence and the time-aware coding of the POI business district sequence are used as input, and processed by the first decoder to obtain the next POI category prediction value;
[0017] The aggregated representation obtained during the encoding process of the time features in the POI sequence and the aggregated representation obtained during the encoding process of the time features in the POI business district sequence are used as input, and the predicted value of the category to which the next POI belongs is obtained through processing by the second decoder;
[0018] The POI sequence representation, the POI business district sequence representation, the next POI type prediction value and the next POI category prediction value are used as input quantities and processed by the third decoder to obtain the user's next POI id.
[0019] Preferably, the self-attention network adds a layer of feedforward neural network, and the activation function used is the ReLu function.
[0020] Preferably, the activation function of the first decoder is a sigmoid function, and the loss function is a cross entropy loss function.
[0021] Preferably, the loss function of the second decoder is a BPR loss function.
[0022] Preferably, the loss function of the third decoder is a BPR loss function.
[0023] Preferably, an AdaGrad optimizer is used in the training process of the multi-granularity self-attention network model.
[0024] The present invention includes at least the following beneficial effects: the present invention takes the POI sequence as a fine-grained sequence and the POI business district sequence as a coarse-grained sequence, and performs modeling at two levels of coarse-grained sequence and fine-grained sequence, which can effectively improve the model expression ability, adopts a multi-granularity self-attention network to capture the ordered transfer mode of the two granularities, and introduces an active task for predicting the type of the next point of interest and an auxiliary task for predicting the category to which the next point of interest belongs. Finally, the coarse-grained and fine-grained sequence representation and the results of the two tasks are combined to recommend the next point of interest. Compared with the recommendation of a single POI sequence, the present invention greatly improves the recommendation accuracy.
[0025] Other advantages, objectives and features of the present invention will be embodied in part through the following description, and in part will be understood by those skilled in the art through study and practice of the present invention. BRIEF DESCRIPTION OF THE DRAWINGS
[0026] Figure 1 A flowchart of the next point of interest recommendation method based on multi-granularity self-attention according to the present invention;
[0027] Figure 2 A flowchart of the training and testing process of the multi-granularity self-attention network model of the present invention;
[0028] Figure 3 A flowchart of the encoding and decoding process of the multi-granularity self-attention network model of the present invention;
[0029] Figure 4 The figure is a diagram of the historical access records of the user Alice according to one embodiment of the present invention. DETAILED DESCRIPTION
[0030] The present invention is further described in detail below in conjunction with the accompanying drawings so that those skilled in the art can implement the invention with reference to the description.
[0031] It should be noted that the embodiments described in this application are only part of the embodiments of this application, not all of the embodiments. Based on the embodiments in this application, all other embodiments obtained by ordinary technicians in this field without creative work are within the scope of protection of this application.
[0032] like Figure 1 As shown, the present invention provides a next point of interest recommendation method based on multi-granularity self-attention, which includes:
[0033] S101, constructing a multi-granularity self-attention network model, wherein the multi-granularity self-attention network model includes: a first encoder for perceptually encoding time, a second encoder for perceptually encoding space, and a decoder for decoding POI features;
[0034] Here, both the first encoder and the second encoder consist of a feature layer, an aggregation layer, and a self-attention network.
[0035] The self-attention network uses the attention mechanism to calculate the correlation between each feature and all other features. To calculate the self-attention score, there are mainly the following processes:
[0036] First, we get Q, K, and V by multiplying the input matrix X with the weight matrix:
[0037] Q=XW Q ;
[0038] K=XW K ;
[0039] V=XW V ;
[0040] Secondly, we perform operations on Q, K, and V, and normalize the results using the softmax function:
[0041]
[0042] in, The purpose is to scale the results. Since the previous calculations are all linear calculations, in order to make the model have better nonlinear fitting capabilities, a feedforward neural network is added, and the activation function used is the ReLu function:
[0043] F = FFN (Z) = ReLu (ZW1 + b1);
[0044] Finally, the result F of the self-attention network is obtained.
[0045] Here, the POI features include POI id, POI category, POI type and POI geographic location. The decoder for decoding the POI features includes a first decoder for decoding the POI type, a second decoder for decoding the POI category and a third decoder for decoding the POI id.
[0046] S102, collecting historical check-in data of multiple users, using the historical check-in data of some users as a training set to train the multi-granularity self-attention network model, using the historical check-in data of another part of users as a test set, and using the trained multi-granularity self-attention network model to predict the user's next point of interest;
[0047] For example, there are 10 users, each with some historical records, assuming they are all p1~p 10 During training, in the training set, for each user, p1~p9 are used for training to predict p 10 , assuming that the ratio of training set to test set is 8:2, that is, 8 user history records are used for training to obtain the learnable parameters of the multi-granularity self-attention network model, and 2 user history records are used as test sets for separate testing to predict the user's next point of interest. Of course, this is just an example. In actual application, the number of training sets will continue to grow as the number of users increases, so that the prediction results of the multi-granularity self-attention network model will become more and more accurate.
[0048] The training set training process and the test set testing process include:
[0049] S201, extracting a POI sequence including time features and space features according to the user's historical check-in data, and extracting a POI business district sequence including time features and space features according to the user's historical check-in data;
[0050] Here, the user's historical check-in data includes user id (u), POI id (p), check-in time (t), POI category (c), POI type (y) and POI geographic location (g), which are expressed as parameters (u, p, t, c, y, g).
[0051] Here, the user id (u), POI id (p), check-in time (t), and POI location (g) are relatively easy to understand. The POI category (c) can be roughly divided into: catering, hospital, education, etc. For the POI type (y), we use the following example to explain:
[0052] like Figure 4As shown in the figure, user Alice has the following historical access records on the electronic map: p2→p3→…→p8. Among them, individual POIs p2, p3, p4, and p5 are in the business district POI p1. In this model, the POI sequence (fine-grained sequence) is p2→p3→…→p8, and the POI business district sequence (coarse-grained sequence) is p1→p6→p7→p8, among which p2→p3→p4→p5 is simplified to the business district POI p1. Since individual POIs p6, p7, and p8 do not have corresponding POI business districts at a higher granularity, in order to maintain the integrity of the sequence context semantics, we still retain p6, p7, and p8. If the POI category (y) is distinguished by 0 and 1, then in the POI sequence, the value of the category (y) of POIs p2 to p8 is 0, and in the POI business district sequence, the value of the category (y) to which p1 belongs is 1.
[0053] In the POI sequence, is the time feature of user u at time n, is the spatial feature of user u at time n. Similarly, in the POI business district sequence, is the temporal feature of user u at time n, is the spatial feature of user u at time n.
[0054] S202: Taking the POI sequence and the POI business district sequence as input sequences, and processing them through the multi-granularity self-attention network model to obtain the user's next POI id.
[0055] The above steps specifically include the following processes:
[0056] S301: Use a first encoder to encode time features in a POI sequence to obtain a time-aware encoding of the POI sequence.
[0057] In the POI sequence, is the temporal feature of user u at time n. The first encoder consists of a feature layer, an aggregation layer, and a self-attention network.
[0058] First, the temporal feature aggregation is expressed as:
[0059]
[0060] in, It is the type of embedding. It is the embedding that maps the timestamp to 24 hours. is the embedding of the category, b1 is a learnable parameter.
[0061] Next, the aggregated representation of the temporal features is fed into the self-attention network to obtain the temporal-aware encoding of the POI sequence:
[0062]
[0063] Among them, SAN stands for Self-Attention Network. It represents the time-aware encoding of POI sequence.
[0064] The second encoder is used to encode the spatial features in the POI sequence to obtain the spatial perception coding of the POI sequence, and the time perception coding of the POI sequence and the spatial perception coding of the POI sequence are combined to obtain the POI sequence representation.
[0065] In the POI sequence, is the spatial feature of user u at time n. It is worth noting that in the process of extracting features, That is, the spatial coordinates, but the interval between the current position and the previous position is recorded as The second encoder also consists of a feature layer, an aggregation layer, and a self-attention network.
[0066] First, the spatial feature aggregation is expressed as:
[0067]
[0068] in, The corresponding embedding for POI id, is the distance between the current position and the previous position, b2 is a learnable parameter.
[0069] Next, The type of is set to integer to reduce the computational complexity, and then the aggregated representation of the spatial feature is sent to the self-attention network to obtain the spatial perception encoding of the POI sequence:
[0070]
[0071] Among them, SAN stands for Self-Attention Network. It represents the spatial perception coding of the POI sequence. Finally, the temporal perception coding and spatial perception coding of the POI sequence are combined to form the POI sequence representation:
[0072]
[0073] S302: Use a first encoder to encode the time features in the POI business district sequence to obtain a time-aware encoding of the POI business district sequence.
[0074] In the POI business district sequence, is the temporal feature of user u at time n. The first encoder consists of a feature layer, an aggregation layer, and a self-attention network.
[0075] First, the temporal feature aggregation is expressed as:
[0076]
[0077] in, It is the type of embedding. It is the embedding that maps the timestamp to 24 hours. is the embedding of the category, b3 is a learnable parameter.
[0078] Next, the aggregated representation of temporal features is fed into the self-attention network to obtain the temporal-aware encoding of the POI business district sequence:
[0079]
[0080] Among them, SAN stands for self-attention network, It represents the time-aware encoding of the POI business district sequence.
[0081] The spatial features in the POI business district sequence are encoded using a second encoder to obtain a spatial perception encoding of the POI business district sequence, and the POI business district sequence representation is obtained by combining the time perception encoding of the POI business district sequence and the spatial perception encoding of the POI business district sequence;
[0082] In the POI business district sequence, is the spatial feature of user u at time n. It is worth noting that in the process of extracting features, That is, the spatial coordinates, but the interval between the current position and the previous position is recorded as The second encoder also consists of a feature layer, an aggregation layer, and a self-attention network.
[0083] First, the spatial feature aggregation is expressed as:
[0084]
[0085] in, The corresponding embedding for POI id, is the distance between the current position and the previous position, b4 is a learnable parameter.
[0086] Next, The type of is set to integer to reduce the computational complexity, and then the aggregated representation of the spatial feature is sent to the self-attention network to obtain the spatial perception encoding of the POI business district sequence:
[0087]
[0088] Among them, SAN stands for Self-Attention Network. It represents the spatial perception coding of the POI business district sequence. Finally, the temporal perception coding and spatial perception coding of the POI business district sequence are combined to form the POI business district sequence representation:
[0089]
[0090] S303, taking the time-aware coding of the POI sequence and the time-aware coding of the POI business district sequence as input, and processing them through a first decoder to obtain a prediction value of the next POI category;
[0091] To predict the next POI category, we use time-aware encodings from two sequences to represent:
[0092]
[0093]
[0094] in, is the aggregation of the time-aware encoders of the two sequences, σ is the sigmoid function, is the predicted value of the next POI category.
[0095] For the prediction of the next POI category, we use the cross-entropy loss function:
[0096]
[0097] S304, using the aggregated representation obtained during the encoding process of the time features in the POI sequence and the aggregated representation obtained during the encoding process of the time features in the POI business district sequence as input, and processing them through a second decoder to obtain a predicted value of the category to which the next POI belongs;
[0098] In order to predict the category of the next POI, we first calculate the temporal encoding aggregation representation from the two sequences, and then calculate the aggregation A of the two temporal encoding aggregation representations rep , and finally calculate the category to which the next POI belongs:
[0099]
[0100]
[0101]
[0102]
[0103] Among them, A rep is the time-aware representation, For users, is the predicted value of the category to which the next POI belongs.
[0104] For the prediction of the category to which the next POI belongs, we use the BPR loss function:
[0105]
[0106] S305 , taking the POI sequence representation, the POI business district sequence representation, the next POI type prediction value and the next POI category prediction value as input, and processing through a third decoder to obtain the user's next POI id.
[0107] In order to recommend the next POI, we first aggregate the POI sequence representation, POI business district sequence representation, next POI category prediction value, and next POI category prediction value, and then calculate the aggregation P of the two sequence space encoding aggregation representations. rep , and finally recommend the next POI id:
[0108]
[0109]
[0110]
[0111]
[0112]
[0113]
[0114] in, is the aggregation of the first encoder result and the second encoder result for different sequences, is a multi-granularity sequence representation, P rep is the spatial perception representation, For users, Predict the next POI id for the user.
[0115] To recommend the next POI, we use the BPR loss function:
[0116]
[0117] For the total loss function, there is the following expression:
[0118]
[0119] Among them, λ y ,λ c and λ p Used to adjust different losses, λ y +λ c +λ p =1, λ is the regularization coefficient, Θ=(W,b) is the set of learnable parameters.
[0120] Here, when steps S303 to S305 are performed during the training process, the AdaGrad optimizer is also used to optimize the training process of the learnable parameters.
[0121] The method in the above embodiment takes the POI sequence as a fine-grained sequence and the POI business district sequence as a coarse-grained sequence, and performs modeling at two levels of coarse-grained sequence and fine-grained sequence, which can effectively improve the model expression ability, adopts a multi-granularity self-attention network to capture the ordered transfer pattern of the two granularities, and introduces an active task for predicting the type of the next point of interest and an auxiliary task for predicting the category to which the next point of interest belongs. Finally, the coarse-grained and fine-grained sequence representation and the results of the two tasks are combined to recommend the next point of interest. Compared with the single POI sequence recommendation, the present invention greatly improves the recommendation accuracy.
[0122] Although the embodiments of the present invention have been disclosed as above, they are not limited to the applications listed in the specification and the implementation modes, and they can be fully applied to various fields suitable for the present invention. For those familiar with the art, additional modifications can be easily implemented. Therefore, without departing from the general concept defined by the claims and the scope of equivalents, the present invention is not limited to the specific details and the illustrations shown and described herein.
Claims
1. The next point of interest recommendation method based on multi-granularity self-attention is characterized by: include: Constructing a multi-granularity self-attention network model, the multi-granularity self-attention network model comprising: a first encoder for perceptually encoding time, a second encoder for perceptually encoding space, and a decoder for decoding POI features; Collecting historical check-in data of multiple users, using the historical check-in data of some users as a training set to train the multi-granularity self-attention network model, using the historical check-in data of another part of users as a test set, and using the trained multi-granularity self-attention network model to predict the user's next point of interest; The training set training process and the test set testing process include: extracting a POI sequence containing time features and space features according to the user's historical check-in data, and extracting a POI business district sequence containing time features and space features according to the user's historical check-in data; Taking the POI sequence and the POI business district sequence as input sequences, the multi-granularity self-attention network model is used to process and obtain the user's next POI id; The user's historical check-in data includes user ID, POI ID, check-in time, POI category, POI type and POI geographic location; The decoder includes a first decoder for decoding the type of POI, a second decoder for decoding the category to which the POI belongs, and a third decoder for decoding the POI id; The first encoder and the second encoder are both composed of a feature layer, an aggregation layer and a self-attention network; The process of taking the POI sequence and the POI business district sequence as input sequences and obtaining the user's next POI ID through the multi-granularity self-attention network model includes: The time features in the POI sequence are encoded using a first encoder to obtain a time-aware encoding of the POI sequence, the space features in the POI sequence are encoded using a second encoder to obtain a space-aware encoding of the POI sequence, and the time-aware encoding of the POI sequence and the space-aware encoding of the POI sequence are combined to obtain a POI sequence representation; The time features in the POI business district sequence are encoded using the first encoder to obtain the time-aware encoding of the POI business district sequence, the space features in the POI business district sequence are encoded using the second encoder to obtain the space-aware encoding of the POI business district sequence, and the time-aware encoding of the POI business district sequence and the space-aware encoding of the POI business district sequence are combined to obtain the POI business district sequence representation; The time-aware coding of the POI sequence and the time-aware coding of the POI business district sequence are used as input, and processed by the first decoder to obtain the next POI category prediction value; The aggregated representation obtained during the encoding process of the time features in the POI sequence and the aggregated representation obtained during the encoding process of the time features in the POI business district sequence are used as input, and the predicted value of the category to which the next POI belongs is obtained through processing by the second decoder; The POI sequence representation, the POI business district sequence representation, the next POI type prediction value and the next POI category prediction value are used as input quantities and processed by the third decoder to obtain the user's next POI id.
2. The next point of interest recommendation method based on multi-granularity self-attention as claimed in claim 1, characterized in that: The self-attention network adds a layer of feedforward neural network, and the activation function used is the ReLu function.
3. The next point of interest recommendation method based on multi-granularity self-attention as claimed in claim 1, characterized in that: The activation function of the first decoder is a sigmoid function, and the loss function is a cross entropy loss function.
4. The next point of interest recommendation method based on multi-granularity self-attention as claimed in claim 1, characterized in that: The loss function of the second decoder is a BPR loss function.
5. The next point of interest recommendation method based on multi-granularity self-attention as claimed in claim 1, characterized in that: The loss function of the third decoder is a BPR loss function.
6. The next point of interest recommendation method based on multi-granularity self-attention as claimed in claim 1, characterized in that: The AdaGrad optimizer is used in the training process of the multi-granularity self-attention network model.