# NOT RUN {
##
## Set Hyperparameters to tune the Myrrix recommendation engine
##
x <- getMyrrixHyperParameters()
str(x)
setMyrrixHyperParameters(
params=list(model.iterations.max = 10, model.features=30, model.als.lambda=0.1))
x <- getMyrrixHyperParameters(
parameters=c("model.iterations.max","model.features","model.als.lambda"))
str(x)
##
## Build a recommendation model locally
##
# }
# NOT RUN {
inputfile <- file.path(tempdir(), "audioscrobbler-data.subset.csv.gz")
download.file(
url="http://dom2bevkhhre1.cloudfront.net/audioscrobbler-data.subset.csv.gz",
destfile = inputfile)
## Set hyperparameters
setMyrrixHyperParameters(
params=list(model.iterations.max = 2, model.features=10, model.als.lambda=0.1))
x <- getMyrrixHyperParameters(
parameters=c("model.iterations.max","model.features","model.als.lambda"))
str(x)
## Build a model which will be stored in getwd() and ingest the data file into it
recommendationengine <- new("ServerRecommender", localInputDir=getwd())
ingest(recommendationengine, inputfile)
await(recommendationengine)
## Get all users/items and score
items <- getAllItemIDs(recommendationengine)
users <- getAllUserIDs(recommendationengine)
estimatePreference(recommendationengine, userID=users[5], itemIDs=items[1:20])
mostPopularItems(recommendationengine, howMany=10L)
recommend(recommendationengine, userID=users[5], howMany=10L)
# }
Run the code above in your browser using DataLab