not able to use pearson similarity
Closed this issue · 2 comments
inkrement commented
both, jaccard and cosine similarity work, but when I use pearson I get the following error:
> recc_model <- Recommender(data = R, method = "UBCF", parameter = list(method = "pearson"))
> recc_predicted <- predict(object = recc_model, newdata = R,n = 6)
Error in if (!is.null(attr(d, "method")) && tolower(attr(d, "method")) %in% :
missing value where TRUE/FALSE needed
mhahsler commented
The following code seems to work for me (see below). Are you using the latest version (R and recommenderlab)? Please send me code and data that creates the problem.
> data("MovieLense")
> MovieLense100 <- MovieLense[rowCounts(MovieLense) >100,]
> train <- MovieLense100[1:50]
> rec <- Recommender(train, method = "UBCF", list(method = "pearson"))
> rec
Recommender of type ‘UBCF’ for ‘realRatingMatrix’
learned using 50 users.
> predict(object = rec, newdata = MovieLense100, n = 6)
Recommendations as ‘topNList’ with n = 6 for 358 users.
mhahsler commented
Thanks for the bug report. Dissimilarity for binary data returns now the correct data type which fixes the issue.