mnick / scikit-kge Goto Github PK
View Code? Open in Web Editor NEWPython library to compute knowledge graph embeddings
License: MIT License
Python library to compute knowledge graph embeddings
License: MIT License
It would be nice to see a more detailed example.
The README says:
N, M, xs, ys = load_data('path to data')
But how exactly do these parameters look like? Something like:
N = 12
M = 20
xs = [(s1, o1, p1), (s2, o2, p2), ...]
ys = [1, -1, ...]
...with concrete examples would be nice
Dear @mnick ,
i really appriciate this package. However, it is somewhat difficult to fully wrap my head arround it.
It would help if you could:
Best regards
Chris
The sample code in README.md has typo. I figured it out after seeing IndexError.
from skge import HolE, StochasticTrainer
# Load knowledge graph
# N = number of entities
# M = number of relations
# xs = list of (subject, object, predicte) triples
# ys = list of truth values for triples (1 = true, -1 = false)
N, M, xs, ys = load_data('path to data')
# instantiate HolE with an embedding space of size 100
model = HolE((N, N, M), 100)
The order of (N, N, M)
must be (N, M, N)
.
model = HolE((N, M, N), 100)
When I run setup.py, it says "setuptools module not found."
@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)
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!
Here: https://github.com/mnick/scikit-kge/blob/master/skge/base.py#L130
self.batch_size = np.ceil(len(xys) / self.nbatches)
self.batch_size = int(np.ceil(len(xys) / self.nbatches))
In the latest stable version of numpy (1.13.0) np.ceil()
returns a float value not int.
Because of this error, my code was crashing with:
TypeError: slice indices must be integers or None or have an index method
Please make the change.
i can not find this package in the anaconda?if you have free time,please help me solve the issue!
How do you access the embedding vectors after the training of the model? The documentation is unclear on this matter.
A declarative, efficient, and flexible JavaScript library for building user interfaces.
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google ❤️ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.