besskge.scoring.BaseScoreFunction
- class besskge.scoring.BaseScoreFunction(*args, **kwargs)[source]
Base class for scoring functions.
Initializes internal Module state, shared by both nn.Module and ScriptModule.
- abstract score_heads(head_emb, relation_id, tail_emb)[source]
Score sets of head entities against fixed (r,t) queries.
- Parameters:
- Return type:
- Returns:
shape: (batch_size, B * n_heads) if
BaseScoreFunction.negative_sample_sharing
else (batch_size, n_heads). Scores of broadcasted triples.
- abstract score_tails(head_emb, relation_id, tail_emb)[source]
Score sets of tail entities against fixed (h,r) queries.
- Parameters:
- Return type:
- Returns:
shape: (batch_size, B * n_tails) if
BaseScoreFunction.negative_sample_sharing
else (batch_size, n_tails) Scores of broadcasted triples.