ratingness,covratingness,getML100K,getInstEval | R Documentation |
Miscellaneous utility functions.
ratingness(ratingsIn,splitCol) covratingness(ratingsIn,splitCol) getInstEval()
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. |
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.
Norm Matloff
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
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.