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

Numerical Literal Prediction #260

Open
Demirrr opened this issue Oct 10, 2024 · 0 comments
Open

Numerical Literal Prediction #260

Demirrr opened this issue Oct 10, 2024 · 0 comments
Assignees
Labels
enhancement New feature or request

Comments

@Demirrr
Copy link
Member

Demirrr commented Oct 10, 2024

Interface

from dicee import KGE
# (1) Upload a trained KGE model.
pre_trained_kge = KGE(path='..')
# (2) Train a KGE model on numerical literals
pre_trained_kge.train_literal(path="")
def train_literal(path=""):
      # (3) Read a knowledge graph where all tails are numerical literals
      # (4) For each unique relation (e.g. dataproperty), we introduce a regression problem.
      # (5) Tackle each regression problem individually.
      # ....

Lets say we have a knowledge graph containing only data properties

A height 185
A age 35
B height 180
B age 19

A and B embeddings are learned at step (2). Let's assume A = [0.1, -1.5] and B = [0.9, -0.5]

Lets assume that the embeddings of data properties are defined as such height=[0.0, 0.0] and age=[0.0, 0.0]

yhat = sum( [0.1, -1.5] * [0.0, 0.0] )
y = 185
# compute loss w.r.t.
single_loss = pow( yhat - y, 2)

# Compute the gradient of the loss w.r.t. weights.

Ideally, we should be able to observe

print(pre_trained_kge.predict_literal(h="A", r="height")) # 180
print(pre_trained_kge.predict_literal(h="Demir", r="age")) # 35
@sapkotaruz11 sapkotaruz11 self-assigned this Oct 10, 2024
@Demirrr Demirrr added the enhancement New feature or request label Oct 10, 2024
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