Preparing the data to evaluate the models
To evaluate models, you need to build them with some data and test them on some other data. This chapter will show you how to prepare the two sets of data. The recommenderlab
package contains prebuilt tools that help in this task.
The target is to define two datasets, which are as follows:
Training set: These are the models from which users learn
Testing set: These are the models that users apply and test
In order to evaluate the models, we need to compare the recommendations with the user preferences. In order to do so, we need to forget about some user preferences in the test set and see whether the techniques are able to identify them. For each user in the test set, we ignore some purchases and build the recommendations based on the others. Let's load the packages:
library(recommenderlab) library(ggplot2)
The data-set that we will use is called MovieLense
. Let's define ratings_movies
containing only the most relevant users and movies:
data(MovieLense...