A network representation learning method based on layered negative sampling

By adopting a hierarchical negative sampling method in network representation learning, using the potential community structure of vertices to dynamically select negative samples, the problem that existing methods fail to effectively utilize vertex neighborhood information is solved, and the performance and robustness of network representation learning are improved. sex.

CN115422445BActive Publication Date: 2024-11-26SHENZHEN UNIV
View PDF 0 Cites 0 Cited by

Patent Information

Application Number
CN202211007471.6
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2022-08-22
Publication Date
2024-11-26
Estimated Expiration
2042-08-22

AI Technical Summary

Technical Problem

Existing network representation learning methods fail to effectively utilize the neighborhood information of vertices when sampling negative samples, resulting in unreasonable negative samples sampled, affecting the performance of network representation learning, especially in large-scale networks.

Method used

A network representation learning method based on hierarchical negative sampling is proposed. By modeling the potential community structure of vertices through random walk sequences, dynamically compute the probability of negative samples, and optimize the objective function to obtain a more reasonable vertex representation learning vector.

Benefits of technology

The performance of network representation learning is improved by modeling the latent structure of vertices and dynamically selecting negative samples, especially in vertex classification tasks, and performs well in network data of different sizes.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN115422445B_ABST
    Figure CN115422445B_ABST
Patent Text Reader

Abstract

The present invention discloses a network representation learning method based on hierarchical negative sampling. The method comprises: obtaining a set of random walk sequences for a graph network, each walk sequence consisting of a set of vertices; for each set of random walk sequences, modeling the domain information of the vertices to determine the potential community structure of the target vertex; based on the potential community structure, calculating the probability of each vertex being a negative sample of the target vertex to sample negative samples; optimizing the set objective function based on the sampled negative samples, and then determining the vertex representation learning vector. The present invention can adaptively discover the potential community structure of vertices, and learn to obtain more reasonable negative samples based on the probability distribution of the vertex correlation of the community, thereby improving the performance of the vertex representation learning vector.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present invention relates to the technical field of data mining and machine learning, and more specifically, to a network representation learning method based on layered negative sampling.

[0002] Application Scenario

[0003] For example, in a social network, each user can be regarded as a vertex, and the social relationship between users can be represented by the connecting edges between vertices. When a new user appears, how to recommend the most likely related users to the new user is one of the scenarios to be handled by the present invention. The same scenario can also be seen in a citation network. An article can be regarded as a vertex, and the citation relationship between articles can be regarded as the connecting edges between vertices. When a new article appears, how to retrieve potentially related articles for the article is also a scenario that can be handled by the present invention.

[0004] In this paper, a network representation learning method based on layered negative sampling is proposed, which can learn more discriminative vertex representation vectors than previous methods, that is, based on the vertex network structure, the relationship between vertices is mapped to a low-dimensional vector space. After obtaining the vertex representation vector, simple discriminant methods (such as SVM) or clustering methods (Kmeans) can be used to complete tasks such as vertex classification, link prediction and community detection. Background Art

[0005] With the rapid development of social networks, a large number of algorithmic models for network analysis have been proposed. In particular, network representation learning (NRL, also known as network embedding method) has demonstrated its effectiveness in network analysis tasks. Network representation learning aims to map vertices and edges to a low-dimensional vector space through encoding, thereby modeling the graph network. These learned vertex and edge representation vectors can be used for subsequent applications, such as vertex classification, link prediction, and community detection. Negative sampling (NS) is often used to improve the performance of network representation learning. However, current research work usually only randomly samples negative samples based on vertex frequency, that is, vertices with higher frequencies are more likely to be sampled, which results in the sampled vertices may not be true negative samples, so that the learned vertex and edge representation vectors cannot achieve satisfactory performance when used in subsequent applications. In addition, by utilizing the similarity between the community distribution in the network and the topic distribution in the document, the neighborhood information of the vertex can be modeled as a potential topic distribution structure, so the present invention is also related to the topic modeling method.

[0006] In the following, we will introduce the related research on network representation learning, network representation learning based on negative sampling, and topic modeling related to network representation learning.

[0007] 1) Network representation learning

[0008] At present, there are many types of network representation learning schemes. For example, the DeepWalk method uses random walks to explore the structural information in the network, and the obtained walk sequence can be used to learn the network embedding vector using the Skip-Gram model. For another example, a general graph embedding method is proposed, which can explicitly calibrate the distance between vertices to maintain the similarity between vertices in the embedding space. In summary, DeepWalk, LINE, Node2vec, DRNE, AROPE and other methods are currently proposed to explore the topological structure of the network. These methods optimize the corresponding objective functions according to different tasks, but are limited to using negative sampling methods, that is, sampling negative samples to calculate the objective function based on Skip-Gram. To this end, some scholars have proposed alternatives to negative sampling, such as the hierarchical Softmax method and the noise contrast estimation method, but the existing literature shows that negative sampling usually performs better than alternatives in the task of network representation learning. In addition, all these alternative methods and negative sampling have a common limitation, that is, negative samples are sampled from a fixed distribution of vertices, so more reasonable negative samples cannot be dynamically selected.

[0009] 2) Network representation learning based on negative sampling

[0010] Negative sampling first appeared in the Skip-Gram model, which can be used as a neural network language model for learning word embeddings. Since the Skip-Gram model needs to sum the representation vectors of all vertices in each update, its objective function is not feasible to calculate in large-scale networks. Negative sampling aims to simplify the objective function of Skip-Gram by extracting the vectors from a uniform distribution P. NS To simplify the computational complexity, we sample negative samples from the fixed distribution P. NS Negative samples sampled in the , that is, vertices with higher frequency are more likely to be sampled as negative samples of each target vertex. This method may lead to poor network representation learning performance, especially for vertices with larger degrees, because the target vertex has a greater probability of selecting irrelevant vertices with larger degrees as negative samples.

