In this section, we will write code based on a physical data schema that we created in the previous section. In this section, we're going to use R scripting to create a recommender machine learning model. We're not going to explain all aspects of the R language but we will go through the elements that are important to build a fully-functioning machine learning model maintained by SQL Server.
In the previous sections, we configured ML Services on SQL Server and we also imported an external package called recommenderlab. The recommenderlab package, as its name suggests, is used for recommendations. The input for the recommender that is provided by this package is a matrix in the form of items in columns, users in rows, and ratings in the matrix itself.
First, we need to gather some data and create a matrix in this...