openhgnn.models.HGSL¶
- class HGSL(feat_dims, undirected_relations, device, metapaths, mp_emb_dim, hidden_dim, num_heads, fs_eps, fp_eps, mp_eps, gnn_emd_dim, gnn_dropout, category, num_class)[源代码]¶
HGSL, Heterogeneous Graph Structure Learning from paper.
- 参数:
feat_dims (dict) – The feature dimensions of different node types.
undirected_relations (str) – The HGSL model can only handle undirected heterographs, while in the dgl.heterograph format, directed edges are stored in two different edge types, separately and symmetrically, to represent undirected edge. Hence you have to specify which relations are those distinct undirected relations. In this parameter, each undirected relation is separated with a comma. For example, in a heterograph with 2 undirected relations: paper-author and paper-subject, there are 4 type of edges stored in the dgl.heterograph: paper-author, author-paper, paper-subject, subject-paper. Then this parameter can be “paper-author,paper-subject”, “author-paper,paper-subject”, “paper-author,subject-paper” or “author-paper,subject-paper”.
device (str) – The GPU device to select, like ‘cuda:0’.
metapaths (list) – The metapath name list.
mp_emb_dim (int) – The dimension of metapath embeddings from metapath2vec.
hidden_dim (int) – The dimension of mapped features in the graph generating procedure.
num_heads (int) – Number of heads in the K-head weighted cosine similarity function.
fs_eps (float) – Threshold of feature similarity graph \(\epsilon^{FS}\).
fp_eps (float) – Threshold of feature propagation graph \(\epsilon^{FP}\).
mp_eps (float) – Threshold of semantic graph \(\epsilon^{MP}\).
gnn_emd_dim (int) – The dimension of hidden layers of the downstream GNN.
gnn_dropout (float) – The dropout ratio of features in the downstream GNN.
category (str) – The target node type which the model will predict on.
out_dim (int) – number of classes of the target node type.
- fgg_direct¶
Feature similarity graph generator(\(S_r^{FS}\)) dict in equation 2 of paper, in which keys are undirected-relation strs.
- Type:
nn.ModuleDict
- fgg_left¶
Feature propagation graph generator(\(S_r^{FH}\)) dict which generates the graphs in equation 5 of paper.
- Type:
nn.ModuleDict
- fgg_right¶
Feature propagation graph generator(\(S_r^{FT}\)) dict which generates the graphs in equation 6 of paper.
- Type:
nn.ModuleDict
- fg_agg¶
A channel attention layer, in which a layer fuses one feature similarity graph and two feature propagation graphs generated, in equation 7 of paper.
- Type:
nn.ModuleDict
- sgg_gen¶
Semantic subgraph generator(\(S_{r,m}^{MP}\)) dict, in equation 8 of paper.
- Type:
nn.ModuleDict
- sg_agg¶
The channel attention layer which fuses semantic subgraphs, in equation 9 of paper.
- Type:
nn.ModuleDict
- overall_g_agg¶
The channel attention layer which fuses the learned feature graph, semantic graph and the original graph.
- Type:
nn.ModuleDict
- encoder¶
The type-specific mapping layer in equation 1 of paper.
- Type:
nn.ModuleDict
备注
This model under the best config has some slight differences compared with the code given by the paper author, which seems having little impact on performance:
The regularization item in loss is on all parameters of the model, while in the author’s code, it is only on the generated adjacent matrix. If you want to implement the latter, a new task of OpenHGNN is needed.
The normalization of input adjacent matrix is separately on different adjacent matrices of different relations, while in the author’s code, it is on the entire adjacent matrix composed of adjacent matrices of all relations.