[0011] In order to generate high-quality negative samples, some scholars have proposed improved methods. For example, a distance negative sampler is defined, and a vertex cannot select vertices in its 1st-order neighborhood as negative samples. In addition, highly correlated vertices in the Nth-order neighborhood of the target vertex can also be sampled. When using gradient descent to optimize the objective function, suitable negative samples can also be obtained by selecting vertices with larger gradients, for example, applying a generative adversarial network (GAN) in a reinforcement learning manner to select negative samples. However, these GAN-based methods have high variance because they allow vertices to select their neighbors as negative samples, resulting in erroneous information propagation and unstable performance of the final network representation learning. Therefore, existing methods generally neither model the neighborhood information of vertices nor are conducive to selecting reasonable vertices as negative samples of target vertices.

[0012] 3) Topic modeling related to network representation learning

[0013] After performing random walks on the vertices in the network, multiple sets of vertex sequences can be obtained. For example, vertices can be regarded as words, and the vertex sequences obtained by the walk can be regarded as a sentence. Therefore, topic models and their variants can be used to model the domain information of vertices. Some existing works have explored the potential topic structure in the network to achieve network representation learning. However, these methods do not consider how to select more reasonable negative samples. In addition, these methods use a predefined number of topics in modeling, but this number is usually unknown in the real world and will have a great impact on the final performance of the model. There are also some works in topic models that select negative samples by sorting the gradient size of negative samples to improve negative sampling. However, these methods still allow a word to select its more relevant neighbors as negative samples, which will lead to a decrease in the performance of network representation learning.

[0014] After analysis, it is found that existing network representation learning models generally use Skip-Gram for parameter optimization. Skip-Gram is an optimization method that maximizes the probability of content co-occurrence in a sliding window. After searching the neighborhood of the vertex, these models usually use the Skip-Gram model to learn the representation learning vector of the vertex, where the content in the sliding window corresponds to the neighboring vertices in the graph. However, due to the computational complexity of the optimization function in Skip-Gram, most network representation learning methods use negative sampling methods to approximate the objective function in Skip-Gram. Negative sampling can usually achieve better performance than other optimization methods in large-scale datasets. Its main idea is to encourage the representation vector of the target vertex to be close to the representation vector of its neighbors and away from the representation vector of its negative samples.

[0015] However, existing negative sampling methods sample negative samples based on the frequency of vertex occurrence without considering the network structure in which the negative samples are located, so unreasonable negative samples may be sampled. For example, for a certain target vertex, its neighboring vertices may be sampled as negative samples, which will lead to poor network representation learning performance. To solve this problem, some scholars defined a distance negative sampler, which selects negative samples from the set {V-{N(u)∪u}} for each target vertex u, where V is the vertex set and N(u) is the neighbor of u, see Figure 1 The different order neighborhoods of the target vertex 1 are shown. From the center to the periphery, the vertices in the first dotted circle are the first order neighbors of vertex 1. The vertices in the second and third dotted circles are the second and third order neighbors of vertex 1, respectively. The scheme is to exclude the vertices in the first order neighborhood of vertex 1 from the selection of negative samples, for example, vertices 2, 3, and 4 in the first order neighborhood. However, none of the current schemes considers the domain information of the target vertex for negative sample sampling. In short, for Figure 1 The target vertex is 1, and the existing scheme can still select vertex 11 as its negative sample.

[0016] In addition, it is difficult to determine the optimal order of retaining the target vertex's neighboring regions, that is, the vertices in these regions are not selected as negative samples of the target vertex. For example, if the optimal order is set to 1, the vertices in the 1st-order neighborhood of the target vertex will not be used as negative samples, and the vertices in the 2nd-order neighborhood or 3rd-order neighborhood of the target vertex may be selected as negative samples. However, the setting of the optimal retention order varies in different data sets, and whether the setting is reasonable will affect the network representation learning performance. Summary of the invention

[0017] The purpose of the present invention is to overcome the defects of the above-mentioned prior art and provide a network representation learning method based on layered negative sampling, which comprises the following steps:

[0018] For the network G = (V, E), obtain a set of random walk sequences S = {s1,…,s M}, where N is the size of the vertex set, M is the number of random walks, and V is the vertex set. represents a set of edges. Each walk sequence s consists of a set of vertices {v1,…,v N};

[0019] For each set of random walk sequences, the neighborhood information of the vertices is modeled to determine the potential community structure of the target vertex;

[0020] Based on the potential community structure, the probability of each vertex being a negative sample of the target vertex is calculated to sample negative samples;

[0021] The set objective function is optimized based on the sampled negative samples, and then the vertex representation learning vector is determined.

[0022] Compared with the prior art, the advantage of the present invention is that a new negative sampling method, namely hierarchical negative sampling (HNS), is proposed, which can model the potential structure of vertices and learn the relationship between them. During the training process, more reasonable negative samples can be sampled, thereby obtaining better network representation learning performance. The present invention can be applied to network data of different scales, and its performance in vertex classification tasks is better than that of existing network representation learning models.

[0023] Further features and advantages of the present invention will become apparent from the following detailed description of exemplary embodiments of the present invention with reference to the attached drawings. BRIEF DESCRIPTION OF THE DRAWINGS

[0024] The accompanying drawings, which are incorporated in and constitute a part of the specification, illustrate embodiments of the invention and, together with the description, serve to explain the principles of the invention.

[0025] Figure 1 It is a schematic diagram of different order fields of target vertices in the prior art;

[0026] Figure 2 is a schematic diagram of a probability graph model of stratified negative sampling according to an embodiment of the present invention;

[0027] Figure 3 is a schematic diagram of a training framework for hierarchical negative sampling according to an embodiment of the present invention;

