Skip to main content

Module temporal

Module temporal 

Source
Expand description

Temporal knowledge graphs: quads (head, relation, tail, timestamp).

Facts in an event KG (ICEWS-style) carry a discrete timestamp. This module loads quad datasets, defines the TemporalScorer trait (the temporal counterpart of Scorer, same lower-is-better energy convention), provides the TComplEx CPU scorer (Lacroix, Obozinski, Usunier, ICLR 2020: ComplEx with a complex timestamp embedding multiplied into the relation), and evaluates temporal link prediction in the time-aware filtered setting.

Training lives in burn_temporal (feature burn-ndarray or burn-wgpu); the CLI subcommand is tranz train-temporal.

Structs§

QuadIds
One interned quad: (head, relation, tail, time) as dense ids.
TComplEx
TComplEx (Lacroix et al., ICLR 2020): -Re(<h, r ∘ w_τ, conj(t)>).
TemporalDataset
An interned temporal dataset: vocabularies plus train/valid/test quads.
TemporalFilterIndex
Time-aware filter index: known tails of (h, r, τ) and known heads of (r, t, τ), over all splits.

Traits§

TemporalScorer
Trait for scoring temporal quads. Same convention as Scorer: lower values indicate more likely quads.

Functions§

evaluate_temporal_link_prediction
Evaluate temporal link prediction in the time-aware filtered setting.
load_temporal_dataset
Load a temporal dataset from a directory with train.txt, valid.txt, test.txt, each line head \t relation \t tail \t timestamp.