trainMOA.MOA_recommender {RMOA} | R Documentation |
Train a MOA recommender (e.g. a BRISMFPredictor) on a datastream
Description
Train a MOA recommender (e.g. a BRISMFPredictor) on a datastream
Usage
## S3 method for class 'MOA_recommender'
trainMOA(model, formula, data, subset,
na.action = na.exclude, transFUN = identity, chunksize = 1000,
trace = FALSE, options = list(maxruntime = +Inf), ...)
Arguments
model |
an object of class |
formula |
a symbolic description of the model to be fit. This should be of the form rating ~ userid + itemid, in that sequence.
These should be columns in the |
data |
an object of class |
subset |
an optional vector specifying a subset of observations to be used in the fitting process. |
na.action |
a function which indicates what should happen when the data contain |
transFUN |
a function which is used after obtaining |
chunksize |
the number of rows to obtain from the |
trace |
logical, indicating to show information on how many datastream chunks are already processed
as a |
options |
a names list of further options. Currently not used. |
... |
other arguments, currently not used yet |
Value
An object of class MOA_trainedmodel which is a list with elements
model: the updated supplied
model
object of classMOA_recommender
call: the matched call
na.action: the value of na.action
terms: the
terms
in the modeltransFUN: the transFUN argument
See Also
MOA_recommender
, datastream_file
, datastream_dataframe
,
datastream_matrix
, datastream_ffdf
, datastream
,
predict.MOA_trainedmodel
Examples
require(recommenderlab)
data(MovieLense)
x <- getData.frame(MovieLense)
x$itemid <- as.integer(as.factor(x$item))
x$userid <- as.integer(as.factor(x$user))
x$rating <- as.numeric(x$rating)
x <- head(x, 5000)
movielensestream <- datastream_dataframe(data=x)
movielensestream$get_points(3)
ctrl <- MOAoptions(model = "BRISMFPredictor", features = 10)
brism <- BRISMFPredictor(control=ctrl)
mymodel <- trainMOA(model = brism, rating ~ userid + itemid,
data = movielensestream, chunksize = 1000, trace=TRUE)
summary(mymodel$model)