karmaresearch / trident

Apache License 2.0
21 stars 10 forks source link

code to calculate displacement factor for every test case in predict option #1

Open unmeshvrije opened 6 years ago

unmeshvrije commented 6 years ago

when we use trident with ./trident predict -i location/of/trident/db --algo transe, For every test case (i.e. for every triple <s,p,o>, we find out

  1. all possible objects for given s and p
  2. all possible subjects for given p and o

1.1 for all objects, say we find N objects o1, o2, o3,... oN 1.2 For each object, we find its position based on transe embeddings (p1, p2, ...pN) 1.3 Then we compute avg(p1-N, p2-N,..., PN - N)

2.1 for all subjects, say we find N subjects s1, s2,... oN 2.2 For each subject, we find its position based on transe embeddings (p1, p2, ...pN) 2.3 Then we compute avg(p1-N, p2-N,..., PN - N)