Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Missing soft constraints in TransH #237

Open
thsno02 opened this issue May 5, 2022 · 1 comment
Open

Missing soft constraints in TransH #237

thsno02 opened this issue May 5, 2022 · 1 comment
Labels
enhancement New feature or request

Comments

@thsno02
Copy link

thsno02 commented May 5, 2022

In the original paper, the author proposed three soft constraints and added a hyperparameter C to weight the importance of these constraints. While referring to the

class MarginLoss(Module):
, I did not find the C term.

I found a similar issue in OpenKE Weight C in TransH missing , is this the same reason ttorchkge ignores C though torchkge uses a different normalization method from OpenKE?

@armand33
Copy link
Member

Hi @thsno02, TorchKGE does not implement the soft constraint normalization proposed in the original article yet. Instead, the hard constraints can be enforced using the following :

  • constraint 2 (orthogonal) : the project static method can be used to project relation embedding vectors on relation-specific hyperplanes
  • constraints 1 and 3 (scale and unit normal vector) : the normalize_parameters method brings entity embeddings and normal vectors back to norm 1. This is indeed too strong a constraint as the scale of entity embeddings should be allowed to get very small.

I'll leave the issue open until someone contributes to add a soft constraint module. Feel free to do so.

@armand33 armand33 added the enhancement New feature or request label May 10, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

2 participants