Recommender predict Sample

Hello - I'm following a code presented in a textbook, and it is not working. This is not the first time that I have found issues with the codes. The code is for Collaborative Filtering, part of Association Rules. If curious, the book is Data Mining for Business Analytics: Concepts, Techniques, and Applications in R (ISBN 9781118879368). Here is the presented code for Collaborative Filtering

# simulate matrix with 1000 users and 100 movies
m <- matrix(nrow = 1000, ncol = 100)

# simulated ratings (1% of the data)
m[sample.int(100*1000, 1000)] <- ceiling(runif(1000, 0, 5))

## convert into a realRatingMatrix
r <- as(m, "realRatingMatrix")

library(recommenderlab)
UB.Rec <- Recommender(r, method = "UBCF")

pred <- predict(UB.Rec, r, type="ratings")

as(pred, "matrix")

I receive the following error on the predict code.

Error in h(simpleError(msg, call)) :
error in evaluating the argument 'x' in selecting a method for function 't': not-yet-implemented method for %*%

I've tried a few things on the code like switching the object (UB.Rec) and the newdata (r), changing the type, adding a number. NOthing is helping.

Any guidance is appreciated! Knowing how this functions will help me in my school assignment.

This topic was automatically closed 21 days after the last reply. New replies are no longer allowed.

If you have a query related to it or one of the replies, start a new topic and refer back with a link.