xvalReco: Cross Validation

Description Usage Arguments Details Value Author(s) Examples

Description

Cross-validation for the various methods in this package, with parallel computation capability in some cases.

Usage

1
2
3
4
5
6
7
8
9
        xvalMM(ratingsIn, trainprop = 0.5, regressYdots = FALSE, minN = 0)
        xvalMLE(ratingsIn, trainprop = 0.5, cls = NULL) 
	xvalReco(ratingsIn, trainprop = 0.5,cls = NULL,rnk = 10)
        xvalCos(ratingsIn, k, usrCovs = NULL, itmCats = NULL, wtcovs = NULL, 
           wtcats = NULL, trainprop = 0.5)
        xvalMultiplic(ratingsIn) 
	getTrainSet(ratingsIn,trainprop)
	getTestSet(ratingsIn,trainSet)
        plot.xvalb(xvalObj,whichIdxs=NULL)

Arguments

ratingsIn

Input data frame. Within-row format is UserID, ItemID, rating

minN

Applies to situations in which covariates are present. In predicting for user i, then either Yi. or the regression-based prediction will be used, depending on whether N_i >= minN.

trainprop

The fraction of ratingsIn we want to use for our training set

cls

R paralell cluster.

regressYdots

If TRUE, allow for different weights on alpha and beta; see documentation for findYdotsMM.

rnk

Desired rank for recosystem analysis.

xvalObj

An object of class 'xvalb'.

whichIdxs

A vector of indices of rows of the test set to be used in plotting.

Details

These functions perform cross-validation using the various methods in this package. A number of measures of prediction accuracy are output (see Value), including comparison to accuracy obtained by simply predicting by a constant, thus enabling one to ask the question, Are we predicting better with our model than by chance?

The functions getTrainSet and getTestSet are helper functions to generate the training and test sets.

The function plot.xvalb is a method for the generic function plot. It plots the estimated density of the predicted ratings, and a smoothed scatter plot of the predicted ratings against the actual ones. If whichIdxs is specified, the user can choose to plot only a subset of the data, say rows corresponding to large values of a covariate.

Value

The xval functions return an object of class 'xvalb', with the following components:

The acc component is an R list with these elements:

Author(s)

Pooja Rajkumar and Norm Matloff

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
       ivl <- InstEval 
       ivl$s <- as.numeric(ivl$s) 
       ivl$d <- as.numeric(ivl$d) 
       ivlsdy <- ivl[,c(1,2,7)]
       # Test for xvalReco
       res <- xvalReco(ivlsdy)
      # Get accuracy of xvalReco test
       res$acc	
       xvoutmm <- xvalMM(ivlsdy) 
       xvoutmm$acc
       # plot(xvoutmm)  
       xvoutcos5 <- xvalCos(ivlsdy,5)  # takes time
       xvoutcos5$acc

Pooja-Rajkumar/rectools documentation built on May 8, 2019, 2:56 p.m.