[0028] Figure 4 is a schematic diagram of the correlation between the number of communities and the network representation learning performance according to an embodiment of the present invention;

[0029] Figure 5 is a schematic diagram showing the effect of the number of communities found under different α values ​​according to an embodiment of the present invention;

[0030] In the attached figure, Targeted vertex-target vertex; Rank 1 neighbors-first-order neighborhood; Rank 2 neighbors-second-order neighborhood; Rank 3 neighbors-third-order neighborhood; Number Setting of Communities-number of communities set. DETAILED DESCRIPTION

[0031] Various exemplary embodiments of the present invention will now be described in detail with reference to the accompanying drawings. It should be noted that the relative arrangement of components and steps, numerical expressions and numerical values ​​set forth in these embodiments do not limit the scope of the present invention unless otherwise specifically stated.

[0032] The following description of at least one exemplary embodiment is merely illustrative in nature and is in no way intended to limit the invention, its application, or uses.

[0033] Technologies, methods, and equipment known to ordinary technicians in the relevant art may not be discussed in detail, but where appropriate, the technologies, methods, and equipment should be considered part of the specification.

[0034] In all examples shown and discussed herein, any specific values ​​should be interpreted as merely exemplary and not limiting. Therefore, other examples of the exemplary embodiments may have different values.

[0035] It should be noted that like reference numerals and letters refer to similar items in the following figures, and therefore, once an item is defined in one figure, it need not be further discussed in subsequent figures.

[0036] The present invention proposes a new negative sampling method, called hierarchical negative sampling (HNS) technology, which is used to model the N-order neighborhood information of the target vertex. The present invention does not need to manually set a threshold to retain the optimal order of the neighboring area of ​​the target vertex, but can adaptively discover the potential community structure of the vertex, and then calculate the probability of each vertex being a negative sample of the target vertex based on the structure. Specifically, for the target vertex, HNS first marks it as belonging to a certain community, and then samples negative samples from it according to the probability distribution of the vertex correlation of the community to optimize the objective function. By modeling the domain information of vertices in the network into the hierarchical structure of the community, more reasonable negative samples can be learned, thereby improving the performance of vertex representation learning vectors.

[0037] In the following, we will introduce the key knowledge about network representation learning, as well as the main mathematical symbols and expressions.

[0038] 1. Random walks

[0039] In one embodiment, a network is represented by G=(V, E), where V represents a vertex set, Represents a set of edges. Using the random walks algorithm, we obtain a set of sequences S = {s1,…,s M}, each sequence s consists of a set of vertices {v1,…,v N}, where N is the size of the vertex set and M is the number of random walks.

[0040] 2. Skip-Gram Model

[0041] Skip-Gram is a shallow neural network model that can be used for network representation learning algorithms. For each vertex v in the sequence s i The Skip-Gram goal is to make the context vertex {v i-t ,…,v i+t}\v i The average logarithmic probability of is maximized, and the formula is expressed as:

[0042]

[0043] Among them, v j is the vertex v i context vertex, |s| represents the number of vertices in the sequence, P(v j ∣v i ) is the softmax function, defined as follows:

[0044]

[0045] Where v∈R d Represents the learned vertex representation vector, d is the dimension of the vector, v′ j Represents vertex v j The transpose of the vector, v′ v Represents vertex v v The transpose of a vector.

[0046] 3. Negative Sampling

[0047] As shown in formula (2), the denominator of the softmax function requires the dot product of the vector representations of all vertices and the vector representation of the target vertex at each iteration and then summing them up. Therefore, in large-scale networks, the Skip-Gram function is computationally infeasible, and negative sampling simplifies the function calculation process. Specifically, given a target vertex v i and its context vertex v j , the negative sampling function is expressed as:

[0048]

[0049] Where, σ(x) = 1 / (1+exp(-x)), v k From the probability P NS (v) (the probability distribution of vertices can be set as random sampling) where K is the number of negative samples and V′ k Represents vertex v k The transpose of the vector, V′ j Represents vertex v j The transpose of a vector.

[0050] 4. Hierarchical Negative Sampling Method Proposed in the Present Invention

[0051] In the following, we first explain the problem of negative sampling when it is used to approximate the Skip-Gram function, which also exists in other models that use negative sampling, such as NSCaching, R-NS, and SGA. Then, we introduce the HNS model of the present invention and how it solves the existing problems.

[0052] 1. Problems in the existing technology

[0053] Negative sampling selects unreasonable samples (i.e., vertices related to the target vertex) as negative samples. As described in the article by Mikolov et al. (Distributed representations of words and phrases and their compositionality, in: Advances in neural information processing systems, 2013, pp. 3111–3119), negative sampling will P NS (v) is defined as Proportional uniform distribution, where d v is the frequency of vertex v in the sequence, which is a human-set prior parameter, usually set to 3 / 4. In summary, for each vertex, negative sampling is performed from a fixed distribution P NS (v) Negative samples are uniformly sampled, and the formula is described as follows:

[0054]

[0055] From formula (4), we can see that vertices with higher frequencies are more likely to be sampled as negative samples of the target vertex. Figure 1 As shown in , when the high-frequency vertex is located in the 2nd-order neighborhood or 3rd-order neighborhood of the target vertex, the strategy may sample the high-frequency vertex, resulting in poor network representation learning performance. In addition, it can be seen from formula (4) that P NS (v) is a fixed distribution obtained from the sequence S, so it cannot use the information of related vertices to model the potential community structure and thus more appropriately select negative samples. The existing state-of-the-art models, such as the framework based on the adversarial generative network GAN, including Kbgan, NSCaching, SGA and other models, propose to use σ(-v′) in formula (3) k ·v i), to dynamically select vertices with larger gradients to obtain high-quality negative samples, thereby improving negative sampling methods. However, the performance of these methods usually has high variance, because the related vertices in the N-th order neighborhood of the target vertex may be regarded as negative samples. Therefore, these gradient-based methods may produce error propagation, resulting in unstable model performance. Alternatively, the existing technology only considers Figure 1 The first-order neighborhood of the target vertex in , which is not enough to explore the correlation between vertices.

[0056] 2. HNS model modeling of neighborhood information

[0057] After performing random walks on the network, we can get the walk sequence S. First, we can model the neighborhood information of the vertex as a potential community structure. Then, we follow the following assumptions: (1) Each random walk sequence is a sampling of the community potential structure; (2) Each vertex has a probability distribution of its community preference.

[0058] The present invention considers how to select negative samples. In addition, the number of communities in the real world is often unknown, but existing algorithms usually require the number of communities to be set in advance, so they cannot handle the dynamic changes in the number of communities during community discovery problems. In one embodiment of the present invention, a hierarchical Dirichlet process is used to explore the potential community structure, which provides a non-parametric method for inferring the number of communities. The probabilistic graphical model of HNS is as follows Figure 2 As shown, the generation process includes the following steps:

[0059] Step S1, modeling the probability distribution of all known communities C G0|γ,C~Dir(γ / C), where G0 represents the base distribution of the Dirichlet process, Dir(γ / C) represents the Dirichlet prior distribution of the sequence with respect to the degree of community correlation, γ is a hyperparameter, and C represents the number of communities;

[0060] Step S2, for each community c∈{1,2,…,C}:

[0061] (a) The probability that each vertex belongs to the community is Among them, Dir(β) represents the Dirichlet prior distribution of the community correlation degree of a vertex in the sequence, and β is a hyperparameter;

[0062] Step S3, for each sequence s obtained by walking:

[0063] (a) According to the weight θ s |α,G0~DP(α,G0), sampling obtains the community where the sequence is located, where θ s Indicates, α represents the weight representing that vertex v belongs to the new community, and DP(α,G0) represents the use of Dirichlet process to model the degree of correlation of sequences belonging to the new community;

[0064] (b) For each vertex v∈{v1,v2,…,v N}:

[0065] i. According to the weight Z S,v ∣θ S ~Multinomial(θ S ), sample a community assignment for the vertex, where Z s,v Represents the probability distribution of the degree of relevance between vertex v in sequence s and all communities;

[0066] ii. Get the generation probability of the vertex from the assigned community in, represents the probability distribution of vertices in community c that are related to this community, The weight represents the correlation between the vertex v in the sequence s and a sampled community.

[0067] Where C represents the discovered community set, which is initialized as |C|=1, γ and β are Bayesian parameters in the Dirichlet prior distribution, and DP represents the Dirichlet process. In summary, HNS is a model based on Hierarchical Dirichlet Processes (HDP), the number of community sets C can change dynamically, and the model of the present invention can automatically learn to determine the number of communities during the training process.

[0068] 3. Training framework of HNS of the present invention

[0069] In one embodiment, the proposed model training framework is as follows Figure 3 Specifically, for each set of random walk sequences, a sliding window is first used to generate vertex pairs of positive samples, for example, Figure 3 Vertex 4 in is the target vertex, so the vertex pairs of the positive samples are (4,3) and (4,5). Then, according to Figure 2 For the generation process mentioned in the neighborhood information modeling, a community is assigned to the target vertex 4, and the negative sample of the target vertex is sampled through the reverse distribution of the community-related vertices. Finally, the vertex representation vector is learned by combining the negative sampling method.

[0070] 4. Model Reasoning

[0071] In one embodiment, Gibbs sampling is used to Figure 2 Specifically, given a sequence s, for each vertex v in the sequence, there is a potential community weight distribution Z s,v, then using the property that the Dirichlet distribution is the conjugate prior distribution of the multinomial distribution, the parameter θ associated with the community distribution S and can be eliminated by integration. Therefore, given the other vertices in the sequence s except the current vertex v, the community distribution information of other vertices in the sequence s can be obtained And the distribution of other vertices in a community c except sequence s Finally, the probability that a vertex v chooses an existing community can be obtained from a conditional distribution, for example, using the formula According to the calculated probability, the sampling selects community c to assign to vertex v. There are two cases for sampling community c: selecting an existing community or a new community. The corresponding probability formula is as follows:

[0072] 1) Choose an existing community

[0073] Given the information of other sequences and community assignments of vertices, the probability that the current vertex v selects the existing community c is:

[0074]

[0075] in represents the number of vertices assigned to community c in sequence s except the current vertex v, represents the number of communities c to which vertex v is assigned, except for the current sequence s. In summary, the left half of the product of equation (5) means that vertex v tends to choose communities that have more vertices assigned in the same sequence, and the right half means that vertex v is more inclined to choose communities with higher co-occurrence rates with other vertices.

[0076] 2) Choose a new community

[0077] C represents the number of existing communities, and C+1 represents a new community. Then the conditional probability formula for vertex v belonging to a new community is as follows:

[0078]

[0079] The left half of the product represents the probability that vertex v belongs to a new community, the right half is a normalization factor, and N represents the number of vertices. α is a priori parameter. The larger α is, the more likely the vertex is to choose a new community. In the experiment, it was found that the performance of the HNS model is robust to the parameter α.

[0080] 3) Sampling more reasonable negative samples:

[0081] review Figure 3 The training framework shown in the figure first uses equations (5) and (6) to define the target vertex v tSample a community c. Then, negative samples can be sampled from this community, and the probability of other vertices in the community being considered as negative samples is calculated as follows:

[0082]

[0083] The principle behind formula (7) is that when the target vertex is assigned to community c, the negative sample should be the vertex with less correlation with the community, and the irrelevant probability of the vertex is calculated as P neg (v). Then, combined with equation (7), for the target vertex v t , the distribution of its negative sample vertices ψ neg for:

[0084]

[0085] Where Dir(P neg (v1), ..., P neg (v N )) represents the Dirichlet prior distribution of negative sample vertices.

[0086] Finally, we can use a multinomial distribution to sample negative samples:

[0087] v|ψ neg ~Multinomial(ψ neg ) (9)

[0088] In formula (4), the fixed distribution P based on vertex frequency NS (v) Compared with the NS method for sampling negative samples, the present invention learns the vertex distribution of negative samples in the community ψ neg , we can consider the hierarchical structure of the potential community of vertices and sample negative samples according to the community information of the vertices, that is, sample vertices with less correlation with the community where the target vertex is located as negative samples.

[0089] 5) Objective function optimization analysis

[0090] The following will introduce how the HNS of the present invention optimizes the objective function based on Skip-Gram.

[0091] In one embodiment, the stochastic gradient descent (SGD) method is used to optimize the Skip-Gram-based objective function. Combining the NS method in equation (3) and equation (4), the objective function can be further derived as follows:

[0092]

[0093] where v i is the target vertex, v j is its context vertex. In HNS, we can calculate ψ negDistribution is used to sample negative samples, that is, by using P in formula (7) neg To replace P in formula (10) NS To sample negative samples. Finally, the objective function of HNS is as follows:

[0094]

[0095] In order to optimize the above objective function, its derivative is calculated as follows:

[0096]

[0097] Then, let the derivative Or → 0, we can further get the following expression:

[0098]

[0099] From the above formula we can see:

[0100] For each target vertex v i And its positive samples, such as v j , calculate the similarity between them, and optimize it to make its value close to -log(K·P neg (v j )), where -log(K·P neg (v j )) is proportional to and Represents vertex v j Belongs to the target vertex v i The probability of being in community c;

[0101] For v i And its negative samples, such as v k , through 1-P neg (v k )→0 optimizes the similarity between them. The purpose of optimization is to make the negative sample v k and assigned to the target vertex v i The correlation of community c is small. Finally, the vertex distribution ψ of the negative sample community is used neg To sample negative samples.

[0102] In summary, the hierarchical negative sampling method proposed in the present invention models the N-order neighbor information of the target vertex by designing a probabilistic graph model, thereby selecting more reasonable negative samples. The probabilistic graph model can learn the probability distribution of negative samples about the target vertex, and at the same time use the hierarchical Dirichlet process to explore the potential community structure in the network. Through the non-parametric Bayesian inference method, the model can adaptively learn the optimal order of retaining the adjacent area of ​​the target vertex. Specifically, it can be observed from formula (13) that the present invention models the potential community structure of the target vertex through the neighborhood information, and at the same time combines the negative sampling method to formulate and optimize the objective function. The detailed pseudo code is shown in Algorithm 1.

[0103]

[0104] 6) HNS algorithm complexity analysis

[0105] In HNS, the training process consists of two parts: inferring the parameters of the probabilistic graphical model using the Gibbs sampling method, and learning the vertex representation using the stochastic gradient descent method. The complexity of the first part is O(I1CVSL), where I1 is the number of iterations, C represents the size of the number of communities, V represents the dimension of the vertex embedding vector, S is the size of the number of sequences, and L is the length of the sequence. The complexity of the second part is O(I2V log V), where I2 is the number of iterations. Therefore, the overall complexity of HNS is O(V(I1CSL+I2log V)). In addition, during the training process, each part of HNS can be accelerated by existing algorithms, such as combining PLDA, PLDA+, and Skip-Gram. In large-scale scenarios, these parallel algorithms only require time linearly proportional to the data size for training.

[0106] To further verify the effect, the present invention is applied to data sets of different real network sizes for verification. In the experiment, three real-world network data sets are used to evaluate the performance of the proposed HNS model. In addition, the robustness of the performance of HNS to its parameter changes is also studied. The experiment shows that the performance of the proposed method in the vertex classification task is better than the current state-of-the-art model.

[0107] 1. Dataset

[0108] Experiments are conducted on two citation networks and one language network. Table 1 lists the detailed statistics of the dataset.

[0109] Table 1: Statistics of experimental datasets

[0110]

[0111] (1) Cora is a typical citation network dataset constructed from existing technologies. After filtering out unlabeled papers, this dataset contains 2,211 machine learning paper abstracts from 7 categories and 5,214 links between papers, which are citation relationships between papers.

[0112] (2) DBLP is a citation network dataset in the computer field. Every paper in it cites or is cited by other papers. In the experiment, conference papers from four research fields were selected: 1) Database: SIGMOD, ICDE, VLDB, EDBT, PODS, ICDT, DASFAA, SSDBM, CIKM; 2) Data mining: KDD, ICDM, SDM, PKDD, PAKDD; 3) Artificial intelligence: IJCAI, AAAI, NIPS, ICML, ECML, ACML, IJCNN, UAI, ECAI, COLT, ACL, KR; 4) Computer vision: CVPR, ICCV, ECCV, ACCV, MM, ICPR, ICIP, ICME. After preprocessing, the retained dataset contains 17,725 paper titles from the above research fields and 52,914 citation links between them.

[0113] (3) Wiki is a language network dataset that contains 2,405 web pages in 17 categories and 17,981 links between them. This dataset was first released in the LBC project and has been widely used to evaluate vertex classification tasks.

[0114] 2. Models used for performance comparison

[0115] In order to verify the performance of the present invention, the performance of HNS is compared with the current state-of-the-art models on the vertex classification task.

[0116] 1) NSCaching is a model based on generative adversarial networks. When using gradient descent to train vertex embedding vectors, it can select high-quality negative samples by calculating the gradient magnitude of negative samples.

[0117] 2) NS is the most widely used model in vertex representation learning methods. It simplifies the objective function of the Skip-Gram model but retains its performance, which is very effective for processing large-scale networks.

[0118] 3) The non-neighborhood negative sampling (NN-NS) method is a variant of NS. For each target vertex, NN-NS sets the probability of selecting its neighbors (corresponding to the first-order neighborhood of the target vertex mentioned in the shortcomings of the prior art) as negative samples to zero, because the target vertex is strongly correlated with its neighbors.

[0119] 4) HNS is a hierarchical negative sampling model proposed in the present invention, which prevents the related vertices of the target vertex from being sampled as negative samples by modeling the neighborhood information of the target vertex.

[0120] 5) HNS (w / o DP) is a variant model of HNS proposed in this invention. The difference is that the number of communities is set in advance instead of using the Dirichlet process to automatically infer the number of communities. This variant model manually searches for the optimal value of the number of communities and uses this variant as a reference baseline for HNS to evaluate whether HNS can automatically approach the optimal value and observe whether HNS achieves similar performance to HNS (w / o DP) in the vertex classification task.

[0121] 3. Model parameter setting and operating environment

[0122] For fair comparison, the following parameters are set uniformly in all methods: the number of random walks per vertex is 80, the size of the sliding window is 10, the number of negative samples per target vertex is 5, the number of iterations is 5, and the dimension of the vertex embedding vector is 200. In NSCaching, the ComplEx mode is selected to achieve the best performance. In HNS, the following hyperparameters are selected using the grid search method: γ∈{0.5,1.0,1.5}, α∈{0.02,0.06,0.1,0.14,0.18,0.2}·(1 -2 ·M), β∈{0.01,0.05,0.1}, where M is the number of random walk sequences. The following will introduce the experimental results of HNS using the parameters (γ=1.0,α=0.001·M,β=0.01). In addition, in HNS (w / o DP), the optimal value is searched in the number of communities C∈[10,100]. The model is implemented in Python language and all the comparison models are run on a Linux server with an Intel Core i9-9900 3.10GHz CPU and 16GB memory.

[0123] 4. Evaluation Metrics

[0124] In order to evaluate the classification performance of the model, Micro-F1 is used as the evaluation indicator, and its formula is as follows:

[0125]

[0126] Where C represents the number of categories, TP, FP and FN represent true positive, false positive and false negative respectively. The value of Micro-F1 is between 0 and 1, and the higher the value, the better the classification performance.

[0127] 5. Evaluate the performance of the model on the vertex classification task

[0128] For the vertex classification task, the learned vertex embedding vectors are used as features, and the classifier is trained using One-vs-rest logistic regression implemented by Liblinear. Then, the vertex classification accuracy of all methods in datasets with different training ratios is evaluated. Specifically, referring to the settings used in DeepWalk, a training ratio of 1% to 10% is used to evaluate the performance of HNS in sparse scenarios. For each training ratio, some vertices are randomly selected as the training set, and the remaining vertices are used as the test set. Finally, the vertex classification accuracy is evaluated using the Micro-F1 indicator.

[0129] See Tables 2, 3, and 4 for the vertex classification performance of different methods at different training ratios evaluated using the Micro-F1 metric on the Cora, DBLP, and Wiki datasets. The highest scores are highlighted in bold.

[0130] Table 2: Micro-F1 values ​​for vertex classification task on Cora dataset

[0131]

[0132] Table 3: Micro-F1 values ​​for vertex classification task on DBLP dataset

[0133]

[0134] Table 4: Micro-F1 values ​​for vertex classification task on Wiki dataset

[0135]

[0136] From the above table data, we can draw the following conclusions:

[0137] 1) The proposed model HNS and its variant HNS (w / o DP) consistently outperform other comparison models in vertex classification performance on different datasets at different training ratios, except for the cases where the training ratios are 2%, 3%, and 4% in the Wiki dataset, which proves the effectiveness of the model. In addition, HNS can achieve similar or better performance than HNS (w / o DP).

[0138] 2) In these tasks, especially on the Wiki dataset, we can see that NN-NS obtains higher Micro-F1 scores than NS and NSCaching models in most cases. This is because, when selecting negative samples for each target vertex, the NN-NS model can exclude the first-order domain of the target vertex. However, NN-NS only considers the first-order domain of the target vertex. When the second-order domain or third-order domain of the target vertex or even the vertices of the N-order neighborhood are also related to the target vertex, the performance of the model will inevitably decrease.

[0139] 3) After considering the latent hierarchical structure of vertices, HNS and its variants are able to learn more discriminative vertex embedding vectors. In addition, even if the training dataset is small, the proposed model still outperforms the baseline method, which shows that sparse scenes can be better handled.

[0140] 6. Robustness of model parameters

[0141] Furthermore, the effects of HNS (w / o DP) and parameters in HNS on the performance of vertex classification tasks, such as the number of communities C and the hyperparameter α, are studied. Experiments show that the method of the present invention is robust.

[0142] First, the effect of the number of communities on the vertex classification task of HNS (w / o DP) is studied to verify whether HNS can automatically find the optimal value of the number of communities. For example, the number of communities is changed on the Cora, DBLP and Wiki datasets, i.e., C∈({10,20,40,60,80},{10,20,50,80,100},{10,20,30,40,50,60}) to test HNS (w / o DP).

[0143] Figure 4 is the vertex classification result of HNS (w / o DP) after setting different numbers of communities on three datasets. 4(a) corresponds to the Cora dataset, Figure 4 (b) corresponds to the DBLP dataset, Figure 4 (c) Corresponding Wiki dataset. Each data point represents the average Micro-F1 performance of each dataset under the current setting of the number of communities with a training ratio of 1% to 10%.

[0144] Depend on Figure 4 The following observations can be obtained:

[0145] 1) The Micro-F1 value of HNS (w / o DP) fluctuates with the number of communities, especially on DBLP and Wiki datasets. Figure 4 (a), Figure 4 (b) and Figure 4 In (c), the fluctuation range of the Micro-F1 value curve of HNS (w / o DP) is 60.14%, 64.39% and 49.85%, respectively. In addition, when the number of communities is 40, 50 and 30, respectively, HNS (w / o DP) can achieve relatively stable and efficient vertex classification performance on Cora, DBLP and Wiki.

[0146] 2) HNS can automatically approach the best performance of HNS (w / o DP). It can be seen that the Micro-F1 values ​​achieved by HNS on the three datasets are 59.35%, 64.46%, and 50.27%, respectively. In addition, the number of communities discovered by HNS is 39, 56, and 34, respectively, which verifies that HNS can automatically approach the optimal number of communities set in HNS (w / o DP).

[0147] In addition, we study the effect of the hyperparameter α on the number of communities found and Micro-F1 value in HNS. We use α∈{0.02, 0.06, 0.1, 0.14, 0.18, 0.2}·(1e -2 M) varies the value of α on the three datasets, where M is 2211, 17725, and 2405 in Cora, DBLP, and Wiki, respectively.

[0148] Figure 5 is the effect of the hyperparameter α on the number of communities found by HNS and the Micro-F1 value, where Figure 5 (a) is the effect of parameter α on the number of communities discovered by HNS. Figure 5 (b) is the effect of parameter α on the Micro-F1 value. M represents the total number of random walk sequences in each dataset, which are 2211, 17725 and 2405 in Cora, DBLP and Wiki, respectively.

[0149] Depend on Figure 5 The following results can be obtained:

[0150] 1) Figure 5 (a) shows the number of communities found by HNS under different α values. It can be seen that on the three datasets, the number of communities found increases with the increase of α. This is because α represents the probability of a vertex selecting a new community.

[0151] 2) Figure 5 (b) shows the Micro-F1 values ​​of HNS under different α values. It should be mentioned that although the number of communities discovered by HNS increases with the increase of α, its Micro-F1 values ​​on all datasets remain stable, which shows that HNS is robust to changes in the hyperparameter α.

[0152] In summary, the network representation learning method based on hierarchical negative sampling proposed in the present invention is the first to study the domain information of modeling vertices to sample negative samples. It can explore the potential structure of vertices when selecting negative samples, and use the N-order neighborhood information of the target vertex to sample more reasonable negative samples. Specifically, the present invention combines the probabilistic graph model to select negative samples according to the N-order neighbor information of the target vertex. The learned distribution of negative sample community vertices can be considered as the probability that each vertex is sampled as a negative sample of the target vertex, and the optimal order of the vertex adjacent area that needs to be retained can be automatically found. In addition, the hierarchical Dirichlet process is used to explore the potential community structure of network vertices, which provides a non-parametric method for inferring the number of communities in the network. Experimental results show that in real networks of different training scales, the present invention outperforms the performance of the most advanced models in vertex classification tasks.

[0153] The present invention may be a system, a method and / or a computer program product. The computer program product may include a computer-readable storage medium carrying computer-readable program instructions for causing a processor to implement various aspects of the present invention.

[0154] Computer readable storage medium can be a tangible device that can hold and store instructions used by an instruction execution device. Computer readable storage medium can be, for example, but not limited to, an electrical storage device, a magnetic storage device, an optical storage device, an electromagnetic storage device, a semiconductor storage device, or any suitable combination thereof. More specific examples (non-exhaustive list) of computer readable storage medium include: a portable computer disk, a hard disk, a random access memory (RAM), a read-only memory (ROM), an erasable programmable read-only memory (EPROM or flash memory), a static random access memory (SRAM), a portable compact disk read-only memory (CD-ROM), a digital versatile disk (DVD), a memory stick, a floppy disk, a mechanical encoding device, for example, a punch card or a convex structure in a groove on which instructions are stored, and any suitable combination thereof. The computer readable storage medium used here is not interpreted as a transient signal itself, such as a radio wave or other freely propagating electromagnetic wave, an electromagnetic wave propagated by a waveguide or other transmission medium (for example, a light pulse by an optical fiber cable), or an electrical signal transmitted by a wire.

[0155] The computer-readable program instructions described herein can be downloaded from a computer-readable storage medium to each computing / processing device, or downloaded to an external computer or external storage device via a network, such as the Internet, a local area network, a wide area network, and / or a wireless network. The network can include copper transmission cables, optical fiber transmissions, wireless transmissions, routers, firewalls, switches, gateway computers, and / or edge servers. The network adapter card or network interface in each computing / processing device receives the computer-readable program instructions from the network and forwards the computer-readable program instructions for storage in the computer-readable storage medium in each computing / processing device.

[0156] The computer program instructions for performing the operation of the present invention may be assembly instructions, instruction set architecture (ISA) instructions, machine instructions, machine-dependent instructions, microcode, firmware instructions, state setting data, or source code or object code written in any combination of one or more programming languages, including object-oriented programming languages, such as Smalltalk, C++, Python, etc., and conventional procedural programming languages, such as "C" language or similar programming languages. Computer-readable program instructions may be executed entirely on a user's computer, partially on a user's computer, as an independent software package, partially on a user's computer, partially on a remote computer, or entirely on a remote computer or server. In the case of a remote computer, the remote computer may be connected to the user's computer via any type of network, including a local area network (LAN) or a wide area network (WAN), or may be connected to an external computer (e.g., using an Internet service provider to connect via the Internet). In some embodiments, an electronic circuit, such as a programmable logic circuit, a field programmable gate array (FPGA), or a programmable logic array (PLA), may be personalized by utilizing the state information of the computer-readable program instructions, and the electronic circuit may execute the computer-readable program instructions, thereby realizing various aspects of the present invention.

[0157] The flowcharts and block diagrams in the accompanying drawings show the possible architecture, functions and operations of the systems, methods and computer program products according to multiple embodiments of the present invention. In this regard, each box in the flowchart or block diagram can represent a module, a program segment or a part of an instruction, and the module, a program segment or a part of an instruction contains one or more executable instructions for realizing the specified logical function. In some alternative implementations, the functions marked in the box can also occur in a different order from the order marked in the accompanying drawings. For example, two consecutive boxes can actually be executed substantially in parallel, and they can sometimes be executed in the opposite order, depending on the functions involved. It should also be noted that each box in the block diagram and / or the flowchart, and the combination of the boxes in the block diagram and / or the flowchart can be implemented by a dedicated hardware-based system that performs the specified function or action, or can be implemented by a combination of dedicated hardware and computer instructions. It is well known to those skilled in the art that it is equivalent to implement it by hardware, implement it by software, and implement it by combining software and hardware.

[0158] Embodiments of the present invention have been described above, and the above description is exemplary, not exhaustive, and is not limited to the disclosed embodiments. Many modifications and variations will be apparent to those of ordinary skill in the art without departing from the scope and spirit of the described embodiments. The selection of terms used herein is intended to best explain the principles of the embodiments, practical applications, or technical improvements in the marketplace, or to enable other persons of ordinary skill in the art to understand the embodiments disclosed herein. The scope of the present invention is defined by the appended claims.

Claims

1. A network representation learning method based on layered negative sampling, comprising the following steps: For the network G = (V, E), obtain a set of random walk sequences S = {s1,…,s M }, where N is the size of the vertex set, M is the number of random walks, and V is the vertex set. represents a set of edges. Each walk sequence s consists of a set of vertices {v1,…,v N }, the network is a social network, each user is a vertex, and the social relationship between users is represented by the connecting edges between the vertices; For each set of random walk sequences, the neighborhood information of the vertices is modeled to determine the potential community structure of the target vertex; Based on the potential community structure, the probability of each vertex being a negative sample of the target vertex is calculated to sample negative samples; Optimizing a set objective function based on the sampled negative samples, and then determining a vertex representation learning vector, so as to implement community structure detection based on the vertex representation learning vector; Wherein, using a hierarchical Dirichlet process to generate a probabilistic graphical model to determine the potential community structure includes the following steps: Model the probability distribution of all known communities C as G0|γ,C~Dir(γ / C), where G0 represents the base distribution of the Dirichlet process, Dir(γ / C) represents the Dirichlet prior distribution of the random walk sequence with respect to the degree of community correlation, γ is a hyperparameter, and C represents the number of communities. For each community c∈{1,2,…,C}, the probability of each vertex belonging to the community is set to Among them, Dir(β) represents the Dirichlet prior distribution of the community correlation degree of a vertex in the random walk sequence, and β is a hyperparameter; For each walk sequence s, according to the weight θ s |α,G0~DP(α,G0), sample the community where the walk sequence is located, and for each vertex v∈{v1,v2,…,v N }implement: According to the weight Z S,v ∣θ S ~Multinomial(θ S ), sampling a community assignment for vertices; Get the generation probability of a vertex from the assigned community Where DP stands for Dirichlet process, α represents the weight of vertex v belonging to the assigned new community, represents the probability distribution of vertices in community c that are related to this community, It represents the weight of the correlation between the vertex v in the sequence s and a sampled community. Multinomial represents a polynomial. The Gibbs sampling is used to infer the parameters of the probability graphical model, including: For a walk sequence s, for each vertex v in the walk sequence, there is a potential community weight distribution Z s,v ; Taking advantage of the fact that the Dirichlet distribution is the conjugate prior distribution of the multinomial distribution, the parameter θ related to the community distribution is S and It is eliminated by integration, and then for other vertices in the walk sequence s except the current vertex v, the community distribution information of other vertices in the walk sequence s is obtained And the distribution of other vertices in community c except the wandering sequence s Select an existing community or a new community for vertex v; Among them, the probability of selecting an existing community c for vertex v is set to: in, represents the number of vertices assigned to community c except the current vertex v in the walk sequence s, represents the number of vertices v assigned to communities c in addition to the current walk sequence s; Among them, the conditional probability that vertex v belongs to a new community is set as: Among them, C+1 represents a new community; Among them, for the target vertex v t , sample negative samples according to the following steps: The target vertex v t Sample a community c; Negative samples are sampled from the community c, where the probability of other vertices in the community c being considered as negative samples is set to: For the target vertex v t , the distribution of its negative sample vertices ψ neg It is expressed as: Use a multinomial distribution to sample negative samples: v|ψ neg ~Multinomial(ψ neg ) Among them, the community negative sample vertex distribution ψ neg Considering the hierarchical structure of the potential community of vertices, the vertices with less correlation with the community where the target vertex is located are sampled as negative samples, P neg (v) is the irrelevant probability of the vertex; Wherein, the objective function is expressed as: Among them, v k is the negative sample vertex obtained by sampling, K is the number of negative samples, V′ k Represents vertex v k The transpose of the vector, v′ j Represents vertex v j The transpose of the vector, v i Represents the target vertex, vertex v j Represents the target vertex v i The positive sample of .

2. The method according to claim 1, characterized in that The modeling of the domain information of vertices follows the following assumptions: Each random walk sequence is a sampling of the community's latent structure; Each vertex has a probability distribution of its community preference.

3. A computer-readable storage medium having a computer program stored thereon, wherein: When the computer program is executed by a processor, the steps of the method according to any one of claims 1 to 2 are implemented.

4. A computer device comprising a memory and a processor, wherein a computer program capable of running on the processor is stored in the memory, characterized in that: When the processor executes the computer program, the steps of the method according to any one of claims 1 to 2 are implemented.