Description
The KNNRecommender function trains a interpolation weight model based on weighted collaborative filtering approach. It uses the input user ratings data to create three model tables: the weights model table, the bias model table and the optional nearest items or neighbors table. These tables are then used to predict the ratings or preferences that users assign to entities like books, songs, movies, and other products.
Usage
td_knn_recommender_mle (
rating.table = NULL,
userid.column = NULL,
itemid.column = NULL,
rating.column = NULL,
k = 20,
learning.rate = 0.001,
max.iternum = 10,
threshold = 2.0E-4,
item.similarity = "Pearson",
rating.table.sequence.column = NULL
)
Arguments
rating.table |
Required Argument. |
userid.column |
Optional Argument. |
itemid.column |
Optional Argument. |
rating.column |
Optional Argument. |
k |
Optional Argument. |
learning.rate |
Optional Argument. |
max.iternum |
Optional Argument. |
threshold |
Optional Argument. |
item.similarity |
Optional Argument. |
rating.table.sequence.column |
Optional Argument. |
Value
Function returns an object of class "td_knn_recommender_mle" which is
a named list containing objects of class "tbl_teradata".
Named list members can be referenced directly with the "$" operator
using the following names:
weight.model.table
-
bias.model.table
nearest.items
output
Examples
# Get the current context/connection
con <- td_get_context()$connection
# Load example data.
loadExampleData("knnrecommender_example", "ml_ratings")
# The ml_ratings table has movie ratings from 50 users on
# approximately 2900 movies, with an average of about 150 ratings
# for each user. The 10 possible ratings range from 0.5 to 5
# in steps of 0.5. A higher number indicates a better rating.
ml_ratings <- tbl(con, "ml_ratings")
# Example 1 - Train the KNN Recommender system on the user ratings data
td_knn_recommender_out <- td_knn_recommender_mle(rating.table = ml_ratings,
userid.column = "userid",
itemid.column = "itemid",
rating.column = "rating"
)