benfred / implicit

Fast Python Collaborative Filtering for Implicit Feedback Datasets
https://benfred.github.io/implicit/
MIT License
3.57k stars 612 forks source link

Don't require empty rows in user_items and item_users #526

Closed benfred closed 2 years ago

benfred commented 2 years ago

In the recommend call, user_items required empty rows to be passed for users that weren't being recommended - and likewise the similar_items had a item_users param with the same restriction. When generating recommendations for a single user, if the userid is large - we'd have to generate a vector with an entry for each smaller userid.

Change this to use the passed in 'userid' array, and just have the rows in the user_items sparse matrix match those in the userid array.