From 91653821de2b4fc6a9c41edba4cb06c28d580d2c Mon Sep 17 00:00:00 2001 From: yukew1998 Date: Thu, 19 Dec 2024 17:19:59 -0500 Subject: [PATCH] update formatting --- CHANGELOG.md | 2 +- torch_geometric/nn/kge/transf.py | 12 +++++++++--- 2 files changed, 10 insertions(+), 4 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 4ac770c9710f..eb4ef3f8326a 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -23,7 +23,7 @@ The format is based on [Keep a Changelog](http://keepachangelog.com/en/1.0.0/). - Added the `use_pcst` option to `WebQSPDataset` ([#9722](https://github.com/pyg-team/pytorch_geometric/pull/9722)) - Allowed users to pass `edge_weight` to `GraphUNet` models ([#9737](https://github.com/pyg-team/pytorch_geometric/pull/9737)) - Consolidated `examples/ogbn_{papers_100m,products_gat,products_sage}.py` into `examples/ogbn_train.py` ([#9467](https://github.com/pyg-team/pytorch_geometric/pull/9467)) -- Added the `TransF` KGE model ([#9858](https://github.com/pyg-team/pytorch_geometric/pull/9858)) +- Added the `TransF` KGE model ([#9880](https://github.com/pyg-team/pytorch_geometric/pull/9880)) ### Changed diff --git a/torch_geometric/nn/kge/transf.py b/torch_geometric/nn/kge/transf.py index 7daf67814c67..b9cd4b2f5861 100644 --- a/torch_geometric/nn/kge/transf.py +++ b/torch_geometric/nn/kge/transf.py @@ -14,17 +14,23 @@ class TransF(KGEModel): scaling the relation vector based on head and tail entity embeddings, resulting in: .. math:: - \mathbf{e}_h + f(\mathbf{e}_h, \mathbf{e}_t, \mathbf{e}_r) \cdot \mathbf{e}_r \approx \mathbf{e}_t + \mathbf{e}_h + f(\mathbf{e}_h, \mathbf{e}_t, \mathbf{e}_r) + .. math:: + \cdot \mathbf{e}_r \approx \mathbf{e}_t where :math:`f` is a dynamic scaling function: .. math:: - f(\mathbf{e}_h, \mathbf{e}_t, \mathbf{e}_r) = \sigma((\mathbf{e}_h \odot \mathbf{e}_t) \cdot \mathbf{e}_r) + f(\mathbf{e}_h, \mathbf{e}_t, \mathbf{e}_r) = + .. math:: + \sigma((\mathbf{e}_h \odot \mathbf{e}_t) \cdot \mathbf{e}_r) This results in the scoring function: .. math:: - d(h, r, t) = - \| \mathbf{e}_h + f(\mathbf{e}_h, \mathbf{e}_t, \mathbf{e}_r) \cdot \mathbf{e}_r - \mathbf{e}_t \|_p + d(h, r, t) = - \| \mathbf{e}_h + + .. math:: + f(\mathbf{e}_h, \mathbf{e}_t, \mathbf{e}_r) \cdot \mathbf{e}_r - \mathbf{e}_t \|_p .. note:: For an example of using the :class:`TransF` model, see