knowledge_graph_attention_network icon indicating copy to clipboard operation
knowledge_graph_attention_network copied to clipboard

Running KGAT on Customized Dataset

Open liyy2 opened this issue 4 years ago • 18 comments

When I trying to run KGAT on a customized dataset, I get this error GAT-lyy) yunyangli@UBUNTU1604-R940xa:~/knowledge_graph_attention_network/Model$ python Main.py --model_type kgat --alg_type bi --dataset sl --regs [1e-5,1e-5] --layer_size [64,32,16] --embed_size 64 --lr 0.0001 --epoch 1000 --verbose 50 --save_flag 1 --pretrain -1 --batch_size 1024 --node_dropout [0.1] --mess_dropout [0.1,0.1,0.1] --use_att True --use_kge True [n_users, n_items]=[3234, 96393] [n_train, n_test]=[26379, 26187] [n_entities, n_relations, n_triples]=[96397, 27, 4462966] [batch_size, batch_size_kg]=[1024, 178518] convert ratings into adj mat done. convert 50 relational triples into adj mat done. @1.6183s /home/yunyangli/knowledge_graph_attention_network/Model/utility/loader_kgat.py:87: RuntimeWarning: divide by zero encountered in power d_inv = np.power(rowsum, -1).flatten() generate si-normalized adjacency matrix. reordering indices... reorganize all kg data done. sort meta-data done. sort all data done. using xavier initialization #params: 6611344 without pretraining. Traceback (most recent call last): File "Main.py", line 269, in <module> A_batch_data = data_generator.generate_train_A_batch() File "/home/yunyangli/knowledge_graph_attention_network/Model/utility/loader_kgat.py", line 254, in generate_train_A_batch heads, relations, pos_tails, neg_tails = self._generate_train_A_batch() File "/home/yunyangli/knowledge_graph_attention_network/Model/utility/loader_kgat.py", line 190, in _generate_train_A_batch heads = [rd.choice(exist_heads) for _ in range(self.batch_size_kg)] File "/home/yunyangli/knowledge_graph_attention_network/Model/utility/loader_kgat.py", line 190, in <listcomp> heads = [rd.choice(exist_heads) for _ in range(self.batch_size_kg)] File "/home/yunyangli/.conda/envs/KGAT-lyy/lib/python3.6/random.py", line 261, in choice return seq[i] TypeError: 'dict_keys' object does not support indexing

When running the provided dataset, it's fine. However, when turning into my dataset, I get this weird error. I am running this on python 3.6.3, and everything else is the same as the specified environment.

liyy2 avatar Dec 14 '20 18:12 liyy2

您好,自己的数据集怎么生成train.txt和test.txt还有kg_final.txt?

haotiandouluo avatar Nov 11 '23 14:11 haotiandouluo