Book Image

Building a Recommendation System with R

Book Image

Building a Recommendation System with R

Overview of this book

Table of Contents (13 chapters)
Building a Recommendation System with R
Credits
About the Authors
About the Reviewer
www.PacktPub.com
Preface
References
Index

Evaluating and optimizing the model


This section will show you how to evaluate the performance of our recommender. Starting from the evaluation, we can try some parameter configurations and choose the one performing the best. For more details, see Chapter 4, Evaluating the Recommender Systems.

The following are the steps to evaluate and optimize the model:

  • Build a function that evaluates the model given a parameter configuration

  • Use the function to test different parameter configurations and pick the best one

Let's go through these steps in detail.

Building a function to evaluate the model

This section will show you how to define a function that:

  1. Sets up cross validation using the k-fold.

  2. Builds a hybrid IBCF.

  3. Recommends the items to the users in the test sets.

  4. Evaluates the recommendation.

The inputs of our function are as follows:

  • Data: This is the rating matrix table with the item description

  • k-fold parameters: This is the number of folds, the number of items to keep in the test set

  • Model parameters...