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

How it works...

Evaluating a model consists of comparing the recommendations with the unknown purchases. We have used three functions in this recipe to split the dataset, evaluate the recommendation model, and measure the accuracy of the model.

The evaluationScheme function of the recommenderlab package is used to split the dataset into training and test sets and has the following parameters:

  • data: This is the initial dataset.
  • method: This is the way to split the data. In this case, it's split.
  • train: This is the percentage of data in the training set.
  • given: This is the number of items to keep.
  • goodRating: This is the rating threshold.
  • k: This is the number of times to run the evaluation.

The calcPredictionAccuracy function is used to ...

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