Semantically Enriched Link Prediction Datasets DB100k+, Yago3-10+ and NELL-995+
收藏资源简介:
Introduction This repository contains: The datasets DB100k+, Yago3-10+ and NELL-995+ which are the enrichments of the standard datasets DB100k, Yago3-10 and NELL-995 with entity types infered from class hierarchies and property domains and ranges The notebooks that generated these datasets A masking algorithm allowing to create variants of these datasets with target proportion of the predicates domain/range information An example of such dataset with a version of NELL-995 with 10% of triples with fully signed predicates (domain and range), 30% of triples with predicates with only the domain declared (no range), 10% of triples with predicates with only the range declared (no domain) and 50% of triples with unsigned predicates (no domain and no range). This repository has been published under the LGPL-2.1 license This repository is affiliated to the WIMMICS research team, check the other WIMMICS projects. How to use Datasets Each of the datasets DB100k+, YAGO3-10+, NELL995+ and NELL995+_10_30_10 contain the following files: A notebook for the creation of the enriched dataset, using the URL of the original dataset for downloading it A notebook for dataset analysis that provides key information about the dataset The dataset files themselves The dataset splits train2id.txt, test2id.txt and valid2id.txt The dataset splits variants including the explicit modelling of inverse relations train2id_inv.txt, test2id_inv.txt and valid2id_inv.txt A Sankey diagram that decomposes the dataset triples given their semantic information a pickle/ folder containing different pickle dictionnaries ent2id translating each entity to its related id (int) rel2id translating each relation to its related id (int) class2id translating each class to its related id (int) instype_all linking ids of entities to their types (including those that were got from subsumption axiom closure in any dataset, and domain/range in YAGO3-10+ and NELL-995+) class2id2ent2id linking ids of classes to the ids of their instances (including those that were infered from subsumption axiom closure in any dataset, and domain/range in YAGO3-10+ and NELL-995+) r2id2dom2id linking predicates ids to their related domain class id r2id2range2id linking predicates ids to their related range class id observed_tails_original_kg contains a head/relation/tail index of the dataset in the form of nested dictionaries using ids of entities and relations observed_heads_original_kg contains a tail/relation/head index of the dataset in the form of nested dictionaries using ids of entities and relations observed_tails_inv is an equivalent of observed_tails_original_kg that also contains explicit modelling of inverse relations observed_heads_inv is an equivalent of observed_heads_original_kg that also contains explicit modelling of inverse relations Masking script The script has the following usage: python /path/to/dataset-mask.py /path/to/dataset-folder dataset_name full_signed_proportion domain_only_signed_proportion range_only_signed_proportion where: /path/to/dataset-folder is the path to the folder containing the datasets. If the command is launched in the repository root it's simply . dataset_name is the name of the folder of the dataset to mask. In the example below, it is NELL995+ full_signed_proportion is an int that is the desired percentage of triples with predicates having known domain and range (in train, test and valid splits) domain_only_signed_proportion is an int that is the desired percentage of triples with predicates having known domain but no range (in train, test and valid splits) range_only_signed_proportion is an int that is the desired percentage of triples with predicates having known range but no domain (in train, test and valid splits) The resulting dataset is saved in the dataset folder, in a proper subfolder. For example, launching the following command in the repository root: python dataset-mask.py . NELL995+ 10 30 10 generates the dataset that is in folder NELL995+_10_30_10 Key stats DB100k+ Split # Fully signed triples # Domain-only triples # Range-only triples # Unsigned triples Total Train 196,877 41,267 297,209 62,219 149678 Test 16,437 3,426 24,909 5,228 50,000 Valid 16,517 3,527 24,827 5,129 50,000 Total 229,831 48,220 346,945 72,576 697,572 NELL-995+ Split # Fully signed triples # Domain-only triples # Range-only triples # Unsigned triples Total Train 109,800 0 0 39,878 149,678 Test 3,992 0 0 0 3,992 Valid 543 0 0 0 543 Total 114,335 0 0 39,878 154,213 YAGO3-10+ Split # Fully signed triples # Domain-only triples # Range-only triples # Unsigned triples Total Train 1,057,339 21,701 0 0 1,079,040 Test 4,886 114 0 0 5,000 Valid 4,912 88 0 0 5,000 Total 1,067,137 21,903 0 0 1,089,040
# 概述 本仓库包含以下内容: 1. 三类增强版基准数据集:DB100k+、Yago3-10+与NELL-995+,它们是在标准数据集DB100k、Yago3-10和NELL-995的基础上,补充了从类层级结构以及属性定义域与值域推导得到的实体类型信息; 2. 用于生成上述增强数据集的配套脚本笔记本; 3. 一款掩码算法,可基于指定的谓词定义域/值域信息占比,生成该类数据集的变体版本; 4. 一个示例数据集:即NELL-995的变体版本,其中10%的三元组对应完全标注的谓词(同时包含定义域与值域)、30%的三元组对应仅标注定义域的谓词(未标注值域)、10%的三元组对应仅标注值域的谓词(未标注定义域),剩余50%的三元组对应未标注任何定义域值域信息的谓词。 本仓库采用LGPL-2.1开源许可协议发布,隶属于WIMMICS研究团队,可查看该团队的其他相关项目。 # 使用说明 ## 数据集结构 DB100k+、YAGO3-10+、NELL995+以及NELL995+_10_30_10这四个数据集均包含以下文件: 1. 用于构建增强数据集的脚本笔记本,支持通过原始数据集的URL完成下载; 2. 用于数据集分析的脚本笔记本,可输出该数据集的关键统计信息; 3. 数据集本体文件,具体包括: - 基础数据集划分文件:`train2id.txt`、`test2id.txt`与`valid2id.txt`; - 包含显式逆关系建模的数据集划分变体文件:`train2id_inv.txt`、`test2id_inv.txt`与`valid2id_inv.txt`; - 用于分解数据集三元组语义信息的桑基(Sankey)图; - 一个`pickle/`文件夹,内含多种pickle格式的字典: - `ent2id`:实体到其对应整数ID的映射字典; - `rel2id`:关系到其对应整数ID的映射字典; - `class2id`:类到其对应整数ID的映射字典; - `instype_all`:实体ID到其所属类型的映射字典,涵盖所有数据集通过包含性公理闭包推导得到的类型,以及YAGO3-10+与NELL-995+中基于属性定义域/值域得到的类型; - `class2id2ent2id`:类ID到其对应实例ID的映射字典,涵盖所有数据集通过包含性公理闭包推导得到的实例,以及YAGO3-10+与NELL-995+中基于属性定义域/值域得到的实例; - `r2id2dom2id`:谓词ID到其对应定义域类ID的映射字典; - `r2id2range2id`:谓词ID到其对应值域类ID的映射字典; - `observed_tails_original_kg`:以嵌套字典形式存储的原知识图谱头实体-关系-尾实体索引,采用实体与关系的ID表示; - `observed_heads_original_kg`:以嵌套字典形式存储的原知识图谱尾实体-关系-头实体索引,采用实体与关系的ID表示; - `observed_tails_inv`:与`observed_tails_original_kg`等价的索引,但额外包含显式建模的逆关系; - `observed_heads_inv`:与`observed_heads_original_kg`等价的索引,但额外包含显式建模的逆关系。 ## 掩码脚本使用说明 该脚本的调用格式如下: bash python /path/to/dataset-mask.py /path/to/dataset-folder dataset_name full_signed_proportion domain_only_signed_proportion range_only_signed_proportion 其中各参数含义如下: 1. `/path/to/dataset-folder`:数据集所在文件夹的路径。若在仓库根目录下运行该命令,可直接简写为`.`; 2. `dataset_name`:待掩码的数据集文件夹名称,示例中为`NELL995+`; 3. `full_signed_proportion`:整数类型参数,指定训练集、测试集与验证集中,对应完全标注定义域与值域的谓词的三元组占比; 4. `domain_only_signed_proportion`:整数类型参数,指定训练集、测试集与验证集中,对应仅标注定义域(未标注值域)的谓词的三元组占比; 5. `range_only_signed_proportion`:整数类型参数,指定训练集、测试集与验证集中,对应仅标注值域(未标注定义域)的谓词的三元组占比。 生成的数据集将保存至原数据集文件夹下的指定子文件夹中。例如,在仓库根目录下执行以下命令: bash python dataset-mask.py . NELL995+ 10 30 10 即可生成存储于`NELL995+_10_30_10`文件夹中的示例数据集。 ## 关键统计数据 ### DB100k+ | 数据集划分 | 完全标注三元组数量 | 仅标注定义域三元组数量 | 仅标注值域三元组数量 | 未标注三元组数量 | 总三元组数量 | | :---: | :---: | :---: | :---: | :---: | :---: | | 训练集 | 196,877 | 41,267 | 297,209 | 62,219 | 149,678 | | 测试集 | 16,437 | 3,426 | 24,909 | 5,228 | 50,000 | | 验证集 | 16,517 | 3,527 | 24,827 | 5,129 | 50,000 | | 总计 | 229,831 | 48,220 | 346,945 | 72,576 | 697,572 | ### NELL-995+ | 数据集划分 | 完全标注三元组数量 | 仅标注定义域三元组数量 | 仅标注值域三元组数量 | 未标注三元组数量 | 总三元组数量 | | :---: | :---: | :---: | :---: | :---: | :---: | | 训练集 | 109,800 | 0 | 0 | 39,878 | 149,678 | | 测试集 | 3,992 | 0 | 0 | 0 | 3,992 | | 验证集 | 543 | 0 | 0 | 0 | 543 | | 总计 | 114,335 | 0 | 0 | 39,878 | 154,213 | ### YAGO3-10+ | 数据集划分 | 完全标注三元组数量 | 仅标注定义域三元组数量 | 仅标注值域三元组数量 | 未标注三元组数量 | 总三元组数量 | | :---: | :---: | :---: | :---: | :---: | :---: | | 训练集 | 1,057,339 | 21,701 | 0 | 0 | 1,079,040 | | 测试集 | 4,886 | 114 | 0 | 0 | 5,000 | | 验证集 | 4,912 | 88 | 0 | 0 | 5,000 | | 总计 | 1,067,137 | 21,903 | 0 | 0 | 1,089,040 |



