From dd30635bd5cac7cfeef9724d56c7cea42451a449 Mon Sep 17 00:00:00 2001 From: Deipss Date: Mon, 11 Nov 2019 11:58:46 +0800 Subject: [PATCH 1/3] Update GMF.py Cause by the APIs of SciPy have changed, change 'while train.has_key((u, j)):' to 'while (u, j) in train:' --- GMF.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/GMF.py b/GMF.py index 8471310..c0f4ba3 100644 --- a/GMF.py +++ b/GMF.py @@ -91,7 +91,7 @@ def get_train_instances(train, num_negatives): # negative instances for t in xrange(num_negatives): j = np.random.randint(num_items) - while train.has_key((u, j)): + while (u, j) in train: j = np.random.randint(num_items) user_input.append(u) item_input.append(j) @@ -168,4 +168,4 @@ def get_train_instances(train, num_negatives): print("End. Best Iteration %d: HR = %.4f, NDCG = %.4f. " %(best_iter, best_hr, best_ndcg)) if args.out > 0: - print("The best GMF model is saved to %s" %(model_out_file)) \ No newline at end of file + print("The best GMF model is saved to %s" %(model_out_file)) From 2a50be3482b1b5f477f5733d01cbb623bb8e653a Mon Sep 17 00:00:00 2001 From: Deipss Date: Mon, 11 Nov 2019 11:59:51 +0800 Subject: [PATCH 2/3] Update MLP.py Cause by the APIs of SciPy have changed, change 'while train.has_key((u, j)):' to 'while (u, j) in train:' --- MLP.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/MLP.py b/MLP.py index 70566c7..d578826 100644 --- a/MLP.py +++ b/MLP.py @@ -99,7 +99,7 @@ def get_train_instances(train, num_negatives): # negative instances for t in xrange(num_negatives): j = np.random.randint(num_items) - while train.has_key((u, j)): + while (u, j) in train: j = np.random.randint(num_items) user_input.append(u) item_input.append(j) From 4e4c00ef8476a79b095b238fea30e652675dfd56 Mon Sep 17 00:00:00 2001 From: Deipss Date: Mon, 11 Nov 2019 12:01:50 +0800 Subject: [PATCH 3/3] Update NeuMF.py --- NeuMF.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/NeuMF.py b/NeuMF.py index be04d53..d3e5b58 100644 --- a/NeuMF.py +++ b/NeuMF.py @@ -143,7 +143,7 @@ def get_train_instances(train, num_negatives): # negative instances for t in xrange(num_negatives): j = np.random.randint(num_items) - while train.has_key((u, j)): + while (u, j) in train: j = np.random.randint(num_items) user_input.append(u) item_input.append(j)