Social media user positioning method based on heterogeneous graph

By adopting a heterogeneous graph-based method in social networks, combining data preprocessing, heterogeneous network construction, structured processing of geographical entities and clustering analysis, the problem of low accuracy of user home position in the existing technology is solved, and the accuracy of user home position inference is achieved. Higher positioning accuracy and efficiency.

CN119474499AActive Publication Date: 2025-02-18UNIV OF ELECTRONICS SCI & TECH OF CHINA

Patent Information

Application Number
CN202411529175.1
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2024-10-30
Publication Date
2025-02-18
Estimated Expiration
2044-10-30

AI Technical Summary

Technical Problem

The user's home location in existing social networks cannot meet expectations due to incomplete information, inaccurate information and inability to effectively utilize known location information.

Method used

Using a heterogeneous graph-based method, the frequent user mode is obtained through data preprocessing, a heterogeneous network is built for user feature extraction and friend screening, and user location prediction is performed by combining geographic entity structured processing and DBSCAN clustering.

Benefits of technology

It improves the accuracy and accuracy of social media user location prediction, enhances the quality of heterogeneous networks, reduces nodes that are useless for geographic location reasoning, and improves the generality and processing speed of the method.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN119474499A_ABST
    Figure CN119474499A_ABST
Patent Text Reader

Abstract

The invention discloses a method for positioning a social media user based on a heterogeneous graph, which comprises the following steps of: mining and acquiring a behavior or a relationship of the user which is most likely to generate geographical location information through an association rule, and adding the behavior or the relationship generated by the relationship of the user as a node into a heterogeneous network which takes the user as a center by using the heterogeneous graph; according to the method, the content, relation and context information in the social network are comprehensively utilized, the feature vectors of the users are formed through the text information of the users and the extracted position information, the user group with the highest similarity with the to-be-predicted user is obtained by screening the users, and the position prediction precision is improved by utilizing structured processing on the geographic entity. According to the method, the precision and accuracy of social media user prediction are improved, a heterogeneous graph structure is simplified through association rule mining, excessive redundant information is prevented from being added into the graph, intimacy screening is carried out on the users in combination with hierarchical clustering, the intimacy screening granularity is controlled, and the accuracy of user position reasoning is improved.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present invention belongs to the technical field of social network user attribute reasoning, and in particular relates to a method for locating social media users based on a heterogeneous graph. Background Art

[0002] With the rapid development of the Internet, the use of social media by humans has become more and more common. The rapid development of online social networks such as Twitter, LinkedIn, Facebook, and Weibo has greatly increased the convenience of online interaction and information sharing. In online social networks, accounts are the main tools for their owners to participate in online activities. Usually, we can obtain a lot of useful information by analyzing the user data of these accounts, such as location, community, interests, etc. User location is one of the important attributes of social users. It refers to the user's long-term residence address or main activity area. The inference of the user's location is a process of extracting, analyzing, and fusing the location information in the online social network data to finally estimate the user's location. Such research can solve many related problems: For the operators of online social networks, the user's home location is regarded as a priori knowledge that is useful for many businesses. It can help the operator to carry out accurate advertising push and regional consumption habits analysis, and improve the efficiency of business activities. For ordinary users, the home location is a relatively private information, and many users are unwilling to disclose it to the outside world. Therefore, the inference of the user's home location can be used to let users check whether their home location has been leaked, thereby guiding users to post correctly and improve their awareness of protecting personal privacy.

[0003] Existing user home location inference methods can be divided into three categories according to the type of online social network information used: content-based methods, relationship-based methods, and context-based methods. In existing research, most methods only use a single or partial aspect of a user to infer their home location. In many cases, these methods cannot achieve the expected results. The reasons can be roughly summarized into two aspects. First, the extraction of location information is incomplete and inaccurate. For a certain geographic feature word, it may refer to multiple different locations, and the size of the area referred to by different geographic feature words also has significant differences. And users may also provide inaccurate location information. Second, existing methods cannot effectively utilize known location information. For example, content-based methods usually use supervised learning to construct an inference model of user home location based on feature words. Many supervised learning methods are affected by the quality of training samples and the generalization ability of the algorithm and cannot be accurately estimated.

[0004] In summary, social networks contain a large amount of information related to user locations, but this information is hidden in personal descriptions, friend relationships, user dynamics and other data. At the same time, due to the openness of social networks, each type of information is inaccurate and incomplete in describing the user's location. Existing user location positioning methods lack the organization and reasoning methods for complex user locations, resulting in the accuracy of inferring user locations failing to meet the expected requirements. Summary of the invention

[0005] To solve the above technical problems, the present invention provides a method for locating social media users based on heterogeneous graphs, which solves the challenges of high complexity and uncertainty of data in online social networks and the problems faced by existing user home location inference, comprehensively utilizes the information in online social networks, and improves the reasoning effect.

[0006] The technical solution adopted by the present invention is: a method for locating social media users based on a heterogeneous graph, and the specific steps are as follows:

[0007] S1, data preprocessing, i.e. collecting data and obtaining user frequent patterns;

