Disclosure of Invention
The invention aims to provide a model capable of accurately deducing the social relationship of a user by utilizing the movement information of the user.
In order to achieve the above object, the technical solution of the present invention is to provide a method for inferring a relationship of a mobile social network user based on spatiotemporal relationship learning, which is characterized by comprising the following steps:
step 1, extracting the interactive behavior characteristics between user pairs, and deducing whether two users have a friendship by using the characteristics, wherein the method comprises the following steps:
step 101, dividing all interest points POIs signed by mobile data by all users into I multiplied by J grids according to longitude and latitude, simultaneously dividing time into M time segments, and constructing an I multiplied by J multiplied by M space-time matrix STD, wherein the time is divided into equal-length time segments with the length tau in the time dimension, the space is uniformly divided into grids with equal size in the space dimension, and each grid is recursively divided into four equal grids until the number of the interest points POIs is smaller than a threshold value sigma in each grid;
102, grouping each user pair (u)
a ,u
b ) The tracks of (a) are all projected into a space-time matrix STD, and each sign-in of a user can be projected into oneIn a particular square, for each square, calculate: user u in this time period
a Accessed interest points n
a (ii) a User u
b Accessed interest points n
b (ii) a User u
a And user u
b Commonly visited interest points n
a,b Thereby obtaining a user pair (u)
a ,u
b ) Space-time matrix of
Triple in formula
Represents the user u in the m-th time period
a And u
b Moving statistics of information in the location grid of the ith row and the jth column;
103, each pair of users (u) a ,u b ) Space-time matrix O of (a,b) Encoding into a low-dimensional vector, and calculating user u using the low-dimensional vector a And user u b Obtaining an initial social relationship graph G which is (U, E), wherein U is a set of vertexes in the graph and represents all users with movement information; e is a set of edges representing a friendship between two users, wherein the spatio-temporal matrix O (a,b) Is adjusted by the parameters σ and τ;
step 2, extracting a k-reachable subgraph for each user to describe the network structure between the users, and defining an extracted user pair (U, E) for a given initial social relationship graph G (U, E)
a ,u
b ) K-reachable diagram of
The steps are as follows:
step 201, setting the path length to be 2, will
Initializing to be an empty graph;
step 202, find (u) in the initial social relationship graph G
a ,u
b ) All paths of
length 2 between them and all found paths are expressed as
Then delete social relationship graph G neutralization
Point and edge deletion all occurring in except for user u
a And user u
b Itself;
step 203, increasing the path length step by step, and repeating the step 202 until the path length exceeds k;
step 3, according to the initial social relationship graph G, aiming at each pair of users (u)
a ,u
b ) K-reachable diagram of
Coding, namely coding paths with the same length based on an accumulation principle, splicing coding results of paths with different lengths, realizing vectorization of a user on a k-reachable subgraph, and obtaining a comprehensive characteristic vector of the user pair;
and 4, 0/1 classification is carried out by using a classifier according to the comprehensive characteristic vector of the user, wherein 1 is a friend, and 0 is not a friend, so that the latest prediction social graph is obtained.
And 5, updating the structural characteristics of the user pairs by using the latest social graph, and further predicting again until the prediction result is not changed any more, namely obtaining the final predicted social network graph.
Preferably, in step 103, the spatio-temporal matrix O is transformed
(a,b) Inputting an automatic encoder with R hidden layers, encoding the automatic encoder into d-dimensional vector to obtain reconstructed space-time matrix
Make it and the input O of the encoder
(a,b) The optimization goals of the training process are as follows:
In the formula (I), the compound is shown in the specification,
representing the loss function of the self-encoder network in a hybrid network, i.e. making the reconstructed space-time matrix after decoding as much as possible
And the space-time matrix O before coding
(a,b) The same is true. (ii) a
The automatic encoder adopts supervised training to realize reconstruction and distinction of the encoding process, namely, a classification network is added to the automatic encoder to monitor the encoding process of the automatic encoder, and a loss function of the process
Comprises the following steps:
in the formula (I), the compound is shown in the specification,
representing the prediction result, namely the output result of the classification network; y represents a sample label; n represents the number of training samples, i.e. the number of pairs of users involved in the training data set.
To obtain a more discriminative vector representation, the following constraints are placed on the integrated hybrid network:
in the formula (I), the compound is shown in the specification,
representing the overall loss function of the entire hybrid network;
once training is complete, the encoder will be taken from the network of automated encoders for encoding and preliminary relationship inference for any pair of user spatio-temporal relationship matrices in the set of users.
The invention provides a novel social relationship reasoning model which simultaneously considers mobility and sociability among individuals. Considering the effectiveness of the social network structure on social connection prediction, the model firstly constructs a preliminary social graph based on the mobility of users, then extracts the social network structure characteristics of the user pairs from the preliminarily constructed social graph, and finally carries out friend relation inference by integrating the characteristics of the mobility and the sociability. Once the training of the model is completed, different scenes can be well migrated to predict the friendship between users. Experiments on two real-world data sets have shown that our method is consistently superior to existing methods. Furthermore, our model is also valid for relationships with little check-in data and no face-to-face events.
Detailed Description
The invention will be further illustrated with reference to the following specific examples. It should be understood that these examples are for illustrative purposes only and are not intended to limit the scope of the present invention. Further, it should be understood that various changes or modifications of the present invention may be made by those skilled in the art after reading the teaching of the present invention, and such equivalents may fall within the scope of the present invention as defined in the appended claims.
The invention deduces whether the users have a friendship or not by utilizing the similarity of the movement tracks among the users and the propagation of the social network, and FIG. 1 is an abstraction of the real problem. The inference model is divided into two phases: 1. constructing an initial social network graph: the initial social network graph is constructed based on the observation that the movement trajectories among friends generally have higher similarities. 2. Obtaining a hidden social relationship: based on the phenomenon that network topological structures among friends are more similar, hidden friendships with similar preferences but without similar movement tracks are mined.
FIG. 2 shows a specific implementation content of the spatio-temporal relationship learning-based mobile social network user relationship inference method provided by the present invention, which mainly includes the following two stages:
the first stage is as follows: building preliminary social graph
In the stage, the interactive behavior characteristics between the user pairs are extracted, and whether the two users have a friendship or not is deduced by using the characteristics. Generally, the interactive behavior features may be characterized by statistical attributes of the interactions between pairs of users, such as number of impressions, number of co-visited sites. However, there may be no co-visit events or meeting events for friends, and not all co-visits are of equal importance in inferring the user's friendship. Therefore, we propose a more comprehensive approach to learning complex interactive behavior features. We embed both the collective behavior and the individual behavior of two users into the interactive behavior feature. In addition, we consider that different places and time periods have different prediction importance, and design a hybrid model to generate the compressed interactive behavior feature vector and the initial classification result at the same time, wherein each position influence range and each time interval are parameters of the model. The method can ensure that the compressed interactive behavior characteristics keep the original action characteristics of the user as much as possible, and the characteristics have an important indication function in the task of deducing the friendship. The first stage comprises the following steps:
Step 1, constructing a space-time matrix
FIG. 3 illustrates a schematic diagram of constructing a user versus spatio-temporal matrix. Firstly, dividing interest Points (POIs) involved in signing in of all users of mobile data into I multiplied by J grids according to longitude and latitude, and simultaneously dividing time into M time segments to construct an I multiplied by J multiplied by M space-time matrix (STD). Wherein, the time dimension is divided into equal-length time slices with length tau; the space is evenly divided into grids with equal size in the spatial dimension, and in consideration of the fact that the density of the POIs has larger difference in the geographic area, each grid is recursively divided into four equal grids until the number of the POIs in each grid is smaller than the threshold value sigma. Each user pair (u)
a ,u
b ) The trajectories of all the users can be projected into the STD, each check-in of the user can be projected into a specific square, and for each square, three indicating factors are calculated, namely the user in the time periodu
a Number n of POIs visited
a User u
b Number n of POIs visited
b And user u
a And user u
b Number n of commonly visited POIs
a,b . Thereby obtaining a user pair (u)
a ,u
b ) Space-time matrix of
Triple in formula
Represents the user u in the m-th time period
a And u
b The statistics of the movement information in the location grid of the ith row and jth column.
Step 2, coding of space-time matrix
This step pairs each pair of users (u) a ,u b ) Space-time matrix O of (a,b) Encoding into a low-dimensional vector and using the vector to calculate user u a And user u b Probability of friendship, where the size of the spatio-temporal matrix can be adjusted by parameters σ and τ.
We input the spatio-temporal matrix into an automatic encoder, and the encoder with R hidden layers encodes it into d-dimensional vector, i.e. the R-th layer output result of the encoder. Decoder with R hidden layers outputs reconstructed space-time matrix according to d-dimensional vector
Make it and the input O of the encoder
(a,b) And (4) approaching. The optimization goals of the training process are as follows:
in the formula (I), the compound is shown in the specification,
representing self-encoder networks in hybrid networksI.e. making the reconstructed space-time matrix after decoding as much as possible
And the space-time matrix O before coding
(a,b) Similarly, U represents all users in the training sample.
The training of the auto-encoder is unsupervised, which means that it only learns the input structure and does not have the function of feature selection or tendency, so the finally obtained d-dimensional feature vector only retains the user's original movement information and cannot guarantee utility in the friendship inference task. To avoid this problem, we use supervised training to reconstruct and distinguish the encoding process, i.e. we add a classification network (output) to the auto-encoder
Represents the pair of users (u)
a ,u
b ) Probability of having a friendship) to monitor its encoding process. Loss function of the process
Comprises the following steps:
in the formula (I), the compound is shown in the specification,
representing the prediction result, namely the output result of the classification network; y represents a sample label; n represents the number of training samples, i.e. the number of pairs of users involved in the training data set.
To obtain a more discriminative vector representation, we put the following constraints on the integrated hybrid network:
in the formula (I), the compound is shown in the specification,
representing the composite loss function of the hybrid network.
Once training is complete, the encoder will be taken from the network of automated encoders for encoding and preliminary relationship inference for any pair of user spatio-temporal relationship matrices in the set of users.
And a second stage: obtaining hidden social relationships
In the second phase, we consider the characteristics of indirect links between user pairs, i.e. the characteristics of the network structure. Since mobile data does not have a social topological graph, we extract structural features from the first stage prediction (a semi-true social graph). Considering that the simple heuristic structural features are not universally applicable, a new K reachable subgraph is provided for describing the network structural features among target users, and the subgraph is coded to obtain a structural feature vector. And finally, combining the coded structure vector with corresponding interactive characteristics to improve the accuracy of inference. In addition, an iterative process is designed, and the structural feature vector and the obtained final social relationship graph can be simultaneously refined.
The second stage comprises the following steps:
step 3, extracting a local graph structure, namely a K reachable subgraph
Katz is a common method for measuring network proximity between users, which considers a global view of user pairs in a social graph, i.e., all possible paths between user pairs. However, we consider this to be unreasonable, as longer paths not only are computationally complex but also negatively impact relationship inference. Therefore, we describe the network structure between users with local view points in network proximity, i.e. extracting a k-reachable subgraph for each user. For a given initial social relationship graph G ═ U, E, we define the extraction user pair (U, E)
a ,u
b ) K-reachable diagram of
The steps are as follows:
step 301, setting the path length to 2, will
Initializing to be an empty graph;
step 302, find out (u) in the initial social relationship graph G constructed in the first stage
a ,u
b ) All paths of
length 2 between them and all found paths are expressed as
Then delete social relationship graph G neutralization
Point and edge deletion all occur in (except user u)
a And user u
b Itself).
Step 303, increasing the path length step by step, and repeating step 302 until the path length exceeds k.
Step 4, iteratively updating the prediction social graph
From the initial social relationship graph G constructed in the first stage, we are for each pair of users (u)
a ,u
b ) K-reachable diagram of
And (6) coding is carried out. Coding the paths with the same length based on the accumulation principle, splicing the coding results of the paths with different lengths, and realizing the vectorization of the user on the k-reachable subgraph. Fig. 4 illustrates the K-reachable subgraph encoding process in detail.
0/1 classification (1 is friend, 0 is not friend) is carried out according to the comprehensive feature vector (the interactive behavior feature obtained in the first stage and the local structure feature vector obtained in the second stage) of the user pair by using a classifier, and the latest prediction social graph is obtained.
And updating the structural characteristics of the user pairs by using the latest social graph, and further predicting again until the prediction result is not changed, namely obtaining the final predicted social network graph.
The verification process of the invention is as follows:
the experiment adopts real data disclosed by BrightKite and Gowalla, the two data sets are both social networks based on positions, and a user can publish own time-position information and share the time-position information to own friends. Such data sets are divided into a check-in data set and a social relationship graph of the user, and table 1 shows statistical information of the experimental data set.
TABLE 1 data set statistics
The experiment was compared with four popular inference methods based on distance traveled, number of shared locations, random walks and graph embedding.
Inference based on the relationship of the number of shared locations: the method extracts and uses the number of common places visited by a pair of users as features to infer whether a friendship exists between the pair of users. The experiment was supervised learning using svm classifiers.
A relational inference based on distance of movement. The method calculates the center position of the activity of each user according to all the movement information of each user, and deduces whether the users have a friendship or not by taking the Euclidean distance of the center position of each pair of users as a characteristic. The experiment was supervised learning using svm classifiers.
Relationship inference based on random walks. The method maps the mobile data of the user into a user-position bipartite graph, walks out the neighbors of each user in the bipartite graph according to a certain rule, compresses the neighbor information into vectors, and finally carries out friend relation inference by comparing the similarity degree of characteristic vectors between user pairs.
Relationship inference based on graph embedding. The method constructs a head-meeting graph according to the mobile information of users, namely two users have edges when the two users appear together (appear at the same position in a certain time interval), swims out a certain number of friends for each user on the head-meeting graph, codes the friend nodes into vectors, and finally carries out friend relation inference by comparing the similarity degree of characteristic vectors between user pairs.
In the experiment, f1-score is used as an evaluation index, the index is insensitive to class distribution, and the accuracy of an inference result can be accurately depicted even if the class distribution is unbalanced. It is defined as:
f1-score ═ (2 × precision × recall) ÷ (precision + recall)
Where precision accuracy rate is the number of true positives divided by the number of predicted results as positives and recall (also called true positive rate) is the number of true positives divided by the number of tags as positives. The value of f1-score is between 0 and 1, and the larger the value is, the higher the accuracy of the inference is.
In our experiment, we adopt a fully connected self-encoder network, the number of nodes in each layer in the network structure is half of the number of nodes in the previous layer, and the last layer is set by the user. On the other hand, in the structure of the decoder, we use the same inverse network structure as the encoder. The experiment adjusts the number of layers according to the size of the space-time matrix input into the encoder. We use a simple KNN and SVM as the classifier in stage 1 and the binary classifier in stage 2, respectively, and RBF as the kernel function of the support vector machine. The learning rate for all networks was set to 0.005 and the condition for iteration termination was that the change in the social networking graph edge for both runs was less than 1%.
1) Influence of spatial granularity σ
We tested five cases of 500, 750, 1000, 1250 and 1500 σ and concluded the accuracy of the results. As shown in fig. 5(a), (b), in the brightkit dataset (fig. 5(a)), as σ increases from 500 to 1000, its f1-score increases by 4.56%, and then the accuracy gradually decreases as σ increases. A similar trend is for the Gawalla dataset (fig. 5(b)), where f1-score takes a maximum value when σ is 750, since POIs in the Gawalla dataset are more dispersed than POIs in the brightkit dataset, which means that a grid in Gawalla covers a larger geographical area than brightkit, so the optimal σ value for the Gawalla dataset is smaller than the brightkit data.
2) Influence of time granularity tau
We tested the accuracy of the results in five cases of tau being 1 day, 7 days, 14 days, 30 days and 60 days. As shown in fig. 6(a) and (b), the Brightkite dataset (fig. 6(a)) has a maximum F1-Score when τ is 7 days. Similar experimental results were also documented in the Gawalla dataset (fig. 6 (b)). This is because human activities tend to exhibit periodicity, typically on a weekly basis.
3) Influence of the coding dimension d
We tested the accuracy of the inferred results in five cases, d is 16, 32, 64, 128 and 256. As shown in fig. 7(a), (b), the accuracy variation of the brightkit dataset (fig. 7(a)) and the Gawalla dataset (fig. 7(b)) have the same trend, since the higher the dimensionality of the spatio-temporal relationship vector, the more information is contained, resulting in better attack performance; however, the high-dimensional space-time relationship vector also generates excessive noise, and the accuracy of the attack is reduced.
4) Influence of the number of iterations
From the above exploration of the parameters, we experimented with two data sets using the best value for each parameter.
Fig. 8(a), (b) depict the brightkit dataset (fig. 8(a)) and the Gawalla dataset (fig. 8(b)), the effect of the number of iterations on our inferred accuracy. It can be seen that the inference accuracy remains improved as the number of iterations increases, 4 and 5 for the number of iterations required to satisfy the termination condition in Gowalla and Brightkite, respectively.
5) Influence of the number of user sign-ins
Fig. 9(a) and (b) are graphs showing the influence of the number of shared positions by the user on the accuracy of the inference result. It can be seen that as the number of shared locations increased, the accuracy of the inference results also increased. The experimental results also show that the brightkit data set (fig. 9(a)) and the Gawalla data set (fig. 9(b)) of the inference model are higher than the method based on feature extraction (inference based on the relation of moving distance) by about 10% on the index of f 1-score.
6) User impact on number of shared locations
Fig. 10(a) and (b) are graphs showing the influence of the number of user check-ins on the accuracy of the estimation result. Experimental results of the brightkit dataset (fig. 10(a)) and the Gawalla dataset (fig. 10(b)) show that our method is somewhat robust to users with different numbers of check-ins. Obviously, the more user check-ins, the more accurate the modeling of user behavior patterns and the more accurate the user relationship inference.