Instances

class Instances[source]

Bases: Dataset[BatchType], Generic[SampleType, BatchType], ABC

Base class for training instances.

Methods Summary

from_triples(mapped_triples, *, ...)

Create instances from mapped triples.

get_collator()

Get a collator.

Methods Documentation

classmethod from_triples(mapped_triples: Tensor, *, num_entities: int, num_relations: int, **kwargs) Instances[source]

Create instances from mapped triples.

Parameters:
  • mapped_triples (Tensor) – shape: (num_triples, 3) The ID-based triples.

  • num_entities (int) – >0 The number of entities.

  • num_relations (int) – >0 The number of relations.

  • kwargs – additional keyword-based parameters.

Returns:

The instances.

Return type:

Instances

# noqa:DAR202 # noqa:DAR401

get_collator() Callable[[list[SampleType]], BatchType] | None[source]

Get a collator.

Return type:

Callable[[list[SampleType]], BatchType] | None