Constants

Constants for PyKEEN.

PYKEEN_BENCHMARKS: Path = PosixPath('/home/docs/.data/pykeen/benchmarks')

A subdirectory of the PyKEEN data folder for benchmarks, defaults to ~/.data/pykeen/benchmarks

PYKEEN_CHECKPOINTS: Path = PosixPath('/home/docs/.data/pykeen/checkpoints')

A subdirectory of the PyKEEN data folder for checkpoints, defaults to ~/.data/pykeen/checkpoints

PYKEEN_DATASETS: Path = PosixPath('/home/docs/.data/pykeen/datasets')

A subdirectory of the PyKEEN data folder for datasets, defaults to ~/.data/pykeen/datasets

PYKEEN_EXPERIMENTS: Path = PosixPath('/home/docs/.data/pykeen/experiments')

A subdirectory of the PyKEEN data folder for experiments, defaults to ~/.data/pykeen/experiments

PYKEEN_HOME: Path = PosixPath('/home/docs/.data/pykeen')

A path representing the PyKEEN data folder

PYKEEN_LOGS: Path = PosixPath('/home/docs/.data/pykeen/logs')

A subdirectory for PyKEEN logs

Type hints for PyKEEN.

Constrainer

A function that can be applied to a tensor to constrain it

alias of Callable[[Tensor], Tensor]

DeviceHint

A hint for a torch.device

alias of str | device | None

class GaussianDistribution(mean: FloatTensor, diagonal_covariance: FloatTensor)[source]

A gaussian distribution with diagonal covariance matrix.

Create new instance of GaussianDistribution(mean, diagonal_covariance)

Parameters:
diagonal_covariance: Tensor

Alias for field number 1

mean: Tensor

Alias for field number 0

class HeadRepresentation

A type variable for head representations used in pykeen.models.Model, pykeen.nn.modules.Interaction, etc.

alias of TypeVar(‘HeadRepresentation’, bound=Tensor | Sequence[Tensor])

InductiveMode

the inductive prediction and training mode

alias of Literal[‘training’, ‘validation’, ‘testing’]

Initializer

A function that can be applied to a tensor to initialize it

alias of Callable[[Tensor], Tensor]

LabeledTriples

alias of ndarray

Mutation

A function that mutates the input and returns a new object of the same type as output

alias of Callable[[X], X]

Normalizer

A function that can be applied to a tensor to normalize it

alias of Callable[[Tensor], Tensor]

class RelationRepresentation

A type variable for relation representations used in pykeen.models.Model, pykeen.nn.modules.Interaction, etc.

alias of TypeVar(‘RelationRepresentation’, bound=Tensor | Sequence[Tensor])

class TailRepresentation

A type variable for tail representations used in pykeen.models.Model, pykeen.nn.modules.Interaction, etc.

alias of TypeVar(‘TailRepresentation’, bound=Tensor | Sequence[Tensor])

Target

the prediction target

alias of Literal[‘head’, ‘relation’, ‘tail’]

TargetColumn

the prediction target index

alias of Literal[0, 1, 2]

TorchRandomHint = None | int | torch._C.Generator

A hint for a torch.Generator

cast_constrainer(f) Callable[[Tensor], Tensor][source]

Cast a constrainer function with typing.cast().

Return type:

Callable[[Tensor], Tensor]

normalize_rank_type(rank: str | None) Literal['optimistic', 'realistic', 'pessimistic'][source]

Normalize a rank type.

Parameters:

rank (str | None)

Return type:

Literal[‘optimistic’, ‘realistic’, ‘pessimistic’]

normalize_target(target: str | None) Literal['head', 'relation', 'tail', 'both'][source]

Normalize a prediction target side.

Parameters:

target (str | None)

Return type:

Literal[‘head’, ‘relation’, ‘tail’, ‘both’]