Description Usage Arguments Details Author(s) Examples
In recommender system data, some users are more active raters than others, i.e. they rate more items than do others. These simple functions facilitate taking "ratingness" into account, say as a covariate.
1 2 | ratingness(ratingsIn,splitCol)
covratingness(ratingsIn,splitCol)
|
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 fact that some users rate more items may be useful, say as a
predictor. A typical usage of the latter is to call
covratingness
and then append the result to the input data
frame.
Norm Matloff
1 2 3 4 5 6 7 | 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.