You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
scikit-kge is a Python library to compute embeddings of knowledge graphs. The
library consists of different building blocks to train and develop models for
knowledge graph embeddings.
To compute a knowledge graph embedding, first instantiate a model and then train it
with desired training method. For instance, to train holographic embeddings of knowledge graphs (HolE) with a logistcc loss function:
fromskgeimportHolE, 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 100model=HolE((N, N, M), 100)
# instantiate trainertrainer=StochasticTrainer(model)
# fit model to knowledge graphtrainer.fit(xs, ys)
scitkit-kge supports different methods to update the parameters of a model via
the param_update keyword of StochasticTrainer and PairwiseStochasticTrainer.