LCWAInstances

class LCWAInstances(*, pairs: ndarray, compressed: csr_matrix)[source]

Bases: Instances[tuple[Tensor, Tensor], tuple[Tensor, Tensor]]

Triples and mappings to their indices for LCWA.

Initialize the LCWA instances.

Parameters:
  • pairs (np.ndarray) – The unique pairs

  • compressed (scipy.sparse.csr_matrix) – The compressed triples in CSR format

Methods Summary

from_triples(mapped_triples, *, ...[, target])

Create LCWA instances from triples.

Methods Documentation

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

Create LCWA instances from triples.

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

  • num_entities (int) – The number of entities.

  • num_relations (int) – The number of relations.

  • target (int | None) – The column to predict

  • kwargs – Keyword arguments (thrown out)

Returns:

The instances.

Return type:

Instances