Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

你好,如何获得.ent_feature和.rel_feature #117

Open
zhaijianyang opened this issue Apr 5, 2023 · 1 comment
Open

你好,如何获得.ent_feature和.rel_feature #117

zhaijianyang opened this issue Apr 5, 2023 · 1 comment
Assignees
Labels
question Further information is requested

Comments

@zhaijianyang
Copy link

你好,如何获得.ent_feature和.rel_feature呢,GRU4RecKG需要这些文件,文件内容是什么格式呢?如何获取?

@Sherry-XLL Sherry-XLL self-assigned this Apr 8, 2023
@Sherry-XLL Sherry-XLL added the question Further information is requested label Apr 8, 2023
@Sherry-XLL
Copy link
Member

@zhaijianyang 您好,.ent_feature.rel_feature 是存储预训练知识图谱向量的文件,一般会采用 TransE 等方法得到知识图谱每个实体 entity 的向量表征 entity_embedding 以及关系 relation 的向量表征 relation_embedding,然后将每个实体/关系对应的表征导出并存储。

对于知识图谱特征文件的获取方式,可以根据自身需求并参考知识图谱表示的论文编写代码,通过训练得到对应的特征表示;也可以借用 graphviteLibKGEAmpliGraph 等开源库来生成结果。

对于这种额外的原子文件,可以通过文档中的 Additional Atomic Files 相关提示来导入:

Firstly, prepare your additional atomic file (e.g. ml-1m.ent).

ent_id:token ent_emb:float_seq
m.0gs6m -115.08 13.60 113.69
m.01b195 -130.97 263.05 -129.88

Secondly, update the args as:

.. code:: yaml

additional_feat_suffix: [ent]
load_col:
    # inter/user/item/...: As usual
    ent: [ent_id, ent_emb]

Then, this additional atomic file will be loaded into the :class:Dataset object. These new features can be used as following.

.. code:: python

dataset = create_dataset(config)
print(dataset.ent_feat)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
question Further information is requested
Projects
None yet
Development

No branches or pull requests

2 participants