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

Popularity recommender with less than K items #4

Open
paraschakis opened this issue Feb 22, 2023 · 1 comment
Open

Popularity recommender with less than K items #4

paraschakis opened this issue Feb 22, 2023 · 1 comment
Labels
bug Something isn't working
Milestone

Comments

@paraschakis
Copy link

paraschakis commented Feb 22, 2023

A minor thing that could be an issue for smaller datasets.

Since the default value for K is 200 for popularity recommender, it will fail with a ValueError if the dataset has fewer than 200 items.
This is because the dimensions of U, I, V will be different when creating a scr_matrix:

        U, I, V = [], [], []

        for user in users:
            U.extend([user] * self.K)
            I.extend(items)
            V.extend(values)

score_matrix = csr_matrix((V, (U, I)), shape=X.shape)

This of course can be solved by manually providing the value for K, but we can't rely on that.

Suggested fix:
U.extend([user] * min(self.K, len(items)))

@LienM LienM added the bug Something isn't working label Feb 22, 2023
@LienM
Copy link
Owner

LienM commented Feb 22, 2023

Hi @paraschakis,

Thanks for reporting this bug! I'm adding it to the issue tracker for next release.

Lien

@LienM LienM added this to the 0.3.6 milestone Feb 22, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

2 participants