openhgnn.layers.MetapathConv

class MetapathConv(meta_paths_dict, mods, macro_func, **kargs)[source]

MetapathConv is an aggregation function based on meta-path, which is similar with dgl.nn.pytorch.HeteroGraphConv. We could choose Attention/ APPNP or any GraphConvLayer to aggregate node features. After that we will get embeddings based on different meta-paths and fusion them.

\[\mathbf{Z}=\mathcal{F}(Z^{\Phi_1},Z^{\Phi_2},...,Z^{\Phi_p})=\mathcal{F}(f(H,\Phi_1),f(H,\Phi_2),...,f(H,\Phi_p))\]

where \(\mathcal{F}\) denotes semantic fusion function, such as semantic-attention. \(\Phi_i\) denotes meta-path and \(f\) denotes the aggregation function, such as GAT, APPNP.

Parameters:
  • meta_paths_dict (dict[str, list[tuple(meta-path)]]) – contain multiple meta-paths.

  • mods (nn.ModuleDict) – aggregation function

  • macro_func (callable aggregation func) – A semantic aggregation way, e.g. ‘mean’, ‘max’, ‘sum’ or ‘attention’