[0008] S2. Based on step S1, a heterogeneous network is built to extract user features and then filter user friends;

[0009] S3. Based on step S2, user location prediction and optimization are performed, that is, geographic entity structure processing is performed first and then geographic location prediction is performed to achieve user positioning.

[0010] Furthermore, the step S1 is specifically as follows:

[0011] First, select a social software and obtain a sufficient number of accounts by applying for the API of this software, randomly capture A account data as a sample set, and then randomly select some users from the sample set as the initial "seed users".

[0012] The account data includes: all personal dynamic texts of the user, the user's homepage introduction, and the user's friend collection.

[0013] Then, the personal homepage information of the seed user and the X dynamic records recently published are used to deeply explore the social interaction traces of the user on the platform, including: mutual attention relationship, @ mention behavior in dynamic content and information forwarding chain.

[0014] The social interaction traces of the users on the platform not only cover direct friendships, but also include users indirectly connected through common interests and topic discussions. These users are set as extended users, and the latest X personal dynamics of the extended users and the complete user homepage information are collected to construct a social network dataset.

[0015] The obtained social network dataset is preprocessed, that is, the frequent patterns of users' mentions of geographic location information are obtained through association rule mining, and the "key behavior nodes" that potentially carry geographic location information are identified from the users' extensive behavioral data, including: the places mentioned in the users' personal descriptions, social media content with geo-tags when published, geographic location information publicly displayed on the users' homepages, and geographic location-related content posted in the users' Moments.

[0016] Among them, some user behavior data does not contain geographic information, including: subscription and forwarding status in the crawled data, so the association rule mining algorithm is introduced to obtain the frequent patterns of users mentioning geographic entities. By defining support and confidence, the intrinsic connection between various user behaviors and geographic locations is analyzed, and the strength of the association between them is quantified. The definition expressions of support and confidence are as follows:

[0017]

[0018] Among them, Count(A∪B) represents the number of itemsets that contain both A and B, N represents the total number of itemsets, Support(A→B) represents the frequency of simultaneous occurrence of item sets A and B, Confidence(A→B) represents the confidence of item set A for item set B, and Support(A) represents the support of item set A.

[0019] Furthermore, the step S2 is specifically as follows:

[0020] S21. Build heterogeneous networks;

[0021] First, a heterogeneous network is constructed, that is, a main relation network MRN is constructed, which is presented in the form of an undirected graph G(V, E).

[0022] Among them, V represents the vertex set and E represents the edge set.

[0023] Then, the "key behavior nodes" described in step S1 are added as node types to the heterogeneous network, that is, heterogeneous nodes containing geographic information, and the heterogeneous network includes: users and their behavior nodes, and social relationship nodes between users.

[0024] The vertices in the vertex set V include: the users themselves in the social network, various heterogeneous nodes containing geographic information, namely, user self-description information, user personal dynamic text, user friend related information, and forwarded dynamic original text information; the edge set E defines the connection relationship between heterogeneous nodes, including: based on direct interaction of users and based on indirect geographic information association.

[0025] Among them, user self-description information includes: homepage introduction, GPS positioning; user personal dynamic text includes: original dynamics, forwarded dynamics; user friend-related information includes: friend personal information, friend original dynamics, friend forwarded dynamics; forwarded dynamic original text information includes: original author information.

[0026] S22, after extracting user features, filter the user's friends;

[0027] Based on step S21, all unidirectional attention relationships in the social network data set are excluded, and only the information of friends who follow each other is retained. Then, the user's feature vector is extracted from the remaining friend relationships, and the users are hierarchically clustered. The bidirectional friend relationships are screened by selecting an appropriate number of clusters.

[0028] The user's feature vector includes: a text feature vector and a geographic entity feature vector connected by vectors; extracting the user's feature vector is specifically as follows:

[0029] (1) Text feature vector;

[0030] First, the user's n personal dynamic texts are filtered, and the fields used for filtering include: lang, retweeted_status_result.

[0031] The filtered tweets are embedded using transformer encoding, using several tokens of the tokenizer sentence and calculating the word embedding E for each token separately. token , Position Embedding E position , segment embedding E segmeent , each token is embedded with E = E position +E token +E segment express.

[0032] Then, a bidirectional attention mechanism is used to embed the obtained token sequence [E1, E2, E3, ..., E n ], for position i, E i Calculate its attention score with other vectors to get the output sequence [H1, H2, H3, ..., H n ], and finally use the average embedding to get the vector representation of each dynamic text It is used to represent the focus of a single dynamic text of the user, and finally the self-attention mechanism is used to obtain the overall embedding E of the user text. text =∑W i vec i .

[0033] Among them, W i Represents the self-attention weight of the text feature vector, Veci The vector representation of the text, namely E sentence .

[0034] (2) Geographic entity feature vector;

[0035] Use natural language processing to obtain the user's personal dynamic text, personal homepage, user self-description, and geographical entities contained in GPS positioning. Apply the same method as the personal dynamic text embedding, that is, the bidirectional attention mechanism, to the obtained m geographical entity sequences to obtain the embedding of geographical entities. For the obtained user geographical entities (Entity1, Entity2, ..., Entity m ), and combined into a sequence L = (Entity1, Entity2, ..., Entity m ), obtain the transformer embedding of each geographic entity in this sequence, and then use the attention mechanism to use these embeddings as the vector representation of the user's geographic location, denoted as vec location .

[0036] Finally, concatenate the two vectors E user =(E text ,vec location ), taking into account how closely users are related in terms of their personal interests and how closely they are related in terms of their geographic locations.

[0037] Get the user's embed user Then, hierarchical clustering is used to screen the intimacy of the user's friend relationship. The friend users in the same cluster as the user to be inferred are regarded as the screened close users. A bottom-up clustering method is used, that is, each data point is used as an initial cluster, and clusters are merged according to the closest distance between clusters. The two closest clusters are merged into a new cluster until the number of clusters reaches the stopping condition, as follows:

[0038] The obtained user feature vector E user As data points, use the ward method to calculate the cluster distance and minimize the increase in variance within the cluster after merging.

[0039] Among them, C i , C j Represents different clusters, C ij Represents C i , C j After the clusters are merged, S(C) represents the internal sum of squares of cluster C, that is, the sum of the squared distances of all points in the cluster to the centroid of the cluster. Represents the variance change after cluster merging.

[0040] Furthermore, the step S3 is specifically as follows:

[0041] Based on step S2, after completing the screening of user friend relationships and extracting geographic entities in the close user set using natural language processing, the Nominatim local service is installed and configured for structured query.

[0042] Nominatim is used by users to accurately retrieve geographic entities based on multiple fields; the multiple fields include: city, state, country, which represent the geographic location information at the city, state / province and country levels respectively.

[0043] The two key problems solved by structured query are as follows:

[0044] 1. Problem of duplicate place names: Through Nominatim's structured query, place names can be accurately mapped to specific administrative divisions based on the country and state fields, thereby eliminating ambiguity and ensuring the accuracy of query results.

[0045] 2. Multi-level location reasoning and verification: Structured queries provide accurate classification of place names, allowing the user's location attributes to be gradually inferred according to the hierarchical structure of country, state / province, and city.

[0046] While classifying the geographical entities through the Nominatim service, the place name entities are converted into their corresponding geographical longitude and latitude coordinates [p1, p2, ..., p n ], use DBSCAN clustering to predict the user's location on these coordinates, as follows:

[0047] First, all geographic coordinates obtained after longitude and latitude conversion are initialized, all points are marked as unvisited, and then core points are found. For each point p, its neighborhood Nε(p) = {q∈D|distance(q, p)≤ε} is calculated. If the number of points in the neighborhood is greater than the set threshold A, then p is regarded as a core point.

[0048] Among them, N ε (p) represents the area centered on point p, point q represents another point, and distance(q, p) represents the distance between point p and point q. The meaning of this expression is that all points whose distance from point p is less than ε are considered to be points in its neighborhood.

[0049] For each core point p, all points in its area are added to the corresponding cluster. If the added point p i is also a core point, then p iAll points in the area are added to the cluster until no new points can be added to the cluster. After all core points have completed this operation, the points that are not marked as core points or boundary points are considered noise points. After completing DBSCAN clustering, the cluster with the largest density is selected as the credible cluster, and the location of its center point is used as the prediction result as the user's possible home location to complete the user's positioning.

[0050] At the same time, considering the occurrence of abbreviations, we introduce the judgment of token position to eliminate the ambiguity of abbreviations, as follows:

[0051] 1. The abbreviation appears alone;

[0052] If no other information about the geographic location appears in the text, the specific meaning of the abbreviation cannot be determined. In this case, the abbreviation is not processed.

[0053] 2. The abbreviation appears in combination with other place names;

[0054] By designing a token position judgment method, if two entities appear consecutively and their appearance is a combination of a simple geographic entity and an abbreviated geographic entity, they are combined into a complex place name to determine the specific meaning of the abbreviated geographic entity.

[0055] Beneficial effects of the present invention: The method of the present invention obtains the user's behavior or relationship that is most likely to generate geographic location information through association rule mining, uses a heterogeneous graph to add the user's behavior or relationship that is most likely to generate geographic location information as a node into a user-centered heterogeneous network, comprehensively utilizes the content, relationship, and context information in the social network, constructs the user's feature vector through the user's text information and the extracted location information, obtains the user group with the highest similarity to the user to be predicted by screening the users, and uses structured processing of geographic entities to improve the accuracy of location prediction.

[0056] The method of the present invention improves the accuracy and precision of social media user prediction, confirms the frequent pattern of users mentioning geographic entities through association rule mining, improves the quality of heterogeneous networks, eliminates nodes that are useless for geographic location reasoning, and improves the versatility of the method for different types of social networks; obtains feature vectors by combining user text features with geographic information features, adopts hierarchical clustering to implement user intimacy screening, improves the quality of geographic entities of friend users added to heterogeneous graph nodes, and thus improves the accuracy of geographic location reasoning; by self-building place name longitude and latitude conversion services and configuring Nominatim local servers, high concurrency, fast response, and large-scale processing capabilities of geographic longitude and latitude conversion services are obtained, thereby improving the processing speed and stability of the method; by structurally processing geographic entities, the problem of different granularity in reasoning is solved, the user location is gradually optimized from a large range to a small range, and the inclusion relationship of geographic entities is used to perform rationality analysis on the reasoning results; by parsing the occurrence positions of geographic entities in texts, the problem of abbreviation entity ambiguity is solved, the ability to recognize complex place names that is generally lacking in natural language processing models is compensated, and the influence of ambiguity on reasoning results is reduced. BRIEF DESCRIPTION OF THE DRAWINGS

[0057] Figure 1 The present invention is a flowchart of a method for locating social media users based on a heterogeneous graph.

[0058] Figure 2 Schematic diagram of heterogeneous graph composition factors in an embodiment of the present invention.

[0059] Figure 3 The figure is a flowchart of extracting user feature vectors in an embodiment of the present invention. DETAILED DESCRIPTION

[0060] The method of the present invention is further described below in conjunction with the accompanying drawings and embodiments.

[0061] like Figure 1 As shown, a flow chart of a method for locating social media users based on a heterogeneous graph of the present invention, the specific steps are as follows:

[0062] S1, data preprocessing, i.e. collecting data and obtaining user frequent patterns;

[0063] S2. Based on step S1, a heterogeneous network is built to extract user features and then filter user friends;

[0064] S3. Based on step S2, user location prediction and optimization are performed, that is, geographic entity structure processing is performed first and then geographic location prediction is performed to achieve user positioning.

[0065] In this embodiment, the step S1 is specifically as follows:

[0066] First, we select a social software and obtain a sufficient number of accounts by applying for the API of this software, from which we randomly capture A=100,000 account data as a sample set, and then randomly select some users from the sample set as the initial "seed users". The selection of these users is intended to ensure the diversity and representativeness of the data.

[0067] The account data includes: all personal dynamic texts of the user, the user's homepage introduction, and the user's friend collection.

[0068] Then, the personal homepage information of the seed user and the X=500 dynamic records recently released are used to deeply mine the social interaction traces of the user on the platform, including: mutual attention relationship, @mention behavior in dynamic content and forwarding chain of information.

[0069] The social interaction traces of the users on the platform not only cover direct friendships, but also include users indirectly connected through common interests and topic discussions. These users are set as extended users, and the latest X = 500 personal dynamics of the extended users and the complete user homepage information are collected to construct a rich and comprehensive social network dataset.

[0070] When processing complex social network data sets, given the massive amount of user behavior and relationship data contained therein, this embodiment proposes an efficient data refining method, which aims to promote the accuracy of user location reasoning by constructing a simplified heterogeneous graph. The core of this method is to use association rule mining technology to transform from manually selecting data to be added to the heterogeneous graph to obtaining the user's frequent patterns, and intelligently screen those relationship and behavior nodes that have substantial contributions to user location reasoning, thereby effectively reducing data redundancy and improving analysis efficiency. This method has strong generalization for various social networks with different data structures, and at the same time simplifies the heterogeneous graph structure to avoid adding too much redundant information to the graph.

[0071] Specifically, this embodiment performs data preprocessing on the obtained social network dataset, that is, obtaining the frequent patterns of users mentioning geographic location information through association rule mining, and identifies "key behavior nodes" that potentially carry geographic location information from the user's extensive behavior data, including: places mentioned in the user's personal description, social media content with geo-tags when published (tweets\personal dynamic text), geographic location information publicly displayed on the user's homepage, and geographic location-related content posted in the user's circle of friends.

[0072] Among them, some user behavior data does not contain geographic information, including: subscription and forwarding status in the crawled data. In this case, an association rule mining algorithm is introduced to obtain the frequent patterns of users mentioning geographic entities. By defining support and confidence, the intrinsic connection between various types of user behaviors and geographic locations is analyzed, and the strength of the association between them is quantified. This process not only helps to eliminate behavioral data with low contribution to location reasoning, but also reveals those behavioral combination patterns that highly indicate the user's home location or permanent residence. The definition expressions of support and confidence are as follows:

[0073]

[0074] Among them, Count(A∪ B) represents the number of itemsets that contain both A and B, N represents the total number of itemsets, Support(A→B) represents the frequency of simultaneous occurrence of itemsets A and B, Confidence(A→B) represents the confidence of item set A for item set B, and Support(A) represents the support of item set A.

[0075] In this embodiment, step S2 is specifically as follows:

[0076] S21. Build heterogeneous networks;

[0077] In the face of the common problems of inaccurate, incomplete and ambiguous information in online social network accounts, this embodiment cleverly introduces an innovative heterogeneous network model, which aims to comprehensively utilize multiple dimensions of user location information to significantly improve the accuracy of inferring the user's accurate home location.

[0078] First, a heterogeneous network is constructed, that is, a main relation network MRN is constructed, which is presented in the form of an undirected graph G(V, E).

[0079] Among them, V represents the vertex set and E represents the edge set.

[0080] Then, the "key behavior nodes" described in step S1 are added as node types to the heterogeneous network, i.e., heterogeneous nodes containing geographic information, and the heterogeneous network includes: users and their behavior nodes, and social relationship nodes between users. In this way, a complex network containing multiple types of information is constructed, which can fully reflect the user's activities in the social network and their potential geographic information.

[0081] like Figure 2As shown, the vertices in the vertex set V include: the users themselves in the social network, various heterogeneous nodes containing geographic information, namely, user self-description information, user personal dynamic text, user friend related information, forwarded dynamic original information (retweeted article information); such a design enables the network to comprehensively capture the multi-dimensional characteristics of users in the social space, including their direct behavior, indirect associations, and implicit expressions of geographic location.

[0082] The edge set E defines the connection relationship between heterogeneous nodes, including: based on direct user interaction (such as mutual attention, forwarding, etc.), based on indirect geographic information association (such as two users' tweets mentioning the same place). By carefully constructing these edges, MRN successfully weaves the complex social relationships and geographic location information between users into a tight network, providing rich contextual information for subsequent location inference.

[0083] Among them, user self-description information includes: homepage introduction, GPS positioning; user personal dynamic text includes: original dynamics, forwarded dynamics; user friend-related information includes: friend personal information, friend original dynamics, friend forwarded dynamics; forwarded dynamic original text information includes: original author information.

[0084] S22, after extracting user features, filter the user's friends;

[0085] The friendships that users build in cyberspace often deviate from the social relationships in real life, which directly affects the accuracy of inferring the user's real location information through social relationships. Taking Weibo as an example, the following behaviors between users are relatively free. This asymmetric social relationship that may be established based on multiple motivations (such as interests, celebrity effects, etc.) cannot fully reflect the real geographical proximity or social closeness between users.

[0086] In order to meet this challenge and reduce the interference of noise information on the inference of user home location information, this embodiment proposes a targeted user friend relationship screening mechanism, which aims to simplify the main relationship network (MRN) and eliminate social links that have low contribution to location inference or may introduce misleading information.

[0087] First, based on step S21, all unidirectional attention relationships in the social network dataset are excluded, and only the information of friends who follow each other is retained. The probability that these relationships are friends in real life is much higher than the unidirectional attention relationship. Then, the user's feature vector is extracted from the remaining friend relationships, and the user is hierarchically clustered. By selecting an appropriate number of clusters to screen the bidirectional friend relationships, the control of the intimacy screening granularity is achieved, and the accuracy of user location reasoning is improved.

[0088] like Figure 3 As shown, the user's feature vector includes: a text feature vector and a geographic entity feature vector connected by vectors; extracting the user's feature vector is specifically as follows:

[0089] (1) Text feature vector;

[0090] First, the user's n personal dynamic texts are filtered, and the fields used for filtering include: lang, retweeted_status_result.

[0091] The filtered tweets are embedded using transformer encoding, using several tokens of the tokenizer sentence and calculating the word embedding E for each token separately. token , Position Embedding E position , segment embedding E segment , each token is embedded with E = E position +E token +E segment express.

[0092] Then, a bidirectional attention mechanism is used to embed the obtained token sequence [E1, E2, E3, ..., E n ], for position i, E i Calculate its attention score with other vectors to get the output sequence [H1, H2, H3, ..., H n ], and finally use the average embedding to get the vector representation of each dynamic text It is used to represent the focus of a single dynamic text of the user. Finally, the self-attention mechanism is also used to obtain the overall embedding (text feature vector) of the user text. text =∑W i Vec i .

[0093] Among them, W i Represents the self-attention weight of the text feature vector, vec i The vector representation of the text (text vector), that is, E sentence , used to indicate user interests, personal topics of concern, etc.

[0094] (2) Geographic entity feature vector;

[0095] Use natural language processing to obtain the user's personal dynamic text, personal homepage, user self-description, and geographical entities contained in GPS positioning. Apply the same method as the personal dynamic text embedding, that is, the bidirectional attention mechanism, to the obtained m geographical entity sequences to obtain the embedding of geographical entities. For the obtained user geographical entities (Entity1, Entity2, ..., Entity m), and combined into a sequence L = (Entity1, Entity2, ..., Entity m ), obtain the transformer embedding of each geographic entity in this sequence, and then use the attention mechanism to use these embeddings as the vector representation of the user's geographic location (geographic entity feature vector) recorded as vec location .

[0096] Finally, concatenate the two vectors E user =(E text ,vec location ), taking into account how closely users are related in terms of their personal interests and how closely they are related in terms of their geographic locations.

[0097] Get the user's embed user Then, hierarchical clustering is used to screen the intimacy of the user's friend relationship. The friend users in the same cluster as the user to be inferred are regarded as the screened close users. A bottom-up clustering method is used, that is, each data point is used as an initial cluster, and clusters are merged according to the closest distance between clusters. The two closest clusters are merged into a new cluster until the number of clusters reaches the stopping condition (set according to actual conditions), as follows:

[0098] The obtained user feature vector E user As data points, use the ward method to calculate the cluster distance and minimize the increase in variance within the cluster after merging. This merging method is very suitable for cluster analysis. It maintains the consistency within the cluster during merging, which means maximizing the similarity of users within the cluster.

[0099] Among them, C i , C j Represents different clusters, C ij Represents C i , C j After the clusters are merged, S(C) represents the internal sum of squares of cluster C, that is, the sum of the squared distances of all points in the cluster to the centroid of the cluster. Represents the variance change after cluster merging.

[0100] In this embodiment, step S3 is specifically as follows:

[0101] Based on step S2, after completing the screening of user friend relationships and extracting geographic entities in the close user set using natural language processing, the next key step is to efficiently process these geographic data to support accurate reasoning of user locations. Then, install and configure the Nominatim local service for structured queries, which can meet the needs of high-frequency geographic location queries and ensure the response speed and stability during data processing. As an open source geocoding and reverse geocoding service, Nominatim provides rich structured query functions, allowing users to accurately retrieve geographic entities based on multiple fields.

[0102] Nominatim is used by users to accurately retrieve geographic entities based on multiple fields; the multiple fields include: city, state, country, which represent the geographic location information at the city, state / province and country levels respectively.

[0103] The two key problems solved by structured query are as follows:

[0104] 1. Duplicate place names: Duplicate place names are a common challenge in online social networks, especially when there is a lack of specific context. For example, "New York" may refer to New York City in the United States, or it may be a town in the United Kingdom or a place name in another country. Through Nominatim's structured query, place names are accurately mapped to specific administrative divisions based on the fields country and state, thereby eliminating ambiguity and ensuring the accuracy of query results.

[0105] 2. Multi-level location reasoning and verification: Structured queries provide precise classification of place names, allowing the user's location attributes to be gradually inferred according to the hierarchical structure of country, state / province, and city. This hierarchical reasoning method has significant advantages: first, it can gradually narrow the range of possible user locations from macro to micro; second, the reasoning results of the previous layer can be used as prior knowledge for the next layer of reasoning to help verify and correct the inferred results. For example, if the user's approximate location is first determined through a country-level query, then the results can be more specifically screened in subsequent state / province and city queries to ensure the consistency and accuracy of the reasoning process.

[0106] While classifying the geographical entities through the Nominatim service, the place name entities are converted into their corresponding geographical longitude and latitude coordinates [p1, p2, ..., p n ], use DBSCAN clustering to predict the user's location on these coordinates. This clustering method does not require the specified number of clusters, but finds clusters of arbitrary shapes based on density, as follows:

[0107] First, initialize all the geographic coordinates obtained after longitude and latitude conversion, mark all points as unvisited, then find the core points, and calculate the neighborhood N of each point p. ε (p) = {q∈D|distance(q, p)≤ε}, if the number of points in the neighborhood is greater than the set threshold A, then p is regarded as a core point.

[0108] Among them, N ε (p) represents the area centered on point p, point q represents another point, and distance(q, p) represents the distance between point p and point q. The meaning of this expression is that all points whose distance from point p is less than ε are considered to be points in its neighborhood.

[0109] For each core point p, all points in its area are added to the corresponding cluster. If the added point p i is also a core point, then p i All points in the area are added to the cluster until no new points can be added to the cluster. After all core points have completed this operation, the points that are not marked as core points or boundary points are considered noise points. After completing DBSCAN clustering, the cluster with the largest density is selected as the credible cluster, and the location of its center point is used as the prediction result as the user's possible home location to complete the user's positioning.

[0110] In the process of structured query, there is a problem that complex combination of place names cannot be recognized as a whole, resulting in too many abbreviations in geographic entities, causing ambiguity. Taking the abbreviation CA as an example, it may refer to California in the United States (California) in the text, and it may also represent Canada (Canada). This problem is particularly prominent when using structured query. Since the characteristic of structured query is to reason from a large range downward to a smaller range to gradually improve the reasoning accuracy, such ambiguity refers to objects in different ranges, which will lead to reasoning errors in a larger range, thereby further affecting the accuracy of structured query. It is necessary to determine the specific location referred to by a certain abbreviation, or to let the abbreviation and other geographical locations appear in combination to solve the problem of ambiguity. To this end, this embodiment also considers the situation where abbreviations appear, and introduces the judgment of token positions to eliminate the ambiguity of abbreviations, as follows:

[0111] 1. The abbreviation appears alone;

[0112] If no other information about the geographic location appears in the text, the specific meaning of the abbreviation cannot be determined. In this case, the abbreviation is not processed.

[0113] 2. The abbreviation appears in combination with other place names;

[0114] In this case, the meaning of the abbreviation can usually be determined based on the meaning of other place names, thereby eliminating the impact of ambiguity on reasoning. By designing a token position judgment method, if two entities appear consecutively and the appearance is a combination of a simple geographic entity and an abbreviated geographic entity, they are combined into a complex place name to determine the specific meaning of the abbreviated geographic entity. This design method makes up for the lack of recognition capabilities for complex geographic entities in general natural language processing models.

[0115] In summary, the method of the present invention can simplify the types of nodes in a heterogeneous graph by obtaining frequent patterns of users, screen out high-intimacy objects by hierarchical clustering of users according to their texts and geographic locations, and achieve a denoising effect. The user's home location is inferred by structured processing of geographic entities combined with the DBSCAN clustering method. Compared with existing reasoning methods, the reasoning effect is improved by more than 10%.

[0116] Those skilled in the art will appreciate that the embodiments described herein are intended to help readers understand the principles of the present invention, and should be understood that the protection scope of the present invention is not limited to such specific statements and embodiments. Those skilled in the art can make various other specific variations and combinations that do not deviate from the essence of the present invention based on the technical revelations disclosed by the present invention, and these variations and combinations are still within the protection scope of the present invention.

Claims

1. A method for locating social media users based on heterogeneous graphs, the specific steps are as follows: S1, data preprocessing, i.e. collecting data and obtaining user frequent patterns; S2. Based on step S1, a heterogeneous network is built to extract user features and then filter user friends; S3. Based on step S2, user location prediction and optimization are performed, that is, geographic entity structure processing is performed first and then geographic location prediction is performed to achieve user positioning.

2. According to claim 1, a method for locating social media users based on heterogeneous graphs is characterized in that: The step S1 is specifically as follows: First, select a social software and obtain a sufficient number of accounts by applying for the API of this software, randomly capture A account data as a sample set, and then randomly select some users from the sample set as the initial "seed users"; The account data includes: all personal dynamic texts of the user, the user's homepage introduction, and the user's friend collection; Then, the personal homepage information of the seed user and the X dynamic records recently published are used to deeply mine the social interaction traces of the user on the platform, including: mutual attention relationship, @mention behavior in dynamic content, and forwarding chain of information; The social interaction traces of the users on the platform not only cover direct friendships, but also include users indirectly connected through common interests and topic discussions. These users are set as extended users, and the latest X personal dynamics of the extended users and the complete user homepage information are collected to construct a social network dataset; Data preprocessing is performed on the obtained social network dataset, that is, frequent patterns of users' mentions of location information are obtained through association rule mining, and "key behavior nodes" that potentially carry location information are identified from the user's extensive behavior data, including: locations mentioned in the user's personal description, social media content with geo-tags when published, location information publicly displayed on the user's homepage, and location-related content posted in the user's circle of friends; Among them, some user behavior data does not contain geographic information, including: subscription and forwarding status in the crawled data. Therefore, the association rule mining algorithm is introduced to obtain the frequent patterns of users mentioning geographic entities. By defining support and confidence, the intrinsic connection between various user behaviors and geographic locations is analyzed, and the strength of the association between them is quantified; the definition expressions of support and confidence are as follows: Among them, Count(A∪ B) represents the number of itemsets that contain both A and B, N represents the total number of itemsets, Support(A→B) represents the frequency of simultaneous occurrence of itemsets A and B, Confidence(A→B) represents the confidence of item set A for item set B, and Support(A) represents the support of item set A.

3. The method for locating social media users based on heterogeneous graphs according to claim 1, characterized in that: The step S2 is specifically as follows: S21. Build heterogeneous networks; First, a heterogeneous network is constructed, that is, a main relation network MRN is constructed, which is presented in the form of an undirected graph G(V, E); Among them, V represents the vertex set and E represents the edge set; Then, the "key behavior node" described in step S1 is added as a node type to the heterogeneous network, that is, a heterogeneous node containing geographic information, and the heterogeneous network includes: users and their behavior nodes, and social relationship nodes between users; The vertices in the vertex set V include: users in the social network, various heterogeneous nodes containing geographic information, namely, user self-description information, user personal dynamic text, user friend related information, and forwarded dynamic original text information; the edge set E defines the connection relationship between heterogeneous nodes, including: based on direct interaction of users and based on indirect geographic information association; Among them, user self-description information includes: homepage introduction, GPS location; user personal dynamic text includes: original dynamic, forwarded dynamic; user friend related information includes: friend personal information, friend original dynamic, friend forwarded dynamic; forwarded dynamic original text information includes: original author information; S22, after extracting user features, filter the user's friends; Based on step S21, all unidirectional attention relationships in the social network data set are excluded, and only the information of friends who follow each other is retained. Then, the feature vectors of users are extracted from the remaining friend relationships, and hierarchical clustering is performed on the users. The bidirectional friend relationships are screened by selecting an appropriate number of clusters. The user's feature vector includes: a text feature vector and a geographic entity feature vector connected by vectors; extracting the user's feature vector is specifically as follows: (1) Text feature vector; First, filter the user's n personal dynamic texts, using the following fields: lang, retweeted_status_result; The filtered tweets are embedded using transformer encoding, using several tokens of the tokenizer sentence and calculating the word embedding E for each token separately. token , Position Embedding E position , segment embedding E segmeent , each token is embedded with E = E position +E token +E segment express; Then, a bidirectional attention mechanism is used to embed the obtained token sequence [E1, E2, E3, ..., E n ], for position i, E i Calculate its attention score with other vectors to get the output sequence [H1, H2, H3, ..., H n ], and finally use the average embedding to get the vector representation of each dynamic text It is used to represent the focus of a single dynamic text of the user. Finally, the self-attention mechanism is also used to obtain the overall embedding E of the user text. text =∑W i vec i ; Among them, W i Represents the self-attention weight of the text feature vector, Vec i The vector representation of the text, namely E sentence ; (2) Geographic entity feature vector; Use natural language processing to obtain the user's personal dynamic text, personal homepage, user self-description, and geographical entities contained in GPS positioning. Apply the same method as the personal dynamic text embedding, that is, the bidirectional attention mechanism, to the obtained m geographical entity sequences to obtain the embedding of geographical entities. For the obtained user geographical entities (Entity1, Entity2, ..., Entity m ), and combined into a sequence L = (Entity1, Entity2, ..., Entity m ), obtain the transformer embedding of each geographic entity in this sequence, and then use the attention mechanism to use these embeddings as the vector representation of the user's geographic location, denoted as vec location ; Finally, concatenate the two vectors E user =(E sentence ,vec location ), taking into account both the degree of relevance of users in terms of personal interests and their degree of relevance in terms of geographic location; Get the user's embed user Then, hierarchical clustering is used to screen the intimacy of the user's friend relationship. The friend users in the same cluster as the user to be inferred are regarded as the screened close users. A bottom-up clustering method is used, that is, each data point is used as an initial cluster, and clusters are merged according to the closest distance between clusters. The two closest clusters are merged into a new cluster until the number of clusters reaches the stopping condition, as follows: The obtained user feature vector E user As data points, use the ward method to calculate the cluster distance and minimize the increase in variance within the cluster after merging. Among them, C i , C j Represents different clusters, C ij Represents C i , C j After the clusters are merged, S(C) represents the internal sum of squares of cluster C, that is, the sum of the squared distances of all points in the cluster to the centroid of the cluster. Represents the variance change after cluster merging.

4. The method for locating social media users based on heterogeneous graphs according to claim 1, characterized in that: The step S3 is specifically as follows: Based on step S2, after completing the screening of user friend relationships and extracting geographic entities in the close user set using natural language processing, install and configure the Nominatim local service for structured query; Nominatim is used by users to accurately retrieve geographic entities based on multiple fields; the multiple fields include: city, state, country, which represent the geographic location information at the city, state / province and country levels respectively. The two key problems solved by structured query are as follows:

1. Problem of duplicate place names: Through Nominatim's structured query, place names are accurately mapped to specific administrative divisions based on the fields country and state, thereby eliminating ambiguity and ensuring the accuracy of query results; 2. Multi-level location reasoning and verification: Structured queries provide precise classification of place names, allowing the user's location attributes to be gradually inferred according to the hierarchical structure of country, state / province, and city; While classifying the geographical entities through the Nominatim service, the place name entities are converted into their corresponding geographical longitude and latitude coordinates [p1, p2, ..., p n ], use DBSCAN clustering to predict the user's location on these coordinates, as follows: First, initialize all geographic coordinates obtained after longitude and latitude conversion, mark all points as unvisited, and then find core points. For each point p, calculate its neighborhood Nε(p) = {q∈D|distance(q, p)≤ε}. If the number of points in the neighborhood is greater than the set threshold A, then p is regarded as a core point. Among them, N ε (p) represents the area centered on point p, point q represents another point, and distance(q, p) represents the distance between point p and point q. The meaning of this expression is that all points whose distance to point p is less than ε are considered to be points in its neighborhood; For each core point p, all points in its area are added to the corresponding cluster. If the added point p i is also a core point, then p i All points in the domain are added to the cluster until no new points can be added to the cluster; after all core points have completed this operation, the points that are not marked as core points or boundary points are considered as noise points; after completing DBSCAN clustering, the cluster with the largest density is selected as the credible cluster, and the position of its center point is used as the prediction result and the possible home location of the user to complete the user's positioning; At the same time, considering the occurrence of abbreviations, we introduce the judgment of token position to eliminate the ambiguity of abbreviations, as follows:

1. The abbreviation appears alone; If no other information about the geographic location appears in the text, the specific meaning of the abbreviation cannot be determined, and in this case the abbreviation is not processed; 2. The abbreviation appears in combination with other place names; By designing a token position judgment method, if two entities appear consecutively and their appearance is a combination of a simple geographic entity and an abbreviated geographic entity, they are combined into a complex place name to determine the specific meaning of the abbreviated geographic entity.

Citation Information

Patent Citations

  • Social network user interest association rule mining method based on community division

    CN103838804A

  • Knowledge reasoning method based on multi-modal knowledge graph

    CN112288091A

  • Target service determination method and device based on heterogeneous graph neural network

    CN115310762A

  • Identification of Low-Quality Place-Entities on Online Social Networks

    US20170201851A1

Cited By

  • Online adaptive information recommendation method and system based on graph retrieval enhancement

    CN120723981A