utils: Utilities

ratingness,covratingness,getML100K,getInstEvalR Documentation

Utilities

Description

Miscellaneous utility functions.

Usage

ratingness(ratingsIn,splitCol)
covratingness(ratingsIn,splitCol)
getInstEval()

Arguments

ratingsIn

Input data frame. Within-row format is UserID, ItemID, Rating and optional covariates.

splitCol

Column to count ratings for – 1 for user ratings, 2 for item ratings.

Details

The InstEval and 100K MovieLens datasets serve as examples and testbeds for many methods in this package. Since each requires some amount of setup, we encapsulate the setup operations in the getInstEval and getML100K functions.

The fact that some users rate more items may itself be useful as a predictor. Frequent rates, for instance, may be more liberal in their ratings, so this variable may be important to include as a covariate.

A typical usage is to call covratingness and then append the result to the input data frame.

Author(s)

Norm Matloff

Examples

rtin <- data.frame(uid = c(1,3,2,1,2),itemid = c(1,2,1,2,2), rats=c(2,5,3,5,1))
ratingness(rtin,1)  
# returns (2,2,1), meaning that user 1 submitted 2 ratings, etc.
> covratingness(rtin,1)
# returns a 5-element vector, corresponding to the 5 rows of rtin
rtin$nrats <- covratingness(rtin,1)
# now usable as a predictor

matloff/rectools documentation built on March 31, 2022, 12:09 p.m.