Giter Site home page Giter Site logo

tlogicpp's Introduction

TLogic++

All credits to Liu et al. for the original TLogic implementation. Our contributions: Adding a time relaxation parameter (can be found in globals.py) Adding this parameter to modify definitions of graph temporal random walk, body support, and rule support (confidence measure).

h3> How to run

Run poetry install to install the dependencies from poetry.lock. For more information about Poetry, a tool for dependency management and packaging in Python, see https://python-poetry.org/docs/.

The commands for running TLogic++ and recreating the results from the paper can be found in run.txt.

Datasets

Each event in the temporal knowledge graph is written in the format subject predicate object timestamp, with tabs as separators. The dataset is split into train.txt, valid.txt, and test.txt, where we use the same split as provided by Han et al. The files entity2id.json, relation2id.json, ts2id.json define the mapping of entities, relations, and timestamps to their corresponding IDs, respectively. The file statistics.yaml summarizes the statistics of the dataset and is not needed for running the code.

Parameters

In learn.py:

--dataset, -d: str. Dataset name.

--rule_lengths, -l: int. Length(s) of rules that will be learned, e.g., 2, 1 2 3.

--num_walks, -n: int. Number of walks that will be extracted during rule learning.

--transition_distr: str. Transition distribution; either unif for uniform distribution or exp for exponentially weighted distribution.

--num_processes, -p: int. Number of processes to be run in parallel.

--seed, -s: int. Random seed for reproducibility.

In apply.py:

--dataset, -d: str. Dataset name.

--test_data: str. Data for rule application; either test for test set or any other string for validation set.

--rules, -r: str. Name of the rules file.

--rule_lengths, -l: int. Length(s) of rules that will be applied, e.g., 2, 1 2 3.

--window, -w: int. Size of the time window before the query timestamp for rule application.

--top_k: int. Minimum number of candidates. The rule application stops for a query if this number is reached.

--num_processes, -p: int. Number of processes to be run in parallel.

In evaluate.py:

--dataset, -d: str. Dataset name.

--test_data: str. Data for rule application; either test for test set or any other string for validation set.

--candidates, -c: str. Name of the candidates file.

tlogicpp's People

Contributors

liu-yushan avatar dependabot[bot] avatar ab1nash avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.