plot_er
- plot_er(pipeline_result, *, model: str | None = None, entities: set[str] | None = None, relations: set[str] | None = None, apply_limits: bool = True, margin: float = 0.4, plot_entities: bool = True, plot_relations: bool | None = None, annotation_x_offset: float = 0.02, annotation_y_offset: float = 0.03, entity_embedding_getter=None, relation_embedding_getter=None, ax=None, subtitle: str | None = None, **kwargs)[source]
Plot the reduced entities and relation vectors in 2D.
- Parameters:
pipeline_result – The result returned by
pykeen.pipeline.pipeline()
.model (str | None) – The dimensionality reduction model from
sklearn
. Defaults to PCA. Can also use KPCA, GRP, SRP, TSNE, LLE, ISOMAP, MDS, or SE.apply_limits (bool) – Should the x and y limits be applied?
margin (float) – The margin size around the minimum/maximum x and y values
plot_entities (bool) – If true, plot the entities based on their reduced embeddings
plot_relations (bool | None) – By default, this is only enabled on translational distance models like
pykeen.models.TransE
.annotation_x_offset (float) – X offset of label from entity position
annotation_y_offset (float) – Y offset of label from entity position
entity_embedding_getter – A function that takes a model and returns its entity embeddings. If none, defaults to
_default_entity_embedding_getter()
, which just getsmodel.entity_embeddings
. Note, the default only works with old-style PyKEEN models.relation_embedding_getter – A function that takes a model and returns its relation embeddings. If none, defaults to
_default_relation_embedding_getter()
, which just getsmodel.relation_embeddings
. Note, the default only works with old-style PyKEEN models.ax – The matplotlib axis, if pre-defined
subtitle (str | None) – A user-defined subtitle. Is inferred if not given. Pass an empty string to not use a subtitle.
kwargs – The keyword arguments passed to __init__() of the reducer class (e.g., PCA, TSNE)
- Returns:
The axis
- Raises:
ValueError – if entity plotting and relation plotting are both turned off
Warning
Plotting relations and entities on the same plot is only meaningful for translational distance models like TransE.