Skip to content

Commit

Permalink
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
update formatting
Browse files Browse the repository at this point in the history
yukew1998 committed Dec 19, 2024

Verified

This commit was created on GitHub.com and signed with GitHub’s verified signature.
1 parent f610d00 commit 9165382
Showing 2 changed files with 10 additions and 4 deletions.
2 changes: 1 addition & 1 deletion CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -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

12 changes: 9 additions & 3 deletions torch_geometric/nn/kge/transf.py
Original file line number Diff line number Diff line change
@@ -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

0 comments on commit 9165382

Please sign in to comment.