mnick / scikit-kge

Python library to compute knowledge graph embeddings
MIT License
473 stars 142 forks source link

Problem with the documentation in README? #1

Open gabrielStanovsky opened 8 years ago

gabrielStanovsky commented 8 years ago

@mnick Hi, thanks for publishing your code!

The example in the README says that the input for trainer should be composed of "xs = list of (subject, object, predicte) triples".

But when digging into the implementation, it seems that this is not correlated with what the HolE model is expecting to see in the data:

ss, ps, os, ys = unzip_triples(xys, with_ys=True)

and then:

return np.sum(self.R[ps] * ccorr(self.E[ss], self.E[os]), axis=1)

see here

This seems to indicate that the HolE model (and I think that also TransE) expects the triples to be ordered by (subject, predicate, object), i.e, switched order of predicate and object compared with the readme, right?

Thanks!

gabrielStanovsky commented 8 years ago

Oh, I just went one level deeper and discovered that unzip_triples in fact reverses the order :) Is that the case? If so, you can see this issue as resolved. Thanks!

svjan5 commented 7 years ago

You are right, the order is really confusing in the code.