xyjigsaw / CENET

Temporal Knowledge Graph Reasoning with Historical Contrastive Learning

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

关于get_history_targer中s_history_label_true的疑问,以及cenet_model.py中对history_tag的疑问

Corazon-XYC opened this issue · comments

你好,请问一下get_history_graph.py的get_history_target方法中,对于s_history_label_true的处理是只要过去有相同(subject,?,object)的集合就能设置为true,为什么这么设置呢?根据论文描述应该是还要约束relation的信息,但这段代码不要求relation相同。

此外,cenet_model.py中关于λ的处理:
s_history_tag[s_history_tag != 0] = self.args.lambdax
o_history_tag[o_history_tag != 0] = self.args.lambdax

    s_non_history_tag[s_history_tag == 1] = -self.args.lambdax
    s_non_history_tag[s_history_tag == 0] = self.args.lambdax

    o_non_history_tag[o_history_tag == 1] = -self.args.lambdax
    o_non_history_tag[o_history_tag == 0] = self.args.lambdax

    s_history_tag[s_history_tag == 0] = -self.args.lambdax
    o_history_tag[o_history_tag == 0] = -self.args.lambdax

第三行中为什么约束s_history_tag==1呢?以上已经把s_history_tag中不等0的部分全部设置为λ了,那么如果λ不等于1,此行就不会起作用,有时间的话解决一下疑问,谢谢。

Hello, thank you for reminding us of the issues found in the CENET code. Sorry for the inconvenience caused to your operation due to the above issue.

  1. About s_history_ label_ true: The file get_history_graph.py (Line124-126) has already considered the relation information and selected objects under the same relation.
idxx = (con_events[:, 0] == rr[ix]).nonzero()[0]
cur_events = con_events[idxx, 1].tolist()
s_history_oid[-1] += con_events[:, 1].tolist()

Of course, if the relationship is not constrained, it is also a feasible way, and CENET can also adapt to such conditions, depending on the selection of the dataset, but we have not yet tested it in this case.

  1. Regarding lambdax issues
    This problem is caused by our negligence. We have not checked the uploaded clean codes. To this end, we will conduct an internal code review, but we are sure that this problem will not have a significant impact on the performance of this version. Welcome to share and push your modified codes with us. Your professional knowledge and insights can have a significant impact on the quality of our code.