Description Usage Arguments Details Author(s) Examples
Convenience wrappers for specific aspects of the recosystem
package, adding a parallel computation capability.
1 2 | trainReco(ratingsIn,rnk = 10)
predict.Reco(recoObj,predSet)
|
ratingsIn |
Input data frame, training set. Within-row format is (UserID, ItemID, rating). |
recoObj |
Object of type |
predSet |
Data to be predicted, having within-row format (UserID, ItemID). |
rnk |
Desired rank for the matrix factors. |
The function trainReco
simply calls r$train
on the input
data.
The latter function returns several key components, including:
P: This is the user score matrix, in which a row represents a user, and each column is a latent factor.
Q: This is the item score matrix, in which a row represents an item, and each column is a latent factor.
The product of these two matricies consists of the predicted ratings of all users on all items.
The function predict.Reco
is a method for the generic function
predict
.
Pooja Rajkumar and Norm Matloff
1 2 3 4 5 6 7 8 9 10 11 12 | ivl <- InstEval
ivl$s <- as.numeric(ivl$s)
ivl$d <- as.numeric(ivl$d)
ivl3 <- ivl[,c(1,2,7)]
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 <- 28
onerec <- onerec[,-3]
predict(trn,onerec) # 1.49
|
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.