createRatingsModel
This operator makes automatic predictions (filtering) about the interests of a user by collecting preferences or taste information from many users (collaborating). The underlying assumption of the collaborative filtering approach is that if a person A has the same opinion as a person B on an issue, A is more likely to have B's opinion on a different issue than that of a randomly chosen person. For example, a collaborative filtering recommendation system for television tastes could make predictions about which television show a user should like given a partial list of that user's tastes (likes or dislikes). Note that these predictions are specific to the user, but use information gleaned from many users.
Operator Usage in Easy Mode
- Click + on the parent node.
- Enter Create Ratings Model operator in the search field and select the operator from the Results to open the operator form.
- In the Table drop-down, enter or select the table to create a model.
- In the Model Name field, enter the name of the model to store it in a particular location.
- In the Users Column drop-down, enter or select a usernames column.
- In the Items Column drop-down, enter or select a column to create a column.
- In the Ratings Column, enter or select a column.
- Click Run to view the result.
- Click Save to add the operator to the playbook.
- Click Cancel to discard the operator form.
Usage Details
```scala LQL Command createRatingModel(table, modelName, user, item, rating) // table: input table // modelName: name of a model to store // user: username column or you can treat is as field1 // item: item column e.g. field2 // rating: rating column (numeric), e.g. metric column // This operator will create a model that will learn rating of the metric field based on collaborative filtering and will store it as a "modelName" file name that was provided by user predictRating(table, modelName, user, item) //table: input table //modelName: name of the model that was given during createRatingModel operator //user: username column e.g. field1 //item: item column e.g. field2 // This operator will create a "prediction" column which is the prediction of rating based on the (username, item) from the training dataset.
In layman's term, if there are users with similar behaviors in the training dataset, extract information and apply them to find the rating. ## Example **Input** trainingTable <style> th { border: 1px solid #cccccc; background-color: #eeeeee; padding: 8px 5px 8px 5px; text-align: left } </style> <div><table> <thead> <tr> <th>username</th> <th>movie</th> <th>rating</th> </tr> </thead> <tbody> <tr><td>emil</td><td>Titanic</td><td>5.0</td></tr> <tr><td>emil</td><td>Brave Heart</td><td>4.0</td></tr> <tr><td>emil</td><td>Red Wings</td><td>1.0</td></tr> <tr><td>kumar</td><td>Titanic</td><td>4.0</td></tr> <tr><td>kumar</td><td>Brave Heart</td><td>4.0</td></tr> </tbody> </tr> </table></div> testTable <div><table> <thead> <tr> <th>username</th> <th>movie</th> <th>rating </tr> </thead> <tbody> <tr><td>kumar</td><td>Red Wings</td><td>1.0</td></tr> </tbody> </tr> </table></div> ```scala LQL command createRatinsModel(trainingTable, "ratingModel", "username", "movie", "rating") // output of this should say that it successfully created the model result = predictRating(testTable, "ratingModel", "username", "movie") // result should contain "prediction" column, and the value should be between 0.0 and 2.0 // since Emil and Kumar have rated similarly for previous two movies, so Kumar more likely will rate third movie similar to emil's rating where emil rated it as 1.0
Output
username | movie | prediction |
---|---|---|
kumar | Red Wings | 1.0 |