Methods to apply on objects of class ClientRecommender
behave similarly for the user. Both are classes which
provide the interface with the recommendation engine of
Myrrix, which is either running locally or in a
The methods which can be applied on this recommendation engine are
If Myrrix is running locally, you can set the hyperparameters of the recommendation engine which are set in java system variables and are used by Myrrix. This can be done by using the provided methods
getMyrrixHyperParameters. A full description of
these hyperparamters which influence the model are listed
An object of class
a user id for which to make the recommendation
a vector of item id's for which to make the recommendation
a list of hyperparameters to set for building the recommendation engine. Where the names of the list elements need to be part of the specified hyperparameters below. See the examples.
a character vector of names of hyperparameters to obtain the values. See the examples.
an integer indicating how many popular
items you want in the call to
other arguments passed on to the methods
Set a list of hyperparameters for building and tuning the recommendation engine
Get a list of hyperparameters which is currently used for building and tuning the recommendation engine
Get a list of hyperparameters which is currently used for building and tuning the recommendation engine, limited to the parameters specified
Wait until the model is finished
Get all item id's known to the model
Get all user id's known to the model
estimatePreference(ClientRecommender/ServerRecommender, userID, itemIDs):
Score a user for different items alongside the recommendation engine
Get the most popular items
recommend(ClientRecommender/ServerRecommender, userID, howMany):
Recommend a number of items to a specific user
A hard limit of the number of iterations that will run in one build. Defaults to 30.
Number of features to use when creating the matrix factorization. Defaults to 30.
Estimated strength values in the original matrix change a little after each iteration, and less over time. If average absolute change in estimates is below this threshold, iteration will stop. Defaults to 0.001.
Controls the lambda overfitting parameter in the ALS algorithm. Defaults to 0.01
Controls the alpha parameter in the ALS algorithm. Defaults to 40
If true, does not store in memory items that each user is already associated to. This saves memory, but means that the recommender does not remember which items the user is already associated to. These can't be automatically removed from consideration as recommendations. This is desirable behavior in some contexts. To use this, the considerKnownItems argument to recommend must be true. mostPopularItems will also not work with this flag enabled. Not recommended in general. Defaults to false.
Sets the number of new data points written to the model that will trigger a model rebuild. Only applies to stand-alone mode. Defaults to 10000.
Sets the number of new data points written to the model that will trigger an upload of local data to the distributed storage system. Only applies to distributed mode. Defaults to 50000
Enables locality-sensitive hashing to speed up the /recommend method, at the cost of accuracy. Set to a value in (0,1]; LSH is disabled unless set to a value less than 1. Recommended values are less than 0.1. This feature is experimental. Defaults to 1.0
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36
## ## 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, itemIDs=items[1:20]) mostPopularItems(recommendationengine, howMany=10L) recommend(recommendationengine, userID=users, howMany=10L) ## End(Not run)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.