Collaborative Filtering

crs(dataset, id, prod, pred, rate, data_filter = "", envir = parent.frame())

Arguments

dataset

Dataset

id

String with name of the variable containing user ids

prod

String with name of the variable with product ids

pred

Products to predict for

rate

String with name of the variable with product ratings

data_filter

Expression entered in, e.g., Data > View to filter the dataset in Radiant. The expression should be a string (e.g., "training == 1")

envir

Environment to extract data from

Value

A data.frame with the original data and a new column with predicted ratings

Details

See https://radiant-rstats.github.io/docs/model/crs.html for an example in Radiant

See also

summary.crs to summarize results

plot.crs to plot results if the actual ratings are available

Examples

crs(ratings, id = "Users", prod = "Movies", pred = c("M6", "M7", "M8", "M9", "M10"), rate = "Ratings", data_filter = "training == 1") %>% str()
#> List of 16 #> $ recommendations:'data.frame': 5 obs. of 8 variables: #> ..$ Users : Factor w/ 11 levels "U1","U2","U3",..: 11 11 11 11 11 #> ..$ product : Factor w/ 5 levels "M6","M7","M8",..: 1 2 3 4 5 #> ..$ rating : int [1:5] NA NA NA NA NA #> ..$ average : num [1:5] 3.3 2.7 3.5 2.9 4.1 #> ..$ cf : num [1:5] 4.1 2.08 1.7 2.13 2.71 #> ..$ ranking : int [1:5] NA NA NA NA NA #> ..$ avg_rank: int [1:5] 3 5 2 4 1 #> ..$ cf_rank : int [1:5] 1 4 5 3 2 #> $ rcf :'data.frame': 1 obs. of 6 variables: #> ..$ Users: Factor w/ 11 levels "U1","U2","U3",..: 11 #> ..$ M6 : int 1 #> ..$ M7 : int 4 #> ..$ M8 : int 5 #> ..$ M9 : int 3 #> ..$ M10 : int 2 #> $ cf :'data.frame': 1 obs. of 6 variables: #> ..$ Users: Factor w/ 11 levels "U1","U2","U3",..: 11 #> ..$ M6 : num 4.1 #> ..$ M7 : num 2.08 #> ..$ M8 : num 1.7 #> ..$ M9 : num 2.13 #> ..$ M10 : num 2.71 #> $ rank : int [1, 1:5] 1 4 5 3 2 #> ..- attr(*, "dimnames")=List of 2 #> .. ..$ : chr "11" #> .. ..$ : NULL #> $ ract :'data.frame': 1 obs. of 6 variables: #> ..$ Users: Factor w/ 11 levels "U1","U2","U3",..: 11 #> ..$ M6 : int NA #> ..$ M7 : int NA #> ..$ M8 : int NA #> ..$ M9 : int NA #> ..$ M10 : int NA #> $ act :'data.frame': 1 obs. of 6 variables: #> ..$ Users: Factor w/ 11 levels "U1","U2","U3",..: 11 #> ..$ M6 : int NA #> ..$ M7 : int NA #> ..$ M8 : int NA #> ..$ M9 : int NA #> ..$ M10 : int NA #> $ ravg :'data.frame': 1 obs. of 5 variables: #> ..$ M6 : int 3 #> ..$ M7 : int 5 #> ..$ M8 : int 2 #> ..$ M9 : int 4 #> ..$ M10: int 1 #> $ avg :'data.frame': 1 obs. of 5 variables: #> ..$ M6 : num 3.3 #> ..$ M7 : num 2.7 #> ..$ M8 : num 3.5 #> ..$ M9 : num 2.9 #> ..$ M10: num 4.1 #> $ evar : chr [1:9] "M2" "M3" "M4" "M5" ... #> $ df_name : chr "ratings" #> $ vars : chr [1:9] "M2" "M3" "M4" "M5" ... #> $ id : chr "Users" #> $ prod : chr "Movies" #> $ pred : chr [1:5] "M6" "M7" "M8" "M9" ... #> $ rate : chr "Ratings" #> $ data_filter : chr "training == 1" #> - attr(*, "class")= chr [1:2] "crs" "list"