openhgnn.models.KGCN

class KGCN(g, args)[source]

This module KGCN was introduced in KGCN.

It included two parts:

Aggregate the entity representation and its neighborhood representation into the entity’s embedding. The message function is defined as follow:

\(\mathrm{v}_{\mathcal{N}(v)}^{u}=\sum_{e \in \mathcal{N}(v)} \tilde{\pi}_{r_{v, e}}^{u} \mathrm{e}\)

where \(\mathrm{e}\) is the representation of entity, \(\tilde{\pi}_{r_{v, e}}^{u}\) is the scalar weight on the edge from entity to entity, the result \(\mathrm{v}_{\mathcal{N}(v)}^{u}\) saves message which is passed from neighbor nodes

There are three types of aggregators. Sum aggregator takes the summation of two representation vectors, Concat aggregator concatenates the two representation vectors and Neighbor aggregator directly takes the neighborhood representation of entity as the output representation

\(a g g_{s u m}=\sigma\left(\mathbf{W} \cdot\left(\mathrm{v}+\mathrm{v}_{\mathcal{S}(v)}^{u}\right)+\mathbf{b}\right)\)

\(agg $_{\text {concat }}=\sigma\left(\mathbf{W} \cdot \text{concat}\left(\mathrm{v}, \mathrm{v}_{\mathcal{S}(v)}^{u}\right)+\mathbf{b}\right)$\)

\(\text { agg }_{\text {neighbor }}=\sigma\left(\mathrm{W} \cdot \mathrm{v}_{\mathcal{S}(v)}^{u}+\mathrm{b}\right)\)

In the above equations, \(\sigma\) is the nonlinear function and \(\mathrm{W}\) and \(\mathrm{b}\) are transformation weight and bias. the representation of an item is bound up with its neighbors by aggregation

Obtain scores using final entity representation and user representation The final entity representation is denoted as \(\mathrm{v}^{u}\), \(\mathrm{v}^{u}\) do dot product with user representation \(\mathrm{u}\) can obtain the probability. The math formula for the above function is:

\($\hat{y}_{u v}=f\left(\mathbf{u}, \mathrm{v}^{u}\right)$\)

Parameters:
  • g (DGLGraph) – A knowledge Graph preserves relationships between entities

  • args (Config) – Model’s config