xyjigsaw / CENET

Temporal Knowledge Graph Reasoning with Historical Contrastive Learning

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Can you explain how you obtain filtered version and its reason? I don't understand the following code.

Joyce-Jang opened this issue · comments

        o_label = cur_o
        ground = preds[i, cur_o].clone().item()
        if self.args.filtering:
            if pred_known == 's':
                s_id = torch.nonzero(all_triples[:, 0] == cur_s).view(-1)
                idx = torch.nonzero(all_triples[s_id, 1] == cur_r).view(-1)
                idx = s_id[idx]
                idx = all_triples[idx, 2]
            else:
                s_id = torch.nonzero(all_triples[:, 2] == cur_s).view(-1)
                idx = torch.nonzero(all_triples[s_id, 1] == cur_r).view(-1)
                idx = s_id[idx]
                idx = all_triples[idx, 0]

            preds[i, idx] = 0
            preds[i, o_label] = ground

Thanks for your interest in our work. We follow the filtered version from RENET. Thanks again for your careful check 🤗. If there are still some problems, please inform us as soon as possible. Your suggestions can be of help to improve our latest version of CENET.

According to [1], the evaluation of TKGF includes three settings, raw, static filtering and time-aware filtering. As I understand CENET and RE-NET use static filter settings. Do I understand correctly? If I am correct, is there a time aware filtering of the results?

[1] On the Evaluation of Methods for Temporal Knowledge Graph Forecasting.