KGRec
KGRec copied to clipboard
运行代码里kgcl的mind-f数据集
你好,能告知下运行kgcl的mind-f数据集的具体参数吗,我用github上python run_kgcl.py --mu 0.6 --tau 0.2 --cl_weight 0.1 跑不出论文中的结果,其他2个数据集都能跑出一样的结果
你好,我找到了当时实验时的logs供你参考,也可以贴一下你的logs一起看看问题出在哪里
########## Model HPs ########## tau: 0.2 cl_weight: 0.1 mu: 0.6 ########## Model Parameters ########## context_hops: 2 node_dropout: 1 node_dropout_rate: 0.5 mess_dropout: 1 mess_dropout_rate: 0.1 all_embed: torch.Size([149545, 64]) interact_mat: torch.Size([100000, 30577]) edge_index: torch.Size([2, 297058]) edge_type: torch.Size([297058]) start training ... neg_sampling_cpp time: 2.99s train_cf_triples shape: (2035114, 3) KG Training: Epoch 0000 Total Iter 0072 | Total Time 5.2s | Iter Mean Loss 0.6769 +-------+-------------------+-------------------+-----------------------------------------+--------------+--------------+--------------+--------------+ | Epoch | training time | tesing time | Loss | recall | ndcg | precision | hit_ratio | +-------+-------------------+-------------------+-----------------------------------------+--------------+--------------+--------------+--------------+ | 0 | 531.4563300609589 | 80.76469659805298 | [0.408295095524358, 1.3617043592981777] | [0.03862591] | [0.02234932] | [0.01271063] | [0.21072211] | +-------+-------------------+-------------------+-----------------------------------------+--------------+--------------+--------------+--------------+ ###find better! neg_sampling_cpp time: 3.41s train_cf_triples shape: (2035114, 3) KG Training: Epoch 0001 Total Iter 0072 | Total Time 5.0s | Iter Mean Loss 0.6394 +-------+--------------------+-------------------+-------------------------------------------+--------------+--------------+--------------+--------------+ | Epoch | training time | tesing time | Loss | recall | ndcg | precision | hit_ratio | +-------+--------------------+-------------------+-------------------------------------------+--------------+--------------+--------------+--------------+ | 1 | 385.62240195274353 | 77.11285209655762 | [0.35532164229452123, 1.3160759507365307] | [0.03849705] | [0.02346226] | [0.01238262] | [0.20834208] | +-------+--------------------+-------------------+-------------------------------------------+--------------+--------------+--------------+--------------+ neg_sampling_cpp time: 3.43s train_cf_triples shape: (2035114, 3) KG Training: Epoch 0002 Total Iter 0072 | Total Time 5.2s | Iter Mean Loss 0.6051 +-------+-------------------+-------------------+------------------------------------------+--------------+--------------+--------------+--------------+ | Epoch | training time | tesing time | Loss | recall | ndcg | precision | hit_ratio | +-------+-------------------+-------------------+------------------------------------------+--------------+--------------+--------------+--------------+ | 2 | 316.1989245414734 | 81.28550887107849 | [0.3219790638086456, 1.2982826645399277] | [0.03862644] | [0.02321351] | [0.01236462] | [0.20815208] | +-------+-------------------+-------------------+------------------------------------------+--------------+--------------+--------------+--------------+ ###find better! neg_sampling_cpp time: 3.44s train_cf_triples shape: (2035114, 3) KG Training: Epoch 0003 Total Iter 0072 | Total Time 5.6s | Iter Mean Loss 0.5796 +-------+-------------------+-------------------+-------------------------------------------+-------------+--------------+--------------+--------------+ | Epoch | training time | tesing time | Loss | recall | ndcg | precision | hit_ratio | +-------+-------------------+-------------------+-------------------------------------------+-------------+--------------+--------------+--------------+ | 3 | 314.1738669872284 | 81.17710757255554 | [0.29760144308905195, 1.2887550282257867] | [0.0390051] | [0.02421416] | [0.01239362] | [0.20916209] | +-------+-------------------+-------------------+-------------------------------------------+-------------+--------------+--------------+--------------+ ###find better! neg_sampling_cpp time: 3.79s train_cf_triples shape: (2035114, 3) KG Training: Epoch 0004 Total Iter 0072 | Total Time 5.4s | Iter Mean Loss 0.5581 +-------+--------------------+-------------------+-----------------------------------------+--------------+--------------+--------------+--------------+ | Epoch | training time | tesing time | Loss | recall | ndcg | precision | hit_ratio | +-------+--------------------+-------------------+-----------------------------------------+--------------+--------------+--------------+--------------+ | 4 | 313.95236587524414 | 76.75679683685303 | [0.2819084409125663, 1.282967008893798] | [0.03877621] | [0.02368854] | [0.01235712] | [0.20855209] | +-------+--------------------+-------------------+-----------------------------------------+--------------+--------------+--------------+--------------+ neg_sampling_cpp time: 3.67s train_cf_triples shape: (2035114, 3) KG Training: Epoch 0005 Total Iter 0072 | Total Time 5.0s | Iter Mean Loss 0.5388 +-------+-------------------+-------------------+-------------------------------------------+--------------+--------------+--------------+--------------+ | Epoch | training time | tesing time | Loss | recall | ndcg | precision | hit_ratio | +-------+-------------------+-------------------+-------------------------------------------+--------------+--------------+--------------+--------------+ | 5 | 314.6148717403412 | 79.93286609649658 | [0.26820532495839905, 1.2776845522406277] | [0.03920328] | [0.02409163] | [0.01236312] | [0.20886209] | +-------+-------------------+-------------------+-------------------------------------------+--------------+--------------+--------------+--------------+ ###find better! neg_sampling_cpp time: 3.54s train_cf_triples shape: (2035114, 3) KG Training: Epoch 0006 Total Iter 0072 | Total Time 5.3s | Iter Mean Loss 0.5235 +-------+-------------------+-------------------+-------------------------------------------+--------------+--------------+--------------+--------------+ | Epoch | training time | tesing time | Loss | recall | ndcg | precision | hit_ratio | +-------+-------------------+-------------------+-------------------------------------------+--------------+--------------+--------------+--------------+ | 6 | 314.9320204257965 | 78.84099960327148 | [0.25811479078703686, 1.2740617850331402] | [0.03853254] | [0.02350788] | [0.01204062] | [0.20450205] | +-------+-------------------+-------------------+-------------------------------------------+--------------+--------------+--------------+--------------+ neg_sampling_cpp time: 3.72s train_cf_triples shape: (2035114, 3) KG Training: Epoch 0007 Total Iter 0072 | Total Time 5.2s | Iter Mean Loss 0.5088 +-------+-------------------+-------------------+------------------------------------------+--------------+--------------+--------------+--------------+ | Epoch | training time | tesing time | Loss | recall | ndcg | precision | hit_ratio | +-------+-------------------+-------------------+------------------------------------------+--------------+--------------+--------------+--------------+ | 7 | 318.7644090652466 | 82.73736381530762 | [0.2496205178611847, 1.2692209132430852] | [0.03955395] | [0.02389936] | [0.01247712] | [0.21075211] | +-------+-------------------+-------------------+------------------------------------------+--------------+--------------+--------------+--------------+ ###find better! neg_sampling_cpp time: 3.48s train_cf_triples shape: (2035114, 3) KG Training: Epoch 0008 Total Iter 0072 | Total Time 5.7s | Iter Mean Loss 0.4965 +-------+-------------------+-------------------+------------------------------------------+--------------+--------------+--------------+--------------+ | Epoch | training time | tesing time | Loss | recall | ndcg | precision | hit_ratio | +-------+-------------------+-------------------+------------------------------------------+--------------+--------------+--------------+--------------+ | 8 | 349.7946538925171 | 82.80669784545898 | [0.2431121128325692, 1.2674603794533825] | [0.03968039] | [0.02418322] | [0.01249312] | [0.21220212] | +-------+-------------------+-------------------+------------------------------------------+--------------+--------------+--------------+--------------+ ###find better! neg_sampling_cpp time: 3.94s train_cf_triples shape: (2035114, 3) KG Training: Epoch 0009 Total Iter 0072 | Total Time 5.4s | Iter Mean Loss 0.4849 +-------+-------------------+-------------------+-------------------------------------------+--------------+--------------+--------------+--------------+ | Epoch | training time | tesing time | Loss | recall | ndcg | precision | hit_ratio | +-------+-------------------+-------------------+-------------------------------------------+--------------+--------------+--------------+--------------+ | 9 | 459.5120792388916 | 80.41200733184814 | [0.23720916713287277, 1.2639568040797367] | [0.03980368] | [0.02438788] | [0.01251263] | [0.21225212] | +-------+-------------------+-------------------+-------------------------------------------+--------------+--------------+--------------+--------------+ ###find better! neg_sampling_cpp time: 3.41s train_cf_triples shape: (2035114, 3) KG Training: Epoch 0010 Total Iter 0072 | Total Time 5.9s | Iter Mean Loss 0.4739 +-------+-------------------+-------------------+-----------------------------------------+--------------+--------------+--------------+-------------+ | Epoch | training time | tesing time | Loss | recall | ndcg | precision | hit_ratio | +-------+-------------------+-------------------+-----------------------------------------+--------------+--------------+--------------+-------------+ | 10 | 473.9411733150482 | 85.58325386047363 | [0.2303552733759822, 1.261164086733707] | [0.03959648] | [0.02425741] | [0.01235612] | [0.2096721] | +-------+-------------------+-------------------+-----------------------------------------+--------------+--------------+--------------+-------------+ neg_sampling_cpp time: 2.93s train_cf_triples shape: (2035114, 3) KG Training: Epoch 0011 Total Iter 0072 | Total Time 6.2s | Iter Mean Loss 0.4646 +-------+--------------------+-------------------+-------------------------------------------+--------------+--------------+--------------+--------------+ | Epoch | training time | tesing time | Loss | recall | ndcg | precision | hit_ratio | +-------+--------------------+-------------------+-------------------------------------------+--------------+--------------+--------------+--------------+ | 11 | 469.30019330978394 | 84.91639709472656 | [0.22618356875883883, 1.2582585739798176] | [0.03920739] | [0.02399051] | [0.01227812] | [0.20860209] | +-------+--------------------+-------------------+-------------------------------------------+--------------+--------------+--------------+--------------+ neg_sampling_cpp time: 2.93s train_cf_triples shape: (2035114, 3) KG Training: Epoch 0012 Total Iter 0072 | Total Time 5.8s | Iter Mean Loss 0.4548 +-------+--------------------+-------------------+-----------------------------------------+--------------+--------------+--------------+--------------+ | Epoch | training time | tesing time | Loss | recall | ndcg | precision | hit_ratio | +-------+--------------------+-------------------+-----------------------------------------+--------------+--------------+--------------+--------------+ | 12 | 469.11490988731384 | 84.68232417106628 | [0.222394882657307, 1.2560163539666667] | [0.03921609] | [0.02380126] | [0.01225362] | [0.20863209] | +-------+--------------------+-------------------+-----------------------------------------+--------------+--------------+--------------+--------------+ neg_sampling_cpp time: 2.98s train_cf_triples shape: (2035114, 3) KG Training: Epoch 0013 Total Iter 0072 | Total Time 6.2s | Iter Mean Loss 0.4451 +-------+--------------------+-------------------+-------------------------------------------+--------------+--------------+--------------+-------------+ | Epoch | training time | tesing time | Loss | recall | ndcg | precision | hit_ratio | +-------+--------------------+-------------------+-------------------------------------------+--------------+--------------+--------------+-------------+ | 13 | 468.23240399360657 | 85.85740780830383 | [0.21800240161631695, 1.2546934969095231] | [0.03966943] | [0.02429986] | [0.01238062] | [0.2103921] | +-------+--------------------+-------------------+-------------------------------------------+--------------+--------------+--------------+-------------+ neg_sampling_cpp time: 2.95s train_cf_triples shape: (2035114, 3) KG Training: Epoch 0014 Total Iter 0072 | Total Time 5.4s | Iter Mean Loss 0.4359 +-------+--------------------+------------------+-------------------------------------------+--------------+--------------+--------------+--------------+ | Epoch | training time | tesing time | Loss | recall | ndcg | precision | hit_ratio | +-------+--------------------+------------------+-------------------------------------------+--------------+--------------+--------------+--------------+ | 14 | 468.75410318374634 | 83.7613377571106 | [0.21439895647952456, 1.2534200190564824] | [0.03863461] | [0.02329463] | [0.01202462] | [0.20539205] | +-------+--------------------+------------------+-------------------------------------------+--------------+--------------+--------------+--------------+ neg_sampling_cpp time: 2.93s train_cf_triples shape: (2035114, 3) KG Training: Epoch 0015 Total Iter 0072 | Total Time 5.6s | Iter Mean Loss 0.4281 +-------+-------------------+-------------------+------------------------------------------+--------------+--------------+--------------+--------------+ | Epoch | training time | tesing time | Loss | recall | ndcg | precision | hit_ratio | +-------+-------------------+-------------------+------------------------------------------+--------------+--------------+--------------+--------------+ | 15 | 470.8782889842987 | 85.43479466438293 | [0.2121588766559567, 1.2518306680431974] | [0.03953964] | [0.02388975] | [0.01239212] | [0.21069211] | +-------+-------------------+-------------------+------------------------------------------+--------------+--------------+--------------+--------------+ neg_sampling_cpp time: 3.67s train_cf_triples shape: (2035114, 3) KG Training: Epoch 0016 Total Iter 0072 | Total Time 5.6s | Iter Mean Loss 0.4206 +-------+--------------------+------------------+------------------------------------------+--------------+--------------+--------------+--------------+ | Epoch | training time | tesing time | Loss | recall | ndcg | precision | hit_ratio | +-------+--------------------+------------------+------------------------------------------+--------------+--------------+--------------+--------------+ | 16 | 470.93406105041504 | 80.7538001537323 | [0.2087540636193304, 1.2492060448777944] | [0.03994339] | [0.02474511] | [0.01251613] | [0.21267213] | +-------+--------------------+------------------+------------------------------------------+--------------+--------------+--------------+--------------+ ###find better!
你好,我找到了当时实验时的日志供你参考,也可以贴在你的日志一起看看问题出在哪里
########## 模型 HP ########## tau: 0.2 cl_weight: 0.1 mu: 0.6 ########## 模型参数 ####### ### context_hops: 2node_dropout: 1node_dropout_rate: 0.5mess_dropout : 1mess_dropout_rate: 0.1all_embed : torch.Size([149545, 64]) interact_mat: torch.Size([100000, 30577]) edge_index: torch.Size([2 ,297058]) edge_type:torch.Size([297058]) 开始训练... neg_sampling_cpp时间:2.99s train_cf_triples形状:(2035114,3) KG训练:Epoch 0000 Total Iter 0072 | 总时间 5.2 秒 | Iter 平均损失 0.6769 +--------+--------------------+----------------- --+----------------------------------------------------+----- ----------+--------------+--------------+------------ ----+ | 纪元 | 培训时间| 测试时间| 损失| 回忆| NDCG| 精度 | 命中率| +--------+--------------------+--------------------+- ----------------------------------------------------+--------- ---+--------------+--------------+---------------- + | 0 | 531.4563300609589 | 80.76469659805298 | [0.408295095524358,1.3617043592981777] | [0.03862591] | [0.02234932] | [0.01271063] | [0.21072211] | +--------+--------------------+--------------------+- ----------------------------------------------------+--------- ---+--------------+--------------+---------------- + ###找到更好的! neg_sampling_cpp 时间:3.41s train_cf_triples 形状:(2035114, 3) KG 训练:Epoch 0001 Total Iter 0072 | 总时间 5.0 秒 | Iter 平均损失 0.6394 +--------+--------------------+---------------- ---+--------------------------------------------------------+-- ----------+--------------+--------------+-------- --------+ | 纪元 | 培训时间| 测试时间| 损失| 回忆| NDCG| 精度 | 命中率| +--------+--------------------+--------------------+ -------------------------------------------------------+------ ------+--------------+--------------+------------ ---+ | 1 | 385.62240195274353 | 77.11285209655762 | [0.35532164229452123,1.3160759507365307] | [0.03849705] | [0.02346226] | [0.01238262] | [0.20834208] | +--------+--------------------+--------------------+ -------------------------------------------------------+------ ------+--------------+--------------+------------ ---+ neg_sampling_cpp 时间:3.43s train_cf_triples 形状:(2035114, 3) KG 训练:Epoch 0002 Total Iter 0072 | 总时间 5.2 秒 | Iter 平均损失 0.6051 +--------+--------------------+----------------- --+----------------------------------------------------+---- ----------+--------------+--------------+--------- -----+ | 纪元 | 培训时间| 测试时间| 损失| 回忆| NDCG| 精度 | 命中率| +--------+--------------------+--------------------+- ----------------------------------------------------+-------- ------+--------------+--------------+------------- -+ | 2 | 316.1989245414734 | 81.28550887107849 | [0.3219790638086456,1.2982826645399277] | [0.03862644] | [0.02321351] | [0.01236462] | [0.20815208] | +--------+--------------------+--------------------+- ----------------------------------------------------+-------- ------+--------------+--------------+------------- -+ ###找到更好的! neg_sampling_cpp 时间:3.44s train_cf_triples 形状:(2035114, 3) KG 训练:Epoch 0003 Total Iter 0072 | 总时间 5.6 秒 | Iter 平均损失 0.5796 +--------+--------------------+-------------------- --+--------------------------------------------------------+--- ----------+--------------+--------------+--------- -----+ | 纪元 | 培训时间| 测试时间| 损失| 回忆| NDCG| 精度 | 命中率| +--------+--------------------+--------------------+- ------------------------------------------+-------- ------+--------------+--------------+------------- -+ | 3 | 314.1738669872284 | 81.17710757255554 | [0.29760144308905195,1.2887550282257867] | [0.0390051] | [0.02421416] | [0.01239362] | [0.20916209] | +--------+--------------------+--------------------+- ------------------------------------------+-------- ------+--------------+--------------+------------- -+ ###找到更好的! neg_sampling_cpp 时间:3.79s train_cf_triples 形状:(2035114, 3) KG 训练:Epoch 0004 Total Iter 0072 | 总时间 5.4 秒 | Iter 平均损失 0.5581 +--------+--------------------+---------------- ---+----------------------------------------------------+---- ----------+--------------+--------------+--------- -----+ | 纪元 | 培训时间| 测试时间| 损失| 回忆| NDCG| 精度 | 命中率| +--------+--------------------+--------------------+ ----------------------------------------------------+-------- ------+--------------+--------------+------------- -+ | 4 | 313.95236587524414 | 76.75679683685303 | [0.2819084409125663,1.282967008893798] | [0.03877621] | [0.02368854] | [0.01235712] | [0.20855209] | +--------+--------------------+--------------------+ ----------------------------------------------------+-------- ------+--------------+--------------+------------- -+ neg_sampling_cpp 时间:3.67s train_cf_triples 形状:(2035114, 3) KG 训练:Epoch 0005 Total Iter 0072 | 总时间 5.0 秒 | Iter 平均损失 0.5388 +--------+--------------------+--------------------+- ------------------------------------------+-------- -------+--------------+--------------+------------ --+ | 纪元 | 培训时间| 测试时间| 损失| 回忆| NDCG| 精度 | 命中率| +--------+--------------------+--------------------+- ------------------------------------------+-------- -------+--------------+--------------+------------ --+ | 5 | 314.6148717403412 | 79.93286609649658 | [0.26820532495839905,1.2776845522406277] | [0.03920328] | [0.02409163] | [0.01236312] | [0.20886209] | +--------+--------------------+--------------------+- ------------------------------------------+-------- -------+--------------+--------------+------------ --+ ###找到更好的! neg_sampling_cpp 时间:3.54s train_cf_triples 形状:(2035114, 3) KG 训练:Epoch 0006 Total Iter 0072 | 总时间 5.3 秒 | Iter 平均损失 0.5235 +--------+--------------------+-------------------- --+--------------------------------------------------------+--- -----------+--------------+--------------+-------- ------+ | 纪元 | 培训时间| 测试时间| 损失| 回忆| NDCG| 精度 | 命中率| +--------+--------------------+--------------------+- ------------------------------------------+-------- -------+--------------+--------------+------------ --+ | 6 | 314.9320204257965 | 78.84099960327148 | [0.25811479078703686,1.2740617850331402] | [0.03853254] | [0.02350788] | [0.01204062] | [0.20450205] | +--------+--------------------+--------------------+- ------------------------------------------+-------- -------+--------------+--------------+------------ --+ neg_sampling_cpp 时间:3.72s train_cf_triples 形状:(2035114, 3) KG 训练:Epoch 0007 Total Iter 0072 | 总时间 5.2 秒 | Iter 平均损失 0.5088 +--------+--------------------+----------------- --+----------------------------------------------------+---- ----------+--------------+--------------+--------- -----+ | 纪元 | 培训时间| 测试时间| 损失| 回忆| NDCG| 精度 | 命中率| +--------+--------------------+--------------------+- ----------------------------------------------------+-------- ------+--------------+--------------+------------- -+ | 7 | 318.7644090652466 | 82.73736381530762 | [0.2496205178611847,1.2692209132430852] | [0.03955395] | [0.02389936] | [0.01247712] | [0.21075211] | +--------+--------------------+--------------------+- ----------------------------------------------------+-------- ------+--------------+--------------+------------- -+ ###找到更好的! neg_sampling_cpp时间:3.48s train_cf_triples 形状:(2035114, 3) KG 训练:Epoch 0008 Total Iter 0072 | 总时间 5.7 秒 | Iter 平均损失 0.4965 +--------+--------------------+-------------------- --+----------------------------------------------------+---- ----------+--------------+--------------+--------- -----+ | 纪元 | 培训时间| 测试时间| 损失| 回忆| NDCG| 精度 | 命中率| +--------+--------------------+--------------------+- ----------------------------------------------------+-------- ------+--------------+--------------+------------- -+ | 8 | 349.7946538925171 | 82.80669784545898 | [0.2431121128325692,1.2674603794533825] | [0.03968039] | [0.02418322] | [0.01249312] | [0.21220212] | +--------+--------------------+--------------------+- ----------------------------------------------------+-------- ------+--------------+--------------+------------- -+ ###找到更好的! neg_sampling_cpp 时间:3.94s train_cf_triples 形状:(2035114, 3) KG 训练:Epoch 0009 Total Iter 0072 | 总时间 5.4 秒 | Iter 平均损失 0.4849 +--------+--------------------+----------------- --+--------------------------------------------------------+--- -----------+--------------+--------------+-------- ------+ | 纪元 | 培训时间| 测试时间| 损失| 回忆| NDCG| 精度 | 命中率| +--------+--------------------+--------------------+- ------------------------------------------+-------- -------+--------------+--------------+------------ --+ | 9 | 459.5120792388916 | 80.41200733184814 | [0.23720916713287277,1.2639568040797367] | [0.03980368] | [0.02438788] | [0.01251263] | [0.21225212] | +--------+--------------------+--------------------+- ------------------------------------------+-------- -------+--------------+--------------+------------ --+ ###找到更好的! neg_sampling_cpp 时间:3.41s train_cf_triples 形状:(2035114, 3) KG 训练:Epoch 0010 Total Iter 0072 | 总时间 5.9 秒 | Iter 平均损失 0.4739 +--------+--------------------+----------------- --+----------------------------------------------------+----- ----------+--------------+--------------+------------ ---+ | 纪元 | 培训时间| 测试时间| 损失| 回忆| NDCG| 精度 | 命中率| +--------+--------------------+--------------------+- ----------------------------------------------------+--------- ---+--------------+--------------+------------+ | 10 | 10 473.9411733150482 | 85.58325386047363 | [0.2303552733759822,1.261164086733707] | [0.03959648] | [0.02425741] | [0.01235612] | [0.2096721] | +--------+--------------------+--------------------+- ----------------------------------------------------+--------- ---+--------------+--------------+------------+ neg_sampling_cpp 时间:2.93s train_cf_triples 形状:(2035114, 3) KG 训练:Epoch 0011 Total Iter 0072 | 总时间 6.2 秒 | Iter 平均损失 0.4646 +--------+--------------------+---------------- ---+--------------------------------------------------------+-- ----------+--------------+--------------+-------- --------+ | 纪元 | 培训时间| 测试时间| 损失| 回忆| NDCG| 精度 | 命中率| +--------+--------------------+--------------------+ -------------------------------------------------------+------ ------+--------------+--------------+------------ ---+ | 11 | 11 469.30019330978394 | 84.91639709472656 | [0.22618356875883883,1.2582585739798176] | [0.03920739] | [0.02399051] | [0.01227812] | [0.20860209] | +--------+--------------------+--------------------+ -------------------------------------------------------+------ ------+--------------+--------------+------------ ---+ neg_sampling_cpp 时间:2.93s train_cf_triples 形状:(2035114, 3) KG 训练:Epoch 0012 Total Iter 0072 | 总时间 5.8 秒 | Iter 平均损失 0.4548 +--------+--------------------------------+---------------- ---+----------------------------------------------------+---- ----------+--------------+--------------+--------- -----+ | 纪元 | 培训时间| 测试时间| 损失| 回忆| NDCG| 精度 | 命中率| +--------+--------------------+--------------------+ ----------------------------------------------------+-------- ------+--------------+--------------+------------- -+ | 12 | 12 469.11490988731384 | 84.68232417106628 | [0.222394882657307,1.2560163539666667] | [0.03921609] | [0.02380126] | [0.01225362] | [0.20863209] | +--------+--------------------+--------------------+ ----------------------------------------------------+-------- ------+--------------+--------------+------------- -+ neg_sampling_cpp 时间:2.98s train_cf_triples 形状:(2035114, 3) KG 训练:Epoch 0013 Total Iter 0072 | 总时间 6.2 秒 | Iter 平均损失 0.4451 +--------+--------------------+---------------- ---+--------------------------------------------------------+-- ----------+--------------+--------------+-------- ------+ | 纪元 | 培训时间| 测试时间| 损失| 回忆| NDCG| 精度 | 命中率| +--------+--------------------+--------------------+ -------------------------------------------------------+------ ------+--------------+--------------+------------ --+ | 13 | 468.23240399360657 | 85.85740780830383 | [0.21800240161631695,1.2546934969095231] | [0.03966943] | [0.02429986] | [0.01238062] | [0.2103921] | +--------+--------------------+--------------------+ -------------------------------------------------------+------ ------+--------------+--------------+------------ --+ neg_sampling_cpp 时间:2.95s train_cf_triples 形状:(2035114, 3) KG 训练:Epoch 0014 Total Iter 0072 | 总时间 5.4 秒 | Iter 平均损失 0.4359 +--------+--------------------+---------------- --+--------------------------------------------------------+--- -----------+--------------+--------------+-------- ------+ | 纪元 | 培训时间| 测试时间| 损失| 回忆| NDCG| 精度 | 命中率| +--------+--------------------+--------------------+- ------------------------------------------+-------- -------+--------------+--------------+------------ --+ | 14 | 14 468.75410318374634 | 83.7613377571106 | [0.21439895647952456,1.2534200190564824] | [0.03863461] | [0.02329463] | [0.01202462] | [0.20539205] | +--------+--------------------+--------------------+- ------------------------------------------+-------- -------+--------------+--------------+------------ --+ neg_sampling_cpp 时间:2.93s train_cf_triples 形状:(2035114, 3) KG 训练:Epoch 0015 Total Iter 0072 | 总时间 5.6 秒 | Iter 平均损失 0.4281 +--------+--------------------+----------------- --+----------------------------------------------------+---- ----------+--------------+--------------+--------- -----+ | 纪元 | 培训时间| 测试时间| 损失| 回忆| NDCG| 精度 | 命中率| +--------+--------------------+--------------------+- ----------------------------------------------------+-------- ------+--------------+--------------+------------- -+ | 15 | 15 470.8782889842987 | 85.43479466438293 | [0.2121588766559567,1.2518306680431974] | [0.03953964] | [0.02388975] | [0.01239212] | [0.21069211] | +--------+--------------------+--------------------+- ----------------------------------------------------+-------- ------+--------------+--------------+------------- -+ neg_sampling_cpp 时间:3.67s train_cf_triples 形状:(2035114, 3) KG 训练:Epoch 0016 Total Iter 0072 | 总时间 5.6 秒 | Iter 平均损失 0.4206 +--------+--------------------+---------------- --+----------------------------------------------------+---- ----------+--------------+--------------+--------- -----+ | 纪元 | 培训时间| 测试时间| 损失| 回忆| NDCG| 精度 | 命中率| +--------+--------------------+--------------------+- ----------------------------------------------------+-------- ------+--------------+--------------+------------- -+ | 16 | 16 470.93406105041504 | 80.7538001537323 | [0.2087540636193304,1.2492060448777944] | [0.03994339] | [0.02474511] | [0.01251613] | [0.21267213] | +--------+--------------------+--------------------+- ----------------------------------------------------+-------- ------+--------------+--------------+------------- -+ ###找到更好的!
非常感谢您的回答,我再尝试跑下代码。在我跑的过程中,第一轮就是最佳的结果。
E:\anaconda\envs\k1\python.exe run_kgcl.py --mu 0.6 --tau 0.2 --cl_weight 0.1 reading train and test user-item set ... PID: 9764 DESC:
interaction count: train 2035114, test 940205 combinating train_cf and kg data ... building the graph ... Begin to load interaction triples ... 100%|##########| 2035114/2035114 [00:01<00:00, 1038067.24it/s] 0%| | 0/297058 [00:00<?, ?it/s] Begin to load knowledge graph triples ... 100%|##########| 297058/297058 [00:00<00:00, 532133.42it/s] building the adj mat ... Begin to build sparse relation matrix ... ########## Model HPs ########## tau: 0.2 cl_weight: 0.1 mu: 0.6 ########## Model Parameters ########## learning rate: 0.0010 context_hops: 2 node_dropout: 1 node_dropout_rate: 0.5 mess_dropout: 1 mess_dropout_rate: 0.1 all_embed: torch.Size([149545, 64]) interact_mat: torch.Size([130577, 130577]) edge_index: torch.Size([2, 297058]) edge_type: torch.Size([297058]) start training ... neg_sampling_cpp time: 3.40s train_cf_triples shape: (2035114, 3) u-i edge keep ratio: 0.61 u-i edge keep ratio: 0.61 100%|██████████| 1987/1987 [10:55<00:00, 3.03it/s] 100%|██████████| 72/72 [00:03<00:00, 22.37it/s] KG Training: Epoch 0000 Total Iter 0072 | Total Time 3.2s | Iter Mean Loss 0.5706 +-------+-------------------+-------------------+------------------------------------------+--------------+--------------+-------------+--------------+ | Epoch | training time | tesing time | Loss | recall | ndcg | precision | hit_ratio | +-------+-------------------+-------------------+------------------------------------------+--------------+--------------+-------------+--------------+ | 0 | 655.9542171955109 | 534.3583686351776 | [0.2898293779121075, 1.2739353360908736] | [0.03605716] | [0.02278536] | [0.0100656] | [0.17463175] | +-------+-------------------+-------------------+------------------------------------------+--------------+--------------+-------------+--------------+ ###find better! neg_sampling_cpp time: 1.97s train_cf_triples shape: (2035114, 3) u-i edge keep ratio: 0.61 u-i edge keep ratio: 0.62 100%|██████████| 1987/1987 [10:34<00:00, 3.13it/s] 100%|██████████| 72/72 [00:03<00:00, 22.20it/s] KG Training: Epoch 0001 Total Iter 0072 | Total Time 3.2s | Iter Mean Loss 0.4033 +-------+-------------------+-------------------+-------------------------------------------+--------------+--------------+--------------+--------------+ | Epoch | training time | tesing time | Loss | recall | ndcg | precision | hit_ratio | +-------+-------------------+-------------------+-------------------------------------------+--------------+--------------+--------------+--------------+ | 1 | 634.5519931316376 | 564.2034487724304 | [0.12166802154134301, 1.2334884248527904] | [0.03347691] | [0.02156266] | [0.00898109] | [0.15729157] | +-------+-------------------+-------------------+-------------------------------------------+--------------+--------------+--------------+--------------+ neg_sampling_cpp time: 1.96s train_cf_triples shape: (2035114, 3) u-i edge keep ratio: 0.62 u-i edge keep ratio: 0.62 100%|██████████| 1987/1987 [10:44<00:00, 3.08it/s] 100%|██████████| 72/72 [00:07<00:00, 9.75it/s] KG Training: Epoch 0002 Total Iter 0072 | Total Time 7.4s | Iter Mean Loss 0.2693 +-------+-------------------+-------------------+-------------------------------------------+--------------+--------------+--------------+-------------+ | Epoch | training time | tesing time | Loss | recall | ndcg | precision | hit_ratio | +-------+-------------------+-------------------+-------------------------------------------+--------------+--------------+--------------+-------------+ | 2 | 644.2660579681396 | 568.8239576816559 | [0.08102686273172159, 1.2102411550495837] | [0.03232776] | [0.02074705] | [0.00852809] | [0.1504615] | +-------+-------------------+-------------------+-------------------------------------------+--------------+--------------+--------------+-------------+ neg_sampling_cpp time: 1.95s train_cf_triples shape: (2035114, 3) u-i edge keep ratio: 0.62 u-i edge keep ratio: 0.62 100%|██████████| 1987/1987 [10:40<00:00, 3.10it/s] 100%|██████████| 72/72 [00:03<00:00, 22.31it/s] KG Training: Epoch 0003 Total Iter 0072 | Total Time 3.2s | Iter Mean Loss 0.1969 +-------+------------------+------------------+------------------------------------------+--------------+--------------+--------------+--------------+ | Epoch | training time | tesing time | Loss | recall | ndcg | precision | hit_ratio | +-------+------------------+------------------+------------------------------------------+--------------+--------------+--------------+--------------+ | 3 | 640.462394952774 | 513.973007440567 | [0.0619443285666356, 1.1981370567186285] | [0.03133437] | [0.02000369] | [0.00824008] | [0.14567146] | +-------+------------------+------------------+------------------------------------------+--------------+--------------+--------------+--------------+ neg_sampling_cpp time: 1.98s train_cf_triples shape: (2035114, 3) u-i edge keep ratio: 0.62 u-i edge keep ratio: 0.62 100%|██████████| 1987/1987 [10:32<00:00, 3.14it/s] 100%|██████████| 72/72 [00:03<00:00, 22.08it/s] KG Training: Epoch 0004 Total Iter 0072 | Total Time 3.3s | Iter Mean Loss 0.1621 +-------+------------------+-------------------+------------------------------------------+--------------+--------------+--------------+--------------+ | Epoch | training time | tesing time | Loss | recall | ndcg | precision | hit_ratio | +-------+------------------+-------------------+------------------------------------------+--------------+--------------+--------------+--------------+ | 4 | 632.975638628006 | 513.6108350753784 | [0.05058294536996992, 1.190816770092007] | [0.03018201] | [0.01943063] | [0.00804108] | [0.14275143] | +-------+------------------+-------------------+------------------------------------------+--------------+--------------+--------------+--------------+ neg_sampling_cpp time: 1.96s train_cf_triples shape: (2035114, 3) u-i edge keep ratio: 0.62 u-i edge keep ratio: 0.62 100%|██████████| 1987/1987 [10:34<00:00, 3.13it/s] 100%|██████████| 72/72 [00:03<00:00, 22.09it/s] KG Training: Epoch 0005 Total Iter 0072 | Total Time 3.3s | Iter Mean Loss 0.1436 +-------+-------------------+-------------------+------------------------------------------+--------------+--------------+--------------+-------------+ | Epoch | training time | tesing time | Loss | recall | ndcg | precision | hit_ratio | +-------+-------------------+-------------------+------------------------------------------+--------------+--------------+--------------+-------------+ | 5 | 634.1407566070557 | 514.8124732971191 | [0.04359797502180784, 1.186350981964435] | [0.02933623] | [0.01896855] | [0.00787508] | [0.1396614] | +-------+-------------------+-------------------+------------------------------------------+--------------+--------------+--------------+-------------+ neg_sampling_cpp time: 1.95s train_cf_triples shape: (2035114, 3) u-i edge keep ratio: 0.63 u-i edge keep ratio: 0.63 100%|██████████| 1987/1987 [10:37<00:00, 3.12it/s] 100%|██████████| 72/72 [00:03<00:00, 22.12it/s] KG Training: Epoch 0006 Total Iter 0072 | Total Time 3.3s | Iter Mean Loss 0.1337 +-------+-------------------+-------------------+-------------------------------------------+--------------+--------------+--------------+--------------+ | Epoch | training time | tesing time | Loss | recall | ndcg | precision | hit_ratio | +-------+-------------------+-------------------+-------------------------------------------+--------------+--------------+--------------+--------------+ | 6 | 637.0263097286224 | 515.8784699440002 | [0.03929674825949999, 1.1837879817793855] | [0.02891693] | [0.01857174] | [0.00769708] | [0.13693137] | +-------+-------------------+-------------------+-------------------------------------------+--------------+--------------+--------------+--------------+ neg_sampling_cpp time: 1.96s train_cf_triples shape: (2035114, 3) u-i edge keep ratio: 0.63 u-i edge keep ratio: 0.63 100%|██████████| 1987/1987 [10:34<00:00, 3.13it/s] 100%|██████████| 72/72 [00:03<00:00, 22.29it/s] KG Training: Epoch 0007 Total Iter 0072 | Total Time 3.2s | Iter Mean Loss 0.1264 +-------+-------------------+-------------------+--------------------------------------------+--------------+--------------+--------------+--------------+ | Epoch | training time | tesing time | Loss | recall | ndcg | precision | hit_ratio | +-------+-------------------+-------------------+--------------------------------------------+--------------+--------------+--------------+--------------+ | 7 | 634.9021244049072 | 512.7542085647583 | [0.035997070889032506, 1.1818102853719692] | [0.02880275] | [0.01864016] | [0.00777008] | [0.13800138] | +-------+-------------------+-------------------+--------------------------------------------+--------------+--------------+--------------+--------------+ neg_sampling_cpp time: 1.96s train_cf_triples shape: (2035114, 3) u-i edge keep ratio: 0.62 u-i edge keep ratio: 0.62 100%|██████████| 1987/1987 [10:35<00:00, 3.13it/s] 100%|██████████| 72/72 [00:03<00:00, 22.31it/s] KG Training: Epoch 0008 Total Iter 0072 | Total Time 3.2s | Iter Mean Loss 0.1207 +-------+-------------------+-------------------+-------------------------------------------+--------------+-------------+--------------+--------------+ | Epoch | training time | tesing time | Loss | recall | ndcg | precision | hit_ratio | +-------+-------------------+-------------------+-------------------------------------------+--------------+-------------+--------------+--------------+ | 8 | 635.1566028594971 | 514.0580713748932 | [0.03372773789211354, 1.1804602697015885] | [0.02816499] | [0.0182937] | [0.00756308] | [0.13486135] | +-------+-------------------+-------------------+-------------------------------------------+--------------+-------------+--------------+--------------+ neg_sampling_cpp time: 2.00s train_cf_triples shape: (2035114, 3) u-i edge keep ratio: 0.63 u-i edge keep ratio: 0.63 100%|██████████| 1987/1987 [10:36<00:00, 3.12it/s] 100%|██████████| 72/72 [00:03<00:00, 21.95it/s] KG Training: Epoch 0009 Total Iter 0072 | Total Time 3.3s | Iter Mean Loss 0.1169 +-------+-------------------+-------------------+------------------------------------------+--------------+--------------+--------------+--------------+ | Epoch | training time | tesing time | Loss | recall | ndcg | precision | hit_ratio | +-------+-------------------+-------------------+------------------------------------------+--------------+--------------+--------------+--------------+ | 9 | 636.1230661869049 | 512.3302977085114 | [0.03221961169928595, 1.179448314972123] | [0.02756861] | [0.01779282] | [0.00747457] | [0.13332133] | +-------+-------------------+-------------------+------------------------------------------+--------------+--------------+--------------+--------------+ neg_sampling_cpp time: 1.99s train_cf_triples shape: (2035114, 3) u-i edge keep ratio: 0.62 u-i edge keep ratio: 0.62 100%|██████████| 1987/1987 [10:31<00:00, 3.15it/s] 100%|██████████| 72/72 [00:03<00:00, 22.31it/s] KG Training: Epoch 0010 Total Iter 0072 | Total Time 3.2s | Iter Mean Loss 0.1147 +-------+-------------------+------------------+--------------------------------------------+------------+--------------+--------------+--------------+ | Epoch | training time | tesing time | Loss | recall | ndcg | precision | hit_ratio | +-------+-------------------+------------------+--------------------------------------------+------------+--------------+--------------+--------------+ | 10 | 631.7273952960968 | 513.268018245697 | [0.030693773238745704, 1.1790616066681157] | [0.027548] | [0.01771638] | [0.00744907] | [0.13299133] | +-------+-------------------+------------------+--------------------------------------------+------------+--------------+--------------+--------------+ early stopping at 10, recall@20:0.0361
进程已结束,退出代码0 你好,这是我根据默认参数跑出来的结果,我尝试过调整batch_size至512 2048 4096等,结果都不超过0.036
你好,可以尝试更换几个随机种子看看是不是mind-f这个数据集对于特定运行环境比较敏感?
你好,我尝试了更换随机种子,结果仍是不太理想
你好,你的log 中的这些 shape 和我贴出来的是一致的吗?我们可以 check 下会不会是 release 的数据的问题
all_embed: torch.Size([149545, 64]) interact_mat: torch.Size([100000, 30577]) edge_index: torch.Size([2, 297058]) edge_type: torch.Size([297058]) start training ... neg_sampling_cpp time: 2.99s train_cf_triples shape: (2035114, 3)
你好,我仔细检查过,是一致的
你好,我尝试在机器上重新跑,也是得到了一样的结果,我怀疑是因为MIND数据集的 KG 太稀疏,细微的环境改变会导致采样+dropout结果改变,对于整个 KG 造成很大的影响,对于这个现象,我们也建议你可以采用一些别的工作收集的KG for Rec数据替换到这个数据,以避免 MIND 上面结果不稳定的情况出现