You can compare multiple algorithms using an evaluationScheme. This involves defining a scheme (e.g., 10-fold cross-validation), specifying the algorithms and their parameters, and then calling evaluate().
# Define the evaluation scheme
scheme <- evaluationScheme(MovieLense100, method = "cross-validation", k = 10,
given = -5, goodRating = 4)
# Define algorithms to compare
algorithms <- list(
"random items" = list(name = "RANDOM", param = NULL),
"popular items" = list(name = "POPULAR", param = NULL),
"user-based CF" = list(name = "UBCF", param = list(nn = 3)),
"item-based CF" = list(name = "IBCF", param = list(k = 100))
)
# Run evaluation for top-N lists of different lengths
results <- evaluate(scheme, algorithms, type = "topNList",
n = c(1, 3, 5, 10), progress = FALSE)
# Plot the results
plot(results, annotate = 2, legend = "topleft")
scheme <- evaluationScheme(MovieLense100, method = "cross-validation", k = 10,
given = -5, goodRating = 4)
algorithms <- list(
"random items" = list(name = "RANDOM", param = NULL),
"popular items" = list(name = "POPULAR", param = NULL),
"user-based CF" = list(name = "UBCF", param = list(nn = 3)),
"item-based CF" = list(name = "IBCF", param = list(k = 100))
)
results <- evaluate(scheme, algorithms, type = "topNList",
n=c(1, 3, 5, 10), progress = FALSE)
plot(results, annotate = 2, legend = "topleft")