第一次用到知识图谱,就从KingDom代码出发好好学习一下叭~
到达train阶段时,图特征已提取完毕,并形成.np文件。现阶段以这些.np文件为基础构建跨域的知识库。
获取路径
source_path = get_dataset_path(source_name, 'small')
target_path1 = get_dataset_path(target_name, 'small')
target_path2 = get_dataset_path(target_name, 'test')
🔴构建词典(一个word与int id之间的映射)
字典学习 :为普通稠密表达的样本找到合适的字典,将样本转化为合适的稀疏表达形式 从而使学习任务得以简化,模型复杂度得以降低 通常称为‘字典学习’(dictionary learning),亦称‘稀疏编码’(sparse coding) 22.4.5更
引用类:Dictionary (from gensim.corpora import Dictionary)
重要函数:
1. def add_documents(self, documents, prune_at=2000000) </