From 86cd40946415bc72e17de770379d4b35656584ac Mon Sep 17 00:00:00 2001 From: moomoofarm1 <46774289+moomoofarm1@users.noreply.github.com> Date: Wed, 10 May 2023 16:55:54 +0200 Subject: [PATCH] Update predict_ratings.py Replace the str() with .to_raw_uids() and .to_raw_iids(). --- examples/predict_ratings.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/examples/predict_ratings.py b/examples/predict_ratings.py index 8e6aabac..e29d27d3 100644 --- a/examples/predict_ratings.py +++ b/examples/predict_ratings.py @@ -17,8 +17,8 @@ algo.fit(trainset) # we can now query for specific predicions -uid = str(196) # raw user id (as in the ratings file). They are **strings**! -iid = str(302) # raw item id (as in the ratings file). They are **strings**! +uid = trainset.to_raw_uid(196) # raw user id (as in the ratings file). They are **strings**! Do not use str() causing issues of having the same estimation for different ids. +iid = trainset.to_raw_iid(302) # raw item id (as in the ratings file). They are **strings**! # get a prediction for specific users and items. pred = algo.predict(uid, iid, r_ui=4, verbose=True)