ChronoKGE

June 10, 2022 ยท View on GitHub

ChronoKGE is a knowledge graph embedding framework to ease time-focused research in representation learning.

alt text


Requirements

Python 3.6+ https://www.python.org/downloads/

PyTorch 1.8+ https://pytorch.org/get-started/locally/

Optuna 2.9+ https://optuna.readthedocs.io/en/latest/installation.html

Selenium 3.14+ https://selenium-python.readthedocs.io/installation.html


Installation

Install dependencies

pip3 install -r requirements.txt

Usage

Run

run Executes the experiment with the given parameters.

Via Command Line:
python3 -m chrono_kge [<model-args>] run [<run-args>]

For more details, see model arguments and run arguments.

Via YAML Config:
python3 -m chrono_kge -mc <main_config> run -rc <run_config>

Tune

tune Performs parameter tuning with the provided amount of trials.

Via Command Line:
python3 -m chrono_kge [<model-args>] tune [<tune-args>]

For more details, see model arguments and tune arguments.

Via YAML Config:
python3 -m chrono_kge -mc <main_config> tune -tc <tune_config>

Examples

Example 1

Run with default parameters model=lowfer-tnt, kg=icews14, dim=300, lr=0.01 using YAML.

python3 -m chrono_kge -mc "config/main/default.yaml" run -rc "config/run/default.yaml"

Example 2

Run with default parameters model=lowfer-tnt, kg=icews14, dim=300, lr=0.01 using CMD.

python3 -m chrono_kge -m "t-lowfer" -d "icews14" -am 1 -mm 1 run -lr 0.01 -ed 300

Optional arguments

1. Model arguments

-m MODEL, --model MODEL
Learning model.
Supported models: lowfer, tlowfer.
Default tlowfer.

-d DATASET, --dataset DATASET
Which dataset to use.
Supported datasets: see knowledge graphs below.
Default icews14.

-e EPOCHS, --epochs EPOCHS
Number of total epochs.
Default 1000.

-am AUGMENT_MODE, --aug_mode AUGMENT_MODE
The mode of augmentation.
Supported methods: see augmentation modes below.
Default 0.

-rm REG_MODE, --reg_mode REG_MODE
The mode of regularization.
Supported methods: see regularization modes below.
Default 0.

-mm MODULATION_MODE, --mod_mode MODULATION_MODE
Modulation mode.
Supported modulations: see modulation modes below.
Default 0.

-em ENC_MODE, --enc_mode ENC_MODE
Supported methods: see encoding modes below.
Default 0.

-c, --cuda
Whether to use cuda (GPU) or not (CPU).
Default CPU.

--save
Whether to save results.
Default False.


Augmentation modes

0: None
1: Reverse triples
2: Back translation (pre)
3: Back translation (ad-hoc)
4: Reverse triples + Back translation (pre)


2: Augmentation using precomputed translations.

3: Ad-hoc back translation using free Google Translate service.
High confidence, max. 2 translations, language order ch-zn, es, de, en.
Supported KB: ICEWS14, ICEWS05-15, ICEWS18


Regularization modes

0: None
1: Omega (embedding regularization)
2: Lambda (time regularisation)
3: Omega + Lambda

* Tensor norms: Omega: p=3, Lambda: p=4


Modulation modes

1. Time Modulation (T)

Extends LowFER with dynamic relations.
mode=0

2. Time-no-Time Modulation (TNT)

Extends LowFER with dynamic and static relations.
mode=1


Benchmark results

Results for semantic matching models on ICEWS14 and ICEWS05-15.

ICEWS14

MethodMRRH@10H@3H@1
DE-DistMult0.5010.7080.5690.392
DE-SimplE0.5260.7250.5920.418
TComplEx0.5600.7300.6100.470
TNTComplEx0.5600.7400.6100.460
TuckERT0.5940.7310.6400.518
TuckERTNT0.6040.7530.6550.521
LowFER-T0.5840.7340.6300.505
LowFER-TNT0.5860.7350.6320.507
LowFER-CFB0.6230.7570.6710.549
LowFER-FTP0.6170.7650.6650.537

ICEWS05-15

MethodMRRH@10H@3H@1
DE-DistMult0.4840.7180.5460.366
DE-SimplE0.5130.7480.5780.392
TComplEx0.5800.7600.6400.490
TNTComplEx0.6000.7800.6500.500
TuckERT0.6270.7690.6740.550
TuckERTNT0.6380.7830.6860.559
LowFER-T0.5590.7140.6050.476
LowFER-TNT0.5620.7170.6080.480
LowFER-CFB0.6380.7910.6900.555
LowFER-FTP0.6250.7920.6810.534

Additional benchmarks

For an exhaustive summary of related benchmark results, visit TKGC Benchmark Results.

Citation

If you find our work useful, please consider citing.

@inproceedings{dikeoulias-etal-2022-temporal,
    title = "Temporal Knowledge Graph Reasoning with Low-rank and Model-agnostic Representations",
    author = {Dikeoulias, Ioannis  and
      Amin, Saadullah  and
      Neumann, G{\"u}nter},
    booktitle = "Proceedings of the 7th Workshop on Representation Learning for NLP",
    month = may,
    year = "2022",
    address = "Dublin, Ireland",
    publisher = "Association for Computational Linguistics",
    url = "https://aclanthology.org/2022.repl4nlp-1.12",
    doi = "10.18653/v1/2022.repl4nlp-1.12",
    pages = "111--120",
}