Disclosure of Invention
The application provides a next interest point recommending method, device, equipment and storage medium, which can solve the technical problems of high dependence on priori knowledge and over-smoothness and over-correlation caused by realizing POI recommendation based on a predefined graph structure in the prior art.
In a first aspect, an embodiment of the present application provides a next point of interest recommendation method, where the next point of interest recommendation method includes:
Acquiring all target interest point embedding matrixes corresponding to historical interest points from a preset embedding matrix library, wherein the interest point embedding matrixes in the embedding matrix library are generated based on a preset decorrelation self-adaptive simple graph learning network, and the historical interest points are interest points contained in a historical sign-in sequence corresponding to a target user;
Determining all target interest point vectors based on all target interest point embedding matrixes, and performing position coding processing on all target interest point vectors to obtain a user access sequence;
performing space-time interval calculation and embedding operation on the historical sign-in sequence to generate a time embedding matrix and a space embedding matrix;
performing attention processing on the user access sequence, the time embedding matrix and the space embedding matrix based on a preset self-attention module so as to output the next interest point corresponding to the target user;
the construction method of the decorrelation self-adaptive simple graph learning network comprises the steps of obtaining an initial embedding matrix after embedding all interest points, performing cosine similarity calculation on the initial embedding matrix to construct a self-adaptive simple graph, controlling the self-adaptive simple graph to perform propagation learning, and performing layer-by-layer noise reduction on the self-adaptive simple graph through an orthogonal regularized graph signal noise reduction method in the propagation learning process of the self-adaptive simple graph to generate the decorrelation self-adaptive simple graph learning network.
With reference to the first aspect, in an implementation manner, the self-attention module includes an additional residual mechanism, and the output of the self-attention module is controlled based on the additional residual mechanismThe method comprises the following steps:
In the formula, Representing a feed-forward neural network,The representation layer is normalized and,The mechanism of attention is indicated and,Representing the input of the self-attention module.
With reference to the first aspect, in an implementation manner, the attention mechanism is a mechanism that combines local attention with global attention, and the local attention implements local attention coefficient calculation through a local mask to re-weight recently accessed historical points of interest.
With reference to the first aspect, in one embodiment, the local attention coefficientThe calculation formula of (2) is as follows:
In the formula, Representing the local attention coefficient corresponding to the j-th element of the i-th row in the local attention coefficient matrix,Represents the attention score corresponding to the j-th element of the i-th row in the attention score matrix,Indicating the size of the local field of view.
With reference to the first aspect, in one implementation manner, the self-attention module includes an additional loss function, where the additional loss function is used to reduce similarity of content learned by a multi-head attention mechanism in the self-attention module, and the additional loss function is:
In the formula, Represent the firstAttention loss by the layer attention module,Representing the length of the historical check-in sequence,The number of attention headers is indicated,Represent the firstLayer attention module of the first layerThe number of attention points of the user is that,Represent the firstLayer attention module of the first layerAnd a plurality of attention heads.
With reference to the first aspect, in one implementation manner, a noise reduction formula corresponding to the orthogonal regularization graph signal noise reduction method is:
In the formula, An embedding matrix representing the output of the neural network of figures,Representing the embedded matrix after noise reduction,Representing the embedding matrix of the input map neural network,AndThe super-parameter is represented by a parameter,Representing the normalized laplace matrix,Representing the identity matrix.
With reference to the first aspect, in one implementation manner, the propagation rule of each layer in the decorrelation adaptive simple graph is:
In the formula, Representing warpThe embedded matrix output after layer propagation,Representing warpAn embedding matrix of the layer 1 post-propagation output,The super-parameter is represented by a parameter,Representing the laplace normalized join-self connected adjacency matrix.
In a second aspect, an embodiment of the present application provides a next point of interest recommendation device, where the next point of interest recommendation device includes:
The first processing module is used for acquiring all target interest point embedding matrixes corresponding to the historical interest points from a preset embedding matrix library, wherein the interest point embedding matrixes in the embedding matrix library are generated based on a preset decorrelation self-adaptive simple graph learning network, and the historical interest points are interest points contained in a historical sign-in sequence corresponding to a target user;
The second processing module is used for determining all target interest point vectors based on all target interest point embedding matrixes and carrying out position coding processing on all target interest point vectors so as to obtain a user access sequence;
the third processing module is used for performing space-time interval calculation and embedding operation on the historical sign-in sequence to generate a time embedding matrix and a space embedding matrix;
the interest point recommendation module is used for carrying out attention processing on the user access sequence, the time embedding matrix and the space embedding matrix based on the preset self-attention module so as to output the next interest point corresponding to the target user;
The model construction module is used for obtaining an initial embedding matrix after embedding all the interest points, performing cosine similarity calculation on the initial embedding matrix to construct an adaptive simple graph, controlling the adaptive simple graph to perform propagation learning, and performing layer-by-layer noise reduction on the adaptive simple graph through an orthogonal regularization graph signal noise reduction method in the propagation learning process of the adaptive simple graph so as to generate a decorrelation adaptive simple graph learning network.
With reference to the second aspect, in one embodiment, the self-attention module includes an additional residual mechanism, and the output of the self-attention module is controlled based on the additional residual mechanismThe method comprises the following steps:
In the formula, Representing a feed-forward neural network,The representation layer is normalized and,The mechanism of attention is indicated and,Representing the input of the self-attention module.
With reference to the second aspect, in one embodiment, the attention mechanism is a mechanism that combines local attention with global attention, and the local attention implements local attention coefficient calculation through a local mask to re-weight recently accessed historical points of interest.
With reference to the second aspect, in one embodiment, the local attention coefficientThe calculation formula of (2) is as follows:
In the formula, Representing the local attention coefficient corresponding to the j-th element of the i-th row in the local attention coefficient matrix,Represents the attention score corresponding to the j-th element of the i-th row in the attention score matrix,Indicating the size of the local field of view.
With reference to the second aspect, in one implementation manner, the self-attention module includes an additional loss function, where the additional loss function is used to reduce similarity of content learned by a multi-head attention mechanism in the self-attention module, and the additional loss function is:
In the formula, Represent the firstAttention loss by the layer attention module,Representing the length of the historical check-in sequence,The number of attention headers is indicated,Represent the firstLayer attention module of the first layerThe number of attention points of the user is that,Represent the firstLayer attention module of the first layerAnd a plurality of attention heads.
With reference to the second aspect, in one embodiment, a noise reduction formula corresponding to the orthogonal regularization map signal noise reduction method is:
In the formula, An embedding matrix representing the output of the neural network of figures,Representing the embedded matrix after noise reduction,Representing the embedding matrix of the input map neural network,AndThe super-parameter is represented by a parameter,Representing the normalized laplace matrix,Representing the identity matrix.
With reference to the second aspect, in one embodiment, the propagation rule of each layer in the decorrelation adaptive simple graph is:
In the formula, Representing warpThe embedded matrix output after layer propagation,Representing warpAn embedding matrix of the layer 1 post-propagation output,The super-parameter is represented by a parameter,Representing the laplace normalized join-self connected adjacency matrix.
In a third aspect, an embodiment of the present application provides a next-point-of-interest recommendation device, where the next-point-of-interest recommendation device includes a processor, a memory, and a next-point-of-interest recommendation program stored on the memory and executable by the processor, where the next-point-of-interest recommendation program, when executed by the processor, implements the steps of the next-point-of-interest recommendation method as described above.
In a fourth aspect, an embodiment of the present application provides a computer readable storage medium having stored thereon a next point of interest recommendation program, wherein the next point of interest recommendation program, when executed by a processor, implements the steps of the next point of interest recommendation method as described above.
The technical scheme provided by the embodiment of the application has the beneficial effects that:
Obtaining an initial embedding matrix after embedding all the interest points, selecting cosine similarity to calculate the similarity of the initial embedding matrix, and constructing a self-adaptive adjacent matrix to construct a self-adaptive simple graph; in the process of propagation learning of the self-adaptive simple graph, the forward propagation method of the self-adaptive simple graph is modified by carrying out layer-by-layer noise reduction on the self-adaptive simple graph through an orthogonal regularization graph signal noise reduction method, so that the influence of priori experience is reduced by only concerning the relation between each dimension of POI embedding, POI embedding with rich expression capability can be learned, then the problems of over smoothing and over correlation are relieved to a certain extent, thereby constructing a decorrelation self-adaptive simple graph learning network with low dependence on priori knowledge and the problems of over smoothing and over correlation are relieved, therefore, when the next POI recommendation is required to be carried out for a target user, all target interest point embedding matrixes with rich expression capability, which correspond to all historical interest points in a historical signing sequence, can be obtained from all interest point embedding matrixes with rich expression capability generated by the decorrelation self-adaptive simple graph, all target interest point embedding matrixes are determined based on all target interest point vectors, and the position coding processing is carried out on all target interest point vectors to obtain a user access sequence, then time-space interval calculation and embedding operation are carried out on the historical signing sequence to generate a time embedding matrix and a space embedding matrix, and finally the target interest point embedding matrix can be accurately processed on the user interest point embedding matrix under the time-interest point prediction module. Therefore, the method and the device can effectively reduce the dependence of POI recommendation on priori knowledge and relieve the problems of over-smoothing and over-correlation.
Detailed Description
In order that those skilled in the art will better understand the present application, a technical solution in the embodiments of the present application will be clearly and completely described below with reference to the accompanying drawings in which it is apparent that the described embodiments are only some embodiments of the present application, not all embodiments. All other embodiments, which can be made by those skilled in the art based on the embodiments of the application without making any inventive effort, are intended to be within the scope of the application.
First, some technical terms in the present application are explained so as to facilitate understanding of the present application by those skilled in the art.
Definition 1 (check-in sequence) orderRepresenting the total number of users that are present,Representing all POIs, wherein each POIAre all matched with a unique longitude and latitude geographic coordinateAssociated with, it should be noted that each user signs in recordCan be expressed as tripletsWhich represents the userAt the moment of timeAccessing the firstThe user's check-in sequence can be expressed as, wherein,Representing a userIs a check-in total number of (c).
Definition 2 (next POI recommendation) given a userAnd its slave time of dayTo the point ofIs a sign-in sequence of (c)The goal of the next POI recommendation task is to generate the next moment based on its historical trackA list of top k POIs most likely to be accessed by the user.
Simple graph rolling network (SIMPLE GRAPH Convolutional Network, SGCN) for an undirected graphWhereinAndRepresenting the vertex set, the edge set and the adjacent matrix respectively, wherein the number of rows of the adjacent matrix A is equal to the number N of the vertexes contained in the vertex set V of the graph, namely the adjacent matrix A is an N multiplied by N matrix, and the back propagation rule of SGCN th layer based on the number N is as follows:
In the formula, The activation function is represented as a function of the activation,Representing joining of self-connected adjacency matrices andAdding self-join refers to adding an edge to each node that is connected to itself,Representing the identity matrix of the cell,Is a diagonal matrix, the diagonal elements of which are formed byCorresponding to the sum of the row elements, thenThe value of the ith row and ith column of (a) is equal toThe sum of the values of row i and column j, i.e,Is a matrix that can be learned.
For a pair ofThe Laplace normalization is performed so that, for preventing gradient explosion in the process of graph rolling, namely,Representing a laplace normalized join-self-join adjacency matrix, wherein SGCN linearizes the conventional GCN (Graph Convolutional Network, graph rolling network) propagation rule:
Unlike conventional GCN, SGCN directly constructs the output Instead of defining the propagation process for each layer, i.e. when SGCN is associated with the GCN, the propagation process for SGCN can be considered as:
it is to be noted that, Not the final output, when the final result of SGCN is needed, the result is neededDoing a linear transformation without bias term, in other words, at outputWhen in layer, it is combined with the compound of formula (2)By matrix multiplication, i.e. byWhereas in deep learning, the linear transformation is usually expressed as,Is a matrix of weights that can be learned,Is a bias term, soReferred to as a linear transformation without bias terms.
For the purpose of making the objects, technical solutions and advantages of the present application more apparent, the embodiments of the present application will be described in further detail with reference to the accompanying drawings.
In a first aspect, an embodiment of the present application provides a method for recommending a next point of interest.
In an embodiment, referring to fig. 1, fig. 1 is a flowchart illustrating an embodiment of a method for recommending points of interest according to the present application. As shown in fig. 1, the next point of interest recommendation method includes:
Step S10, obtaining all target interest point embedding matrixes corresponding to historical interest points from a preset embedding matrix library, wherein the interest point embedding matrixes in the embedding matrix library are generated based on a preset decorrelation self-adaptive simple graph learning network, the historical interest points are interest points contained in a historical sign-in sequence corresponding to a target user, the construction method of the decorrelation self-adaptive simple graph learning network comprises the steps of obtaining initial embedding matrixes after embedding operation is carried out on all the interest points, carrying out cosine similarity calculation on the initial embedding matrixes to construct a self-adaptive simple graph, controlling the self-adaptive simple graph to carry out propagation learning, and carrying out layer-by-layer noise reduction on the self-adaptive simple graph through an orthogonal regularization graph signal noise reduction method in the propagation learning process of the self-adaptive simple graph to generate the decorrelation self-adaptive simple graph learning network.
By way of example, it should be appreciated that the predefined graph structure does not introduce excessive prior knowledge, while the adaptive graph structure inherits the GNN-critical neighbor aggregation concept and nonlinear transformation to embed the adjacency matrix generation by POI, i.e., measure the distance between POI by some distance measure, thereby forming the weight of the edge, therefore, the adaptive graph method can avoid introducing excessive prior factors and generate a varying graph structure via the learning process of the model, thereby improving the quality of POI embedding.
It should be noted that although the adaptive graph approach produces good results, the learned POI embedding tends to be poor in the absence of guidance, so that the quality of the learned POI embedding can be improved by introducing a measure of KL divergence during graph learning, but this approach to approximating the learned distribution to the distribution derived from prior knowledge introduces additional domain knowledge (i.e., prior knowledge) such that the adaptive graph approach is far from its original purpose (i.e., reduces prior knowledge), and it is the relationship between the two POI matrices that is to be compared, assuming the number of POIs isThen the spatial complexity of the two matrices that it is required to compare isThis results in the method not being able to calculate over a large data set.
In this embodiment, in order to reduce the influence of human factors in the process of graph learning, a decorrelation adaptive graph method is proposed by exploring graph structure learning, so as to reduce the dependence of POI recommendation on priori knowledge by constructing a decorrelation adaptive simple graph learning network. Specifically, referring to FIG. 2, it is necessary to first address all POIs before constructing the graph structurePerforming embedding operation to realize initial embedding, thereby obtaining an initial embedding matrix,Representing the embedding dimension to facilitate the learning of relationships between subsequent POIs, followed by construction of the graph structure, although selecting which distance metric to construct the adjacency matrix is a primary issue, wherein cosine similarity may be preferred as the metric in this embodiment, but the weight matrix is discarded in performing distance metricsI.e. directly calculating the distance between POI embeddings to reduce the number of parameters, wherein each term of the adjacency matrixThe calculation method is as follows:
In the formula, Meaning that the cosine similarity between the two vectors is calculated, it should be noted here,Negative numbers are unreasonable as weights, whereas conventional methods typically choose a certain value as a threshold to filter unreasonable values, e.g., setting the threshold to 0, corresponds to using Relu functions on each value, but this results in a portion of the elements of the adjacency matrix not being able to counter-propagate, so as to limit the magnitude of the gradient of POI embedding, while the present embodiment uses sigmoid functions to map it toStrictly is mapped toDue toThe input range avoids the saturation region of sigmoid, so when the counter-propagation gradient flows through the adjacency matrix, the problem of gradient explosion or gradient disappearance is less likely to occur, and the adjacency matrix at the moment can be expressed as:
In the formula, Representing an element-by-element sigmoid calculation,Representing an initial embedding matrixCosine similarity between rows in the middle (including between a row and the row itself), it should be noted that for better explanationCan be used forIn the form ofI.e.Represents the firstWhileRepresents the secondThenRepresenting a first pair matrixAndPerforming line normalization to obtainAndThen, matrix multiplication is performedIt can be seen that an adaptive simple graph (ADAPTIVE SIMPLE GRAPH Convolutional Network, ASGCN) as shown in fig. 2 can be constructed from the above-described adjacency matrix.
Not only is it inadequate to construct ASGCN as shown in fig. 2 because it loses non-linear activation, but there is no reliable way to direct its learning process, but it also faces problems of overcorrection and overcorrection such that it learns of low quality POI embeddings. Referring to fig. 2, in this embodiment, each layer ASGCN is regarded as a separate graph denoising process, and the forward propagation method is modified by a decorrelation method, so as to learn high-quality POI embedding without introducing too much prior experience, that is, the quality of the learned POI embedding is improved by integrating the gradient of the orthogonal regularized graph signal denoising method into the propagation process of the graph, so as to implement decorrelation; it should be understood that the orthogonal regularized graph signal noise reduction method forces the columns of the graph node embedding matrix to be orthogonal, so that the difference between the columns is increased, that is, the similarity of each dimension in the vector of the graph node is reduced, so that more information is obtained, the learned POI embedding can express richer information, and therefore, the embodiment reduces the influence of priori experience by only concerning the relationship between the dimensions of the POI embedding itself, and alleviates the problems of over-smoothing and over-correlation to a certain extent.
Furthermore, to avoid gradient explosions, this embodiment will normalize the embedding column after propagation:
In the formula, Representing warpEmbedding matrix of layer propagated output, thus, when the graph hasIn layer, the self-adaptive simple graph of decorrelation is implemented by firstly embedding an input initial embedding matrixDoing the following stepsThe next time isThe number of layers representing the graph method) with column normalization, and then performing a linear transformation without bias terms, thereby completing the construction of the decorrelation self-adaptive simple graph learning network.
In the embodiment, the POI embedding matrix with rich expression capability corresponding to each POI is generated through the constructed decorrelation self-adaptive simple graph learning network to form an embedding matrix library, so that when the next POI recommendation is carried out on the target user, the target POI embedding matrix corresponding to each historical POI contained in the historical sign-in sequence of the target user is directly acquired from the embedding matrix library. Wherein, the historical check-in sequence refers to a sequence formed by checking in by the target user in the past period of time, and comprises all points of interest visited by the target user in the past period of time.
Further, in an embodiment, the noise reduction formula corresponding to the orthogonal regularization graph signal noise reduction method is:
In the formula, An embedding matrix representing the output of the neural network of figures,Representing the embedded matrix after noise reduction,Representing the embedding matrix of the input map neural network,AndThe super-parameter is represented by a parameter,Representing the normalized laplace matrix,Representing the identity matrix.
The propagation rule of each layer in the decorrelation adaptive simple graph is as follows:
In the formula, Representing warpThe embedded matrix output after layer propagation,Representing warpAn embedding matrix of the layer 1 post-propagation output,The super-parameter is represented by a parameter,Representing the laplace normalized join-self connected adjacency matrix.
By way of example, it should be appreciated that the orthogonal regularization graph signal noise reduction formula is as follows:
In the formula, An embedding matrix representing the output of the neural network of figures,Representing the embedded matrix after noise reduction,Representing the embedding matrix of the input map neural network,AndAll of which represent the super-parameters,Represents a normalized Laplace matrix, anWherein the pair of SGCN needs to be calculated when it is layer-by-layer noise-reduced using the formula (7)The specific calculation formula is as follows:
initial embedding matrix for POI In the first placeThe propagation rule of the layer is:
In the formula, Representing warpThe embedded matrix output after layer propagation,Representing warpAn embedding matrix of the layer 1 post-propagation output,Representing a super parameter, which is used to control the rate of modification to the original output size,Representing a Laplace normalized join-self-join adjacency matrix, since SGCN is considered a layer-by-layer single-step graph noise reduction in this embodiment, letThe modified propagation rule is:
to more clearly describe the graph propagation process incorporating the orthogonal regularized graph signal noise reduction method, the input may be processed Is marked asThen the decorrelation adaptive simple map is calculated as follows:
By passing through After the treatment of the above process, forPerforming a linear transformation without bias:
Then a processed POI embedded matrix can be obtained I.e. learned POI embedding matrices with rich expression.
And step S20, determining all target interest point vectors based on all target interest point embedding matrixes, and carrying out position coding processing on all target interest point vectors to obtain a user access sequence.
In this embodiment, the encoding of the check-in sequence is performed based on the POI embedding matrix rich in expression after the POI embedding matrix is obtained. It should be understood that, the next POI recommendation task presumes the most likely position to be accessed by the user at the next moment based on the user's historical track, then the access track of the target user needs to be processed into a fixed length n, if the length is greater than n, then the target user is truncated, and only the latest n pieces of data are reserved to form a historical sign-in sequenceIf the length is less than n, then filling to the left until the length is n to form a historical sign-in sequenceHowever, for more general expression, the present embodiment will be usedTo the point ofTo represent filled or truncated usersN access footprints of (i.e. historical sign-in sequence is。
At the time of obtaining the historical sign-in sequenceTarget POI embedded matrix of each historical POI in (point of interest)Extracting all POIs according to the access time sequence to form a sequenceTarget point of interest vector of (a)Wherein。
Since the self-attention mechanism is insensitive to position order, the present embodiment uses absolute position encoding tAPE to perceive position information:
In the formula, Representation embeddingThe 2 nd P-th position in the dimension,Representation embedding2P+1 positions in the dimension, namely, parity positions are different in coding modes; The value of (2) is in the interval In the inner part of the inner part,Is the length of the sequence and,Is the dimension of the embedding that is to be done,Representation and representationCorrespondingly, in this embodiment, by taking the input embedding dimension and length into consideration, the embedding of the lower dimension can correctly express the distance relationship during calculation, and then, referring to fig. 2, the process of adding the position code is as follows:
after the calculation, the user access sequence added with the position code can be obtained 。
And step S30, performing space-time interval calculation and embedding operation on the historical sign-in sequence to generate a time embedding matrix and a space embedding matrix.
Exemplary, referring to FIG. 2, the present embodiment will construct a time matrix for each target userAnd a space matrixFor recording time and space intervals between any two check-ins, i.e. pairsIn n check-in records, calculate its spatial distance and userAccessing their time intervals to obtain a history check-in sequence for the target userTime matrix of (a)And oneIs a spatial matrix of (2)Wherein the time matrixAnd a space matrixThe calculation mode of the elements is as follows:
In the formula, Representing a userA minimum value of the time interval; a representation haversine formula for calculating a distance of coordinates between the two; The thresholds representing the time interval and the space distance are super parameters, and after the time and space relation is obtained, two groups of embedded matrixes, namely the embedded matrixes, are obtained respectively through embedding operation And a spatial embedding matrix。
And S40, carrying out attention processing on the user access sequence, the time embedding matrix and the space embedding matrix based on a preset self-attention module so as to output the next interest point corresponding to the target user.
Exemplary, in this embodiment, the user is given access to the sequenceTime embedding matrix with target userAnd a spatial embedding matrixThe method comprises the steps of sending the target user to a self-attention module for attention aggregation and library discharging, namely outputting the prediction of the target user to access POIs at the next moment of each moment, namely outputting a list of the first k POIs most likely to be accessed by the target user at the next moment, wherein the specific value of k can be determined according to actual requirements and is not limited. Therefore, the embodiment uses a simpler thought to learn the graph structure, so that the dependence of POI recommendation on priori knowledge can be effectively reduced, and the problems of over-smoothing and over-correlation can be relieved.
Further, in an embodiment, the self-attention module includes an additional residual mechanism based on which the output of the self-attention module is controlledThe method comprises the following steps:
In the formula, Representing a feed-forward neural network,The representation layer is normalized and,The mechanism of attention is indicated and,Representing the input of the self-attention module.
For example, referring to FIG. 3, the conventional Attention module, although extending the Attention mechanism in terms of spatiotemporal information, does not fully consider the gradient relationship between the adaptive graph and the Attention module, which is an implementation similar to that of Pre-LN transducer Encoder, in which Attention represents the spatiotemporal-interval-aware self-Attention mechanism, the original structure of which is simplified in the figure (i.e., the specific information aggregation process is not shown), FNN represents the feedforward neural network, layer Norm represents Layer normalization, dropout represents dropping method, Q, K, V represents Query (Query), key (Key) and Value (Value), respectively, and for simplicity of description, the subsequent embodiments will use "Attn" for "Attention" and "LN" for "Layer Norm". For the attention module in fig. 3, assume that the input isThe output of the moduleCan be expressed as:
Upper pair of rollers The gradient of (2) is:
It is noted that the shorter residual mechanism inside the attention module in fig. 3 does not give a larger gradient to the input, whereas in this embodiment the attention module will be extended, i.e. an extra residual mechanism (i.e. the part shown by the dotted line in fig. 4) is added to the attention module to get an extended self-attention module as shown in fig. 4, the output of the extended self-attention module The method comprises the following steps:
at this time pair The gradient of (2) is:
It can be seen that, when the extended self-attention module provided in this embodiment is propagated in the opposite direction, the larger gradient value is transferred to the self-adaptive graph part through the self-attention layer, so that more effective POI embedding can be learned for the self-adaptive graph, and a better-quality graph structure can be constructed in the next round of forward propagation.
Thus, the first and second substrates are bonded together,Stacked in a matrix in time order of user accessThe process of feeding the expanded self-attention module is as follows:
In the formula, For the output of the Attention in figure 4,The output of FNN in FIG. 4; representation layer normalization, performing row normalization on the last dimension of the input, Representing a discard method; Representing each value of matrix C compared to 0, the larger remaining; Representing a matrix of learnable weights in the FNN block, Representing the bias term in the FNN.
Notably, the extended self-attention modules are commonThe block, the embodiment only provides the calculation process of the first block, and the calculation process of each subsequent block only needs to output the previous blockAs a means ofTo calculate the output given for the last blockAnd performing layer normalization operation:
In the formula, Representing a userThe historical sign-in sequence information of the (a) is output by the extended self-attention module.
Further, in an embodiment, the attention mechanism is a mechanism combining local attention and global attention, the local attention realizes local attention coefficient calculation through local mask to re-weight recently accessed historical interest points, wherein the local attention coefficient is used for calculating the local attention coefficientThe calculation formula of (2) is as follows:
In the formula, Representing the local attention coefficient corresponding to the j-th element of the i-th row in the local attention coefficient matrix,Represents the attention score corresponding to the j-th element of the i-th row in the attention score matrix,Indicating the size of the local field of view.
It will be appreciated, by way of example, that conventional approaches to looking at POI information from a global perspective when implementing the attention mechanism, such that the current POI sees information too far away, while the Softmax operation can greatly reduce the impact of non-important items on the current decision, the scaling factorWhile reducing this sharpening, in order to alleviate this problem, the present embodiment proposes a global combined local attention approach to focus on recent accesses by local masking, thereby achieving the effect of re-weighting recent accesses, as shown in fig. 5.
When calculating the global attention coefficient, the embodiment is realized by adopting the following calculation formula:
In the formula, Represents the attention score corresponding to the j-th element of the i-th row in the attention score matrix,And based on the global attention coefficient, carrying out global weight calculation and weighted summation to realize global aggregation. It should be noted that, equation (21) only gives a specific solution of each element in the global attention coefficient matrix.
But in calculating the local attention coefficients, the number of elements calculated by softmax is limited:
In the formula, Representing the local attention coefficient corresponding to the j-th element of the i-th row in the local attention coefficient matrix,And based on the local weight calculation and weighted summation, the local aggregation is realized. It should be noted that, equation (23) only gives a specific solution of each element in the local attention coefficient matrix.
And finally, adding the global aggregation result and the local aggregation result to output an overall aggregation result:
Wherein, the I.e.Is thatIn a row. It should be understood that, in specific implementation, the attention coefficient matrix calculated by the equation (21) is set toThen, when the attention is focused, the global attention passes through a lower triangular mask matrixTo ensure its causality, i.eWherein'"Represents the Hadamard product (i.e., element-by-element by bit) and local attention is directed to designing a k-diagonal matrix (relative to a tri-diagonal matrix)Here, whereThen pass throughTo achieve local attention field of view limitation, i.e。
It can be seen that the idea of the present embodiment is to reduce the number of parameters in the traditional thinking that model the user's long-term and short-term dependence parameters, respectively, by limiting the current field of view to achieve a re-aggregation effect on recent accesses, without using additional attention methods or other sequence modeling methods to model the recent preferences. The embodiment emphasizes recent access in the aggregation process by forcing the current attention to be weighted again, so that the current POI is refocused on the recently accessed POI, and a better recommending effect is achieved.
Further, in an embodiment, the self-attention module includes an additional loss function for reducing similarity of content learned by a multi-head attention mechanism in the self-attention module, the additional loss function being:
In the formula, Represent the firstAttention loss by the layer attention module,Representing the length of the historical check-in sequence,The number of attention headers is indicated,Represent the firstLayer attention module of the first layerThe number of attention points of the user is that,Represent the firstLayer attention module of the first layerAnd a plurality of attention heads.
By way of example, it should be appreciated that when multi-head attention is used directly in the self-attention module, similar content is inevitably learned from head to head, i.e. the multi-head attention is of low rank, guidance is required for multi-head attention learning in order to enable multi-head attention to learn richer content, and therefore the present embodiment will perform multi-head attention regularization, i.e. reduce the similarity of content learned by multi-head attention mechanisms in the self-attention module by an additional loss function, i.e. use cosine similarity in each layer of attention module to calculate the distance between heads:
In the formula, Represent the firstAttention loss by the layer attention module,Representing the length of the historical check-in sequence,The number of attention headers is indicated,Represent the firstLayer attention module of the first layerThe number of attention points of the user is that,Represent the firstLayer attention module of the first layerAnd a plurality of attention heads.
Finally, the loss of each layer is added as the overall loss of the self-attention module:
In the formula, Indicating the number of layers of the attention module.
It should be appreciated that the extended self-attention module and the decorrelation adaptive simple graph learning network in this embodiment constitute a decorrelation adaptive simple graph representing an enhanced attention network (Decorrelated ADAPTIVE SIMPLE GRAPH presentation-enhanced Attention Network, DASGRAN), and thus, after the overall loss of the self-attention module is obtained, the loss is added to the overall loss of the DASGRAN model for joint training. The overall loss calculation method of the attention module is that for the case of single samples, a small-batch gradient descent method is generally used for training in a specific implementation, so in order to balance the contribution of each sample in the case of batch size b, after obtaining the sum of attention loss of different layers in batch, the sum is divided by b, and then the final loss combination training is added.
The following examples illustrate the prediction and optimization of DASGRAN models. First, as for the prediction section, it can be understood that the output obtained after the processing by the expanded self-attention module isArranging them in rows to obtainThe sequence adequately captures the propensity of the user to transition between long-term dependence and short-term interest, so that the current user targets each POI at time t+1Interest score of (2)The calculation can be performed as follows:
In the formula, Representation ofIs POI embedding learned by decorrelation adaptive simple graph networks,Representing a userAnd in the recommendation evaluation stage, according to the interest score, ordering the POIs which the user can possibly visit for the current user from high to low to obtain a top-k list.
Second, for the model optimization part, the present embodiment will employ a cross entropy loss function to measure the distance between the predicted POI and the target POI:
In the formula, Is a true example tag when the user accesses the location at time IThe value is 1 when it is, otherwise 0. Thus, after adding the regularization term for multi-head attention, the final loss function is:
In the formula, Is a super-parameter which is used for the processing of the data,Is an L2 regularization term for all parameters of the model.
In summary, the embodiment proposes to learn POIs by using a decorrelated adaptive simple graph neural network, not only can learn richer representations for POIs, but also each dimension of the differentiated POI representation can make the vector representation more expressive, and compared with the adaptive graph, the vector representation is less dependent on prior experience and can alleviate the problems of smoothing and over-correlation to a certain extent, meanwhile, the embodiment also proposes DASGRAN model, which adds additional residual connection in the extended self-attention network, illustrates gradient relation between the self-attention network and the adaptive graph network, so that the adaptive graph network can train POI embedding more effectively, and in addition, the embodiment also designs a global and local combined attention calculation mode, which can be used for locally re-weighting, so that the problem of being more accessed to disperse attention effect when only using global attention can be alleviated, and the performance of the self-attention network is improved on the premise of not introducing excessive parameters, finally, an additional residual connection is added for the attention mechanism, and the learning quality difference between multiple heads is improved by increasing multiple heads of attention.
In a second aspect, the embodiment of the application further provides a next interest point recommending device.
In one embodiment, the next point of interest recommendation device includes:
The first processing module is used for acquiring all target interest point embedding matrixes corresponding to the historical interest points from a preset embedding matrix library, wherein the interest point embedding matrixes in the embedding matrix library are generated based on a preset decorrelation self-adaptive simple graph learning network, and the historical interest points are interest points contained in a historical sign-in sequence corresponding to a target user;
The second processing module is used for determining all target interest point vectors based on all target interest point embedding matrixes and carrying out position coding processing on all target interest point vectors so as to obtain a user access sequence;
the third processing module is used for performing space-time interval calculation and embedding operation on the historical sign-in sequence to generate a time embedding matrix and a space embedding matrix;
the interest point recommendation module is used for carrying out attention processing on the user access sequence, the time embedding matrix and the space embedding matrix based on the preset self-attention module so as to output the next interest point corresponding to the target user;
The model construction module is used for obtaining an initial embedding matrix after embedding all the interest points, performing cosine similarity calculation on the initial embedding matrix to construct an adaptive simple graph, controlling the adaptive simple graph to perform propagation learning, and performing layer-by-layer noise reduction on the adaptive simple graph through an orthogonal regularization graph signal noise reduction method in the propagation learning process of the adaptive simple graph so as to generate a decorrelation adaptive simple graph learning network.
Further, in an embodiment, the self-attention module includes an additional residual mechanism based on which the output of the self-attention module is controlledThe method comprises the following steps:
In the formula, Representing a feed-forward neural network,The representation layer is normalized and,The mechanism of attention is indicated and,Representing the input of the self-attention module.
Further, in an embodiment, the attention mechanism is a mechanism combining local attention with global attention, the local attention enabling local attention coefficient calculation by local masking to re-weight recently accessed historical points of interest.
Further, in an embodiment, the local attention coefficientThe calculation formula of (2) is as follows:
In the formula, Representing the local attention coefficient corresponding to the j-th element of the i-th row in the local attention coefficient matrix,Represents the attention score corresponding to the j-th element of the i-th row in the attention score matrix,Indicating the size of the local field of view.
Further, in an embodiment, the self-attention module includes an additional loss function for reducing similarity of content learned by a multi-head attention mechanism in the self-attention module, the additional loss function being:
In the formula, Represent the firstAttention loss by the layer attention module,Representing the length of the historical check-in sequence,The number of attention headers is indicated,Represent the firstLayer attention module of the first layerThe number of attention points of the user is that,Represent the firstLayer attention module of the first layerAnd a plurality of attention heads.
Further, in an embodiment, the noise reduction formula corresponding to the orthogonal regularization graph signal noise reduction method is:
In the formula, An embedding matrix representing the output of the neural network of figures,Representing the embedded matrix after noise reduction,Representing the embedding matrix of the input map neural network,AndThe super-parameter is represented by a parameter,Representing the normalized laplace matrix,Representing the identity matrix.
Further, in an embodiment, the propagation rule of each layer in the decorrelation adaptive simple graph is:
In the formula, Representing warpThe embedded matrix output after layer propagation,Representing warpAn embedding matrix of the layer 1 post-propagation output,The super-parameter is represented by a parameter,Representing the laplace normalized join-self connected adjacency matrix.
The function implementation of each module in the next interest point recommendation device corresponds to each step in the embodiment of the next interest point recommendation method, and the function and implementation process of each module are not described in detail herein.
In a third aspect, an embodiment of the present application provides a next point of interest recommendation device, where the next point of interest recommendation device may be a device having a data processing function, such as a personal computer (personal computer, PC), a notebook computer, a server, or the like.
Referring to fig. 6, fig. 6 is a schematic hardware structure of a next point of interest recommendation device according to an embodiment of the present application. In the embodiment of the application, the next interest point recommending device may include a processor, a memory, a communication interface and a communication bus.
The communication bus may be of any type for implementing the processor, memory, and communication interface interconnections.
The communication interfaces include input/output (I/O) interfaces, physical interfaces, logical interfaces, and the like for implementing the interconnection of devices inside the next point of interest recommendation device, and for implementing the interconnection of the next point of interest recommendation device with other devices (e.g., other computing devices or user devices). The physical interface may be an ethernet interface, an optical fiber interface, an ATM interface, etc., and the user device may be a Display screen (Display), a Keyboard (Keyboard), etc.
The memory may be various types of storage media such as random access memory (randomaccess memory, RAM), read-only memory (ROM), nonvolatile RAM (non-volatileRAM, NVRAM), flash memory, optical memory, hard disk, programmable ROM (PROM), erasable PROM (erasable PROM, EPROM), electrically erasable PROM (ELECTRICALLY ERASABLE PROM, EEPROM), and the like.
The processor may be a general-purpose processor, and the general-purpose processor may call a next point of interest recommendation program stored in the memory and execute the next point of interest recommendation method provided by the embodiment of the present application. For example, the general purpose processor may be a central processing unit (central processing unit, CPU). The method executed when the next point of interest recommendation program is called may refer to each embodiment of the next point of interest recommendation method of the present application, and will not be described herein.
Those skilled in the art will appreciate that the hardware configuration shown in fig. 6 is not limiting of the application and may include more or fewer components than shown, or may combine certain components, or a different arrangement of components.
In a fourth aspect, embodiments of the present application also provide a computer-readable storage medium.
The application stores the next point of interest recommendation program on the readable storage medium, wherein the next point of interest recommendation program, when executed by the processor, implements the steps of the next point of interest recommendation method as described above.
The method implemented when the next point of interest recommendation program is executed may refer to each embodiment of the next point of interest recommendation method of the present application, which is not described herein.
The terms "comprising" and "having" and any variations thereof in the description and claims of the application and in the foregoing drawings are intended to cover non-exclusive inclusions. For example, a process, method, system, article, or apparatus that comprises a list of steps or elements is not limited to only those listed steps or elements but may include other steps or elements not listed or inherent to such process, method, article, or apparatus. The terms "first," "second," and "third," etc. are used for distinguishing between different objects and not necessarily for describing a sequential or chronological order, and are not limited to the fact that "first," "second," and "third" are not identical.
In describing embodiments of the present application, "exemplary," "such as," or "for example," etc., are used to indicate by way of example, illustration, or description. Any embodiment or design described herein as "exemplary," "such as" or "for example" is not necessarily to be construed as preferred or advantageous over other embodiments or designs. Rather, the use of words such as "exemplary," "such as" or "for example," etc., is intended to present related concepts in a concrete fashion.
In the description of the embodiment of the present application, "/" means or, for example, a/B may mean a or B, and "and/or" in the text is merely an association relationship describing an association object, means that three relationships may exist, for example, a and/or B, three cases where a exists alone, a and B exist together, and B exists alone, and further, in the description of the embodiment of the present application, "a plurality" means two or more.
In some of the processes described in the embodiments of the present application, a plurality of operations or steps occurring in a particular order are included, but it should be understood that the operations or steps may be performed out of the order in which they occur in the embodiments of the present application or in parallel, the sequence numbers of the operations merely serve to distinguish between the various operations, and the sequence numbers themselves do not represent any order of execution. In addition, the processes may include more or fewer operations, and the operations or steps may be performed in sequence or in parallel, and the operations or steps may be combined.
From the above description of the embodiments, it will be clear to those skilled in the art that the above-described embodiment method may be implemented by means of software plus a necessary general hardware platform, but of course may also be implemented by means of hardware, but in many cases the former is a preferred embodiment. Based on such understanding, the technical solution of the present application may be embodied essentially or in a part contributing to the prior art in the form of a software product stored in a storage medium (e.g. ROM/RAM, magnetic disk, optical disk) as described above, comprising instructions for causing a terminal device to perform the method according to the embodiments of the present application.
The foregoing description is only of the preferred embodiments of the present application, and is not intended to limit the scope of the application, but rather is intended to cover any equivalents of the structures or equivalent processes disclosed herein or in the alternative, which may be employed directly or indirectly in other related arts.