I’m building a recommender system with SVD. I have 2 separate datasets:
- Train with columns: user_id, product_id, rating
- Test with columns: user_id, product_id
(The library I’m using is surprise)
I want to get the estimated rating for the test dataset; however, because there is no rating column in the test, it shows an error as follows. How can I solve this problem?
`/usr/local/lib/python3.10/dist-packages/surprise/dataset.py in (.0)
262 self.raw_ratings = [
263 (uid, iid, float(r), None)
–> 264 for (uid, iid, r) in self.df.itertuples(index=False)
265 ]
266 else:
ValueError: not enough values to unpack (expected 3, got 2)`
The process I do:
Prepare the train dataset:
data = Dataset.load_from_df(train[['user_id', 'product_id', 'rating']], reader) trainset = data.build_full_trainset()
Fit the train data to the algorithm:
algo.fit(trainset)
And the error occurred on this line:
test_data = Dataset.load_from_df(test[['user_id', 'product_id']], reader)
Thank you!
Lin Huang is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.