dicee.models.literal

Classes

LiteralEmbeddings

A model for learning and predicting numerical literals using pre-trained KGE.

Module Contents

class dicee.models.literal.LiteralEmbeddings(num_of_data_properties: int, embedding_dims: int, entity_embeddings: torch.tensor, dropout: float = 0.3, gate_residual=True, freeze_entity_embeddings=True)[source]

Bases: torch.nn.Module

A model for learning and predicting numerical literals using pre-trained KGE.

num_of_data_properties

Number of data properties (attributes).

Type:

int

embedding_dims

Dimension of the embeddings.

Type:

int

entity_embeddings

Pre-trained entity embeddings.

Type:

torch.tensor

dropout

Dropout rate for regularization.

Type:

float

gate_residual

Whether to use gated residual connections.

Type:

bool

freeze_entity_embeddings

Whether to freeze the entity embeddings during training.

Type:

bool

embedding_dim
num_of_data_properties
hidden_dim
gate_residual = True
freeze_entity_embeddings = True
entity_embeddings
data_property_embeddings
fc
fc_out
dropout
gated_residual_proj
layer_norm
forward(entity_idx, attr_idx)[source]
Parameters:
  • entity_idx (Tensor) – Entity indices (batch).

  • attr_idx (Tensor) – Attribute (Data property) indices (batch).

Returns:

scalar predictions.

Return type:

Tensor

property device