5
$\begingroup$

The data used is a ratings matrix generated from simple 0-1 yes/no click data based on whether or not a user visited a section of a website. This is implicit voting since if a user is interested in a section he will click it and thus rate it as a "1" and if not rate it as a "0". The ratings matrix thus has 32711 users in the rows and 285 site sections in the columns, after removing 9 that had no user visits.

I run:

library("recommenderlab")
ratingmatrix <- read.csv("ratingmatrix3.txt",",",header=TRUE, row.names=1 )
ratingmatrix <- as.matrix(ratingmatrix)
ratingmatrix <- as(ratingmatrix, "realRatingMatrix")

Rec1 <- Recommender(ratingmatrix[1:1000], method="POPULAR")
pred1 <- predict(Rec1, ratingmatrix[1001:1011], type="ratings")
as(pred1,"matrix")[,1:10]

I only get a prediction matrix with NAs implying that no predictions were made. It is the same with any other method; above POPULAR is used.

Does recommenderlab only deal with denser matrices? Does anyone have any ideas on how to deal with matrices with 0-1 votes, and no NAs? Thanks.

$\endgroup$

1 Answer 1

5
$\begingroup$

You need to convert your ratings matrix to a 'binaryRatingMatrix' format instead of 'realRatingMatrix' format:

ratingmatrix = as(ratingMatrix , 'binaryRatingMatrix')
recommender <- Recommender(ratingmatrix[1:1000], method="POPULAR")
predictions <- predict(recommender, ratingmatrix[1001:1011], type="topNList")
$\endgroup$

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.