I'm current running R-64bit (version 3.4.4) on windows machine with recommenderlab version 0.2-2
Below is the sample dataset
m <- matrix(sample(c(0,1), 50, replace=TRUE), nrow=5, ncol=10,
dimnames=list(users=paste("u", 1:5, sep=''),
items=paste("i", 1:10, sep='')))
Convert matrix into binaryRatingMatrix
b <- as(m, "binaryRatingMatrix")
Compute HybridRecommender
system.time(
recom <- recommenderlab::HybridRecommender(
Recommender(b, method = "AR"),
Recommender(b, method = "IBCF"),
Recommender(b, method = "POPULAR"),
Recommender(b, method = "UBCF"),
weights = c(.25, .25, .25, .25))
)
Compute predicted recommendation items "topNList" (with error)
as(predict(recom, 1, newdata = b, type = "topNList", n = 10), "list")
Error in match.arg(type) : 'arg' should be one of “topNList”
r <- Recommender(b, method = "AR")
as(predict(r, 1, newdata = b, type = "topNList", n = 10), "list")
$u1
character(0)
$u2
[1] "i10" "i2" "i5" "i6" "i9" "i8"
$u3
[1] "i4" "i6" "i9" "i8" "i3"
$u4
[1] "i9" "i8"
$u5
[1] "i7" "i3" "i2" "i10" "i4" "i5" "i6" "i1"
New Edit: Tried "HybridRecommender" on "realRatingMatrix", it work as normal
data(Jester5k)
class(Jester5k)
[1] "realRatingMatrix"
attr(,"package")
[1] "recommenderlab"
system.time(
recom <- HybridRecommender(
Recommender(Jester5k, method = "POPULAR"),
Recommender(Jester5k, method = "IBCF"),
Recommender(Jester5k, method = "SVDF"),
Recommender(Jester5k, method = "UBCF"),
weights = c(.25, .25, .25, .25))
)
getList(predict(recom, 1:5, Jester5k, n = 5))
[[1]]
[1] "j84" "j85" "j83" "j82" "j81"
[[2]]
[1] "j89" "j93" "j76" "j81" "j88"
[[3]]
character(0)
[[4]]
character(0)
[[5]]
[1] "j80" "j81" "j100" "j72" "j89"
Is a bug and the issue solved on latest development version (version 0.2-4.1), current available on Github. Kindly check the details Here