trainReco,predict.RecoS3,trainRecoPar,predict.RecoS3par | R Documentation |
Convenience wrappers for specific aspects of the recosystem
package, including adding a parallel computation capability.
trainReco(ratingsIn,rnk=10,nmf=FALSE,biasAdjust=FALSE) predict.RecoS3(recoObj,testSet) trainRecoPar(ratingsIn,rnk=10,nmf=FALSE,cls,pqName='PQ') predict.RecoS3par(RecoS3parObj,testSet,cls)
ratingsIn |
Input data frame, training set. Within-row format is (UserID, ItemID, rating). |
rnk |
Desired rank for the matrix factors. |
nmf |
If TRUE, use NMF, otherwise SVD. |
biasAdjust |
If TRUE, subtract from the input ratings the user "biases," which are the "hat(alpha_i)" in trainMM(). |
recoObj |
Object of class |
RecoS3parObj |
Object of class |
testSet |
Data to be predicted, having within-row format (UserID, ItemID, covariates if any). |
The training functions call r$train
on the input data.
The latter function returns several key components, including
the matrices P and Q.
The product PQ' of these two matrices consists of the predicted ratings of all users on all items.
The function predict.RecoS3
is a method for the generic
function predict
.
Pooja Rajkumar, Norm Matloff and Robin Yancey
getInstEval() # note: instructor IDs not consecutive ivl3 <- ivl[,1:3] set.seed(9999) trn <- trainReco(ivl3) onerec <- ivl3[1,] # form dummy 1-rec data frame # how would student 788 would like lecturer 28? onerec$s <- 788 onerec$d <- 12 onerec <- onerec[,-3] predict(trn,onerec) # 2.46
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.