TestSampler¶
- class pybind11_ke.data.TestSampler(sampler: TradSampler | RGCNSampler | CompGCNSampler, valid_file: str = 'valid2id.txt', test_file: str = 'test2id.txt', type_constrain: bool = True)[源代码]¶
测试数据采样器基类。
- __init__(sampler: TradSampler | RGCNSampler | CompGCNSampler, valid_file: str = 'valid2id.txt', test_file: str = 'test2id.txt', type_constrain: bool = True)[源代码]¶
创建 TestSampler 对象。
- 参数:
sampler (Union[TradSampler, RGCNSampler, CompGCNSampler]) – 训练数据采样器。
valid_file (str) – valid2id.txt
test_file (str) – test2id.txt
type_constrain (bool) – 是否报告 type_constrain.txt 限制的测试结果
- __weakref__¶
list of weak references to the object (if defined)
- get_valid_test_triples_id()[源代码]¶
读取
valid_file文件和test_file文件。
- hr2t_all: defaultdict[set]¶
知识图谱中所有 h-r 对对应的 t 集合
- rel_heads: defaultdict[set]¶
知识图谱中所有 r 存在头实体种类
- rel_tails: defaultdict[set]¶
知识图谱中所有 r 存在尾实体种类
- rt2h_all: defaultdict[set]¶
知识图谱中所有 r-t 对对应的 h 集合
- sampler: TradSampler | RGCNSampler | CompGCNSampler¶
训练数据采样器