WikidataTextRepresentation

class WikidataTextRepresentation(identifiers, cache=None, **kwargs)[source]

Bases: CachedTextRepresentation

Textual representations for datasets grounded in Wikidata.

The label and description for each entity are obtained from Wikidata using pykeen.nn.utils.WikidataCache and encoded with TextRepresentation.

Example usage:

from pykeen.datasets import get_dataset
from pykeen.models import ERModel
from pykeen.nn import WikidataTextRepresentation
from pykeen.pipeline import pipeline

dataset = get_dataset(dataset="codexsmall")
entity_representations = WikidataTextRepresentation.from_dataset(dataset=dataset, encoder="transformer")
result = pipeline(
    dataset=dataset,
    model=ERModel,
    model_kwargs=dict(
        interaction="distmult",
        entity_representations=entity_representations,
        relation_representation_kwargs=dict(
            shape=entity_representations.shape,
        ),
    ),
)

Initialize the representation.

Parameters: