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

NA's returned by recommendHPR #9

Closed
leo-filgueira opened this issue May 2, 2018 · 5 comments
Closed

NA's returned by recommendHPR #9

leo-filgueira opened this issue May 2, 2018 · 5 comments

Comments

@leo-filgueira
Copy link

leo-filgueira commented May 2, 2018

I'm trying to reproduce recommendHPR example:

myratings <- matrix(sample(c(0:5), size = 200, replace = TRUE,  prob = c(.6,.08,.08,.08,.08,.08)), nrow = 20, byrow = TRUE)
myratings <- defineData(myratings)
r <- rrecsys(myratings, alg = "FunkSVD", k = 2)
rec <- recommendHPR(r)

But myratings matrix has 0 as minimun value, so I've included minimum = 0 at defineData function. In this case, recommendHPR returns a list of NA's. Have I done something wrong?

@ludovikcoba
Copy link
Owner

If minimum = 0, you are telling the package to consider 0 as a rating, and your rating scale varies from 0 to 5. As a results the package will understand that all items are rated by all users, and will not be able to recommend any item that the user has never interacted before. If you set minimum = 1, you should be set!

@leo-filgueira
Copy link
Author

So if I have a matrix where NA's are unrated itens, there is no problem setting minimum = 0 (since minimum rating is 0)?

@ludovikcoba
Copy link
Owner

Sure.
Try the following:

myratings <- matrix(sample(c(NA, 0:5), size = 200, replace = TRUE,  prob = c(0.6, .6,.08,.08,.08,.08,.08)), nrow = 20, byrow = TRUE)
myratings <- defineData(myratings, minimum = 0)
r <- rrecsys(myratings, alg = "FunkSVD", k = 2)
rec <- recommendHPR(r, topN=3)

NA might appear only where there are less than topN =3 unrated items.

@leo-filgueira
Copy link
Author

Ok, I'll try.
Thanks!

@ludovikcoba
Copy link
Owner

👍

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

No branches or pull requests

2 participants