Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Recommend from liked #35

Merged
merged 3 commits into from
Jun 22, 2017
Merged

Recommend from liked #35

merged 3 commits into from
Jun 22, 2017

Conversation

jbochi
Copy link
Contributor

@jbochi jbochi commented Jun 19, 2017

Hi Benfred,

Thanks so much for this library!

I'm not sure if you are aware, but it's a standard practice to sample users to get item factors and then use those vectors to generate recommendations for all users.

The trick is to cache item factors only and compute user vectors on the fly to generate recommendations. Another advantage of this approach is that we can recompute user recommendations as soon as we have more data, without needing to rebuild the whole model.

This is a rough implementation of the idea. It introduces the recommend_from_liked method that accepts a list of items that were consumed by the user.

I did not reuse the code that computes the user vector in the iterations loop. With some refactoring, I think we could reuse the "solver", adding native and cg support. I can do that myself if you think this feature is helpful.

Any thoughts?

Copy link
Owner

@benfred benfred left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for the PR!

I like the idea behind letting you train to train new user factors on the fly: I know how valuable this can be for real world implementations.

I'm wondering if we can clean up the API you suggest a little though.

In this PR, you're passing a list of liked item ids and a single confidence value. This will work for binary feedback cases, but breaks down for the last.fm example where we will want to include per item how confident we are that the user liked it.

In the existing code, the 'recommend' method takes a sparse matrix of user/item/confidence values already, which contains the liked items for the user. I'm wondering if we can leverage this API, and just add a 'recalculate_user' parameter to indicate that we should recalculate the user factors from the passed in like_items?

@jbochi
Copy link
Contributor Author

jbochi commented Jun 20, 2017 via email

@jbochi
Copy link
Contributor Author

jbochi commented Jun 21, 2017

@benfred I believe the implementation is much cleaner now. I've also managed to reuse the non native code to compute user factors.

Please let me know what do you think about it now.

@benfred benfred merged commit 1c29c56 into benfred:master Jun 22, 2017
@benfred
Copy link
Owner

benfred commented Jun 22, 2017

looks good to me! thanks for this

@farhadGithub
Copy link

Is it possible to share a reference/paper on how/why the recalucate_user method works?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants