O'Reilly logo

R Data Analysis Cookbook - Second Edition by Kuntal Ganguly

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

Identifying a suitable model

In order to evaluate various models properly, we need to test them by varying the number of items or movies:

  1. Store each model in a list with its name and parameters and then define the number of recommendation items for each user:
> models_to_evaluate <- list( IBCF_cos = list(name = "IBCF", param = list(method = "cosine")), IBCF_cor = list(name = "IBCF", param = list(method = "pearson")), UBCF_cos = list(name = "UBCF", param = list(method = "cosine")), UBCF_cor = list(name = "UBCF", param = list(method = "pearson")), random = list(name = "RANDOM", param=NULL) )> n_recommendations <- c(1, 5, seq(10, 100, 10)) 
  1. Run and evaluate the models:
> list_results <- evaluate(x = eval_sets, method = models_to_evaluate, ...

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required