From b74a423423eb66d55db47ea6e7f0d886b7246635 Mon Sep 17 00:00:00 2001 From: 2017pxy <2017202006@ruc.edu.cn> Date: Mon, 29 Mar 2021 13:38:45 +0000 Subject: [PATCH 1/4] FIX: fix in split by ratio --- recbole/data/dataset/dataset.py | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/recbole/data/dataset/dataset.py b/recbole/data/dataset/dataset.py index 6b802deb8..e974710ea 100644 --- a/recbole/data/dataset/dataset.py +++ b/recbole/data/dataset/dataset.py @@ -23,6 +23,7 @@ import torch import torch.nn.utils.rnn as rnn_utils from scipy.sparse import coo_matrix +import math from recbole.data.interaction import Interaction from recbole.data.utils import dlapi @@ -1246,7 +1247,7 @@ def _calcu_split_ids(self, tot, ratios): Returns: list: Number of each part after splitting. """ - cnt = [int(ratios[i] * tot) for i in range(len(ratios))] + cnt = [math.ceil(ratios[i] * tot) for i in range(len(ratios))] cnt[0] = tot - sum(cnt[1:]) split_ids = np.cumsum(cnt)[:-1] return list(split_ids) From c2a54e2177a69b6fdf8ce2136cd9e8117daaf719 Mon Sep 17 00:00:00 2001 From: 2017pxy <2017202006@ruc.edu.cn> Date: Wed, 31 Mar 2021 12:22:08 +0000 Subject: [PATCH 2/4] FIX: fix the bug in LINE --- recbole/model/general_recommender/line.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/recbole/model/general_recommender/line.py b/recbole/model/general_recommender/line.py index 7c183c2f4..9a7fbf9f3 100644 --- a/recbole/model/general_recommender/line.py +++ b/recbole/model/general_recommender/line.py @@ -69,7 +69,7 @@ def __init__(self, config, dataset): def get_used_ids(self): cur = np.array([set() for _ in range(self.n_items)]) - for iid, uid in zip(self.interaction_feat[self.USER_ID].numpy(), self.interaction_feat[self.ITEM_ID].numpy()): + for uid, iid in zip(self.interaction_feat[self.USER_ID].numpy(), self.interaction_feat[self.ITEM_ID].numpy()): cur[iid].add(uid) return cur From 6d64682ac1821f5f0d95c35c8dff64cd13dac96b Mon Sep 17 00:00:00 2001 From: 2017pxy <2017202006@ruc.edu.cn> Date: Wed, 31 Mar 2021 12:30:44 +0000 Subject: [PATCH 3/4] FIX: fix the bug in data split --- recbole/data/dataset/dataset.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/recbole/data/dataset/dataset.py b/recbole/data/dataset/dataset.py index e0275ff9d..1b73ad44a 100644 --- a/recbole/data/dataset/dataset.py +++ b/recbole/data/dataset/dataset.py @@ -1247,7 +1247,7 @@ def _calcu_split_ids(self, tot, ratios): Returns: list: Number of each part after splitting. """ - cnt = [math.ceil(ratios[i] * tot) for i in range(len(ratios))] + cnt = [int(ratios[i] * tot) for i in range(len(ratios))] cnt[0] = tot - sum(cnt[1:]) for i in range(1, len(ratios)): if cnt[0] <= 1: From e5aa6d1ad37231416abad9087c4974422fc06fc9 Mon Sep 17 00:00:00 2001 From: 2017pxy <2017202006@ruc.edu.cn> Date: Wed, 31 Mar 2021 12:39:49 +0000 Subject: [PATCH 4/4] FIX: remove math in dataset --- recbole/data/dataset/dataset.py | 1 - 1 file changed, 1 deletion(-) diff --git a/recbole/data/dataset/dataset.py b/recbole/data/dataset/dataset.py index 1b73ad44a..d62617735 100644 --- a/recbole/data/dataset/dataset.py +++ b/recbole/data/dataset/dataset.py @@ -23,7 +23,6 @@ import torch import torch.nn.utils.rnn as rnn_utils from scipy.sparse import coo_matrix -import math from recbole.data.interaction import Interaction from recbole.data.utils import dlapi