sparse matrix - R Recommenderlab - Getting the user_id out the RealRatingMatrix containing UBCF recommendations -
recommenderlab - getting user_id out realratingmatrix containing ubcf recommendations. i'm trying use recommenderlab (with rstudio) recommendations.when i'm using ubcf can't extract user id out of realratingmatrix containing predictions, although can popular , ibcf methods.that's sample code i'm using:
library(recommenderlab) data(jester5k) jester5k r <- sample(jester5k, 1000) rec_pop <- recommender(jester5k[1:1000], method = "popular") #rec_pop recom_pop <- predict(rec_pop, jester5k[1001:1002], n=100, type="ratings") #recom_pop as(recom_pop, "matrix") getlist(recom_pop,decode=true,ratings=true) getdata.frame(recom_pop,decode=true,ratings=true)
user_id , item_id displayed correctly each of 3 alternatives
rec_ib <- recommender(r[1:100],method="ibcf", param=list(normalize = "z-score",method="jaccard",minrating=1)) #rec_ib recom_ib <- predict(rec_ib, jester5k[1001:1002], n=100, type="ratings") #recom_ib as(recom_ib, "matrix") getlist(recom_ib,decode=true,ratings=true) getdata.frame(recom_ib,decode=true,ratings=true)
user_id , item_id displayed correctly each of 3 alternatives
rec_ub <- recommender(r[1:400],method="ubcf", param=list(normalize = "z-score",method="cosine",nn=5, minrating=1)) #rec_ub recom_ub <- predict(rec_ub, jester5k[1001:1002], n=100, type="ratings") #recom_ub as(recom_ub, "matrix") getlist(recom_ub,decode=true,ratings=true) getdata.frame(recom_ub,decode=true,ratings=true)
item _id displayed correctly , can't user_id none of 3 alternatives... how can user_id ?am doing wrong? i'll appreciate spot mistake.
this bug seems fixed now.
Comments
Post a Comment