| rectools-package | R Documentation |
Toolbox for recommender systems, including novel methods, plotting, parallel computation, and so on.
| Package: | rectools |
| Type: | Package |
| Version: | 1.0.0 |
| Date: | 2016-10-29 |
| License: | GPL (>= 2) |
Raw input data:
Standard form, one row per rating, with first three columns being user ID, item ID and rating, followed by optional covariates. Note: Most functions assume that user and item IDs are numbered consecutively, starting at 1.
List of major functions:
matrix factorization model (MFM):
trainReco(): fit MFM
predict.Reco(): predict from MFM
xvalReco(): cross-validation evaluation of MFM
statistical random effects additive model:
trainMLE(): fit Max. Likelihood model
trainMM(): fit Method of Moments model
trainMLE(): alias for trainMLE()
trainMM(): alias for trainMM()
predict.ydotsMLE(): predict from MLE
predict.ydotsMM(): predict from MM
xvalMLE): cross-validation of MLE
xvalMM): cross-validation of MM
findMultiplicYdots(): fit multiplicative MM model, binary Y
statistical random effects multiplicative model:
trainMultiplicYdots(): fit mult. model for binary Y
predict.MMmultiplic(): predict from that model
k-nearest neighbor model:
formUserData(): aggregate items for each user, etc.
cosDist(): calculates cosine distance on users with certain
item patterns
predict.usrData(): predict using kNN
misc.:
focusGrp(): finds a "focus group," i.e. some "representative" users
ratingness(): find number of ratings for each user or
number of users per rating
covratingness(): for each row of the raw input data
# try lme4 data set InstEval, needs some prep first. data(InstEval) ivl <- InstEval # convert factors to numeric: ivl$s <- as.numeric(ivl$s) ivl$d <- as.numeric(ivl$d) ivl$studage <- as.numeric(ivl$studage) ivl$lectage <- as.numeric(ivl$lectage) ivl$service <- as.numeric(ivl$service) # make correct format, and choose covs: ivl <- ivl[,c(1,2,7,3:6)] # create dummy variables in place of dept: library(dummies) dms <- dummy(ivl$dept) dms <- as.data.frame(dms) dms$dept2 <- NULL ivl$dept <- NULL ivl <- cbind(ivl,dms) # run the training data, no covariates: # ydout <- trainMM(ivl[,1:3]) ydout <- trainMM(ivl[,1:3]) # form a test set to illustrate prediction: testSet <- ivl[c(3,8),] # these happen to be students 1, 3 # say want to predict how well students 1 and 3 would like instructor 12 testSet[1,2] <- 12 testSet[2,2] <- 12 # predict: predict(ydout,testSet[,1:2]) # try using the covariates: # ydout <- trainMM(ivl) ydout <- trainMM(ivl) predict(ydout,testSet[,-3])
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.