plot_er
- plot_er(pipeline_result, *, model=None, entities=None, relations=None, apply_limits=True, margin=0.4, plot_entities=True, plot_relations=None, annotation_x_offset=0.02, annotation_y_offset=0.03, entity_embedding_getter=None, relation_embedding_getter=None, ax=None, subtitle=None, **kwargs)[source]
Plot the reduced entities and relation vectors in 2D.
- Parameters:
pipeline_result – The result returned by
pykeen.pipeline.pipeline().model (
Optional[str]) – The dimensionality reduction model fromsklearn. Defaults to PCA. Can also use KPCA, GRP, SRP, TSNE, LLE, ISOMAP, MDS, or SE.entities (
Optional[Set[str]]) – A subset of entities to plotrelations (
Optional[Set[str]]) – A subset of relations to plotapply_limits (
bool) – Should the x and y limits be applied?margin (
float) – The margin size around the minimum/maximum x and y valuesplot_entities (
bool) – If true, plot the entities based on their reduced embeddingsplot_relations (
Optional[bool]) – By default, this is only enabled on translational distance models likepykeen.models.TransE.annotation_x_offset (
float) – X offset of label from entity positionannotation_y_offset (
float) – Y offset of label from entity positionentity_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 (
Optional[str]) – 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.