This setup documentation serves as an introduction for extending and maintaining the ChronoKGE framework.
The chrono_kge module consists of the following folders:
main: The main modules.handler: Handler for framework state.manager: Managers for framework execution.parser: Parsers for framework parameter.
experiment: The experiment modules.knowledge: Modules related to data handling and preprocessing.augmentation: Augmentation modules.chrono: Time processing modules.graph: Knowledge graph modules.
model: The model modules.kge: Complete network models.deepml: KGE models using deep learning.geometric: KGE-models using distance scoring.semantic: KGE-models using similarity scoring.
module: Model modules and extensions.calculus: Basic tensor modules.embedding: Embedding modules.pooling: Bilinear pooling modules.regularizer: Regularization modules.scoring: Scoring modules.
statistics: The statistics modules.trainer: The trainer modules.tuner: The tuner modules.utils: Additional helper functionsvars: Constants and enumerations.web: Web utilities.
visualization: Visualization tools.
- Deep Learning (network):
model.kge.deepml - Geometric (distance):
model.kge.geometric - Semantic matching (similarity):
model.kge.semantic
In the following, we describe how to add a new embedding model.
- Add a new model into
model/kge/<family>(Learn more) by either:- creating a new model which inherits PyTorch's base
nn.Module - extending an existing model, e.g., inheriting from
kge_model.KGE_Model
- creating a new model which inherits PyTorch's base
- Register your model within the
model/__model__.pymodule- Add an entry into the
REGISTERdictionary, where:key: a unique string identifier used to call your modelvalue: the class type of your model
- Add an entry into the
- Done!
In the following, we describe how to add a new benchmark dataset.
- Save the new dataset under one of the following folders:
static: Datasets with static facts (s,p,o)temporal: Datasets with temporal facts (s,p,o,t)synthetic: Datasets which are synthetically created
- Register a new dataset in the
knowledge/knowledge_base.pymodule- Define a new
KnowledgeBasein theKnowledgeBasesobject- Specify the KB properties according to the dataset:
name: a unique string identifier (same name as data-folder)genre: the genre of the KB (static,temporal,synthetic)start_date: (optional) The start date of the KBnum_days: (optional) The number of days covered by the KBgran: (optional) The time granularity of the KB
- Specify the KB properties according to the dataset:
- Add the new KB enum into the
ALL_KBlist in theKnowledgeBasesobject - Register the new KB in the appropriate
function attributes:has_timestamps: KB contains time in form of timestampshas_indices: KB contains entity indices in datasetshas_labels: KB contains entity labels in datasets
- Define a new
- Done!