Learn R Programming

recosystem (version 0.2.5)

train: Train a Recommender Model

Description

This method is a member function of class "RecoSys" that trains a recommender model. It will create a model file in the specified directory, containing necessary information for prediction. Training data must have already been converted into binary form through $convert_train() before calling this method.

The common usage of this method is r = Reco() r$train(outdir, opts, verbose = TRUE)

Arguments

r
Object returned by Reco()
outdir
Directory in which the model file will be generated. If missing, tempdir() will be used.
opts
Various options and tuning parameters in the model training procedure. See section Options and Parameters for details.
verbose
Whether to show detailed information. Default is TRUE.

References

LIBMF: A Matrix-factorization Library for Recommender Systems. http://www.csie.ntu.edu.tw/~cjlin/libmf/

Y. Zhuang, W.-S. Chin, Y.-C. Juan, and C.-J. Lin. A Fast Parallel Stochastic Gradient Method for Matrix Factorization in Shared Memory Systems. Technical report 2014.

See Also

convert, output, predict

Examples

Run this code
set.seed(123) # this is a randomized algorithm
trainset = system.file("dat", "smalltrain.txt", package = "recosystem")
testset = system.file("dat", "smalltest.txt", package = "recosystem")
r = Reco()
r$convert_train(trainset)
r$convert_test(testset)
r$train(opts = list(dim = 80, cost.p = 0.01, cost.q = 0.01))
print(r)

Run the code above in your browser using DataLab