realRatingMatrix

0th

Percentile

Class "realRatingMatrix": Real-valued Rating Matrix

A matrix containing ratings (typically 1-5 stars, etc.).

Keywords
classes

Objects from the Class

Objects can be created by calls of the form new("realRatingMatrix", data = m), where m is sparse matrix of class dgCMatrix in package Matrix or by coercion from a regular matrix, a data.frame containing user/item/rating triplets as rows, or a sparse matrix in triplet form (dgTMatrix in package Matrix).

Slots

Extends

Class "ratingMatrix", directly.

Methods

See Also

See ratingMatrix inherited methods,

binaryRatingMatrix, topNList, getList and getData.frame. Also see dgCMatrix, dgTMatrix and ngCMatrix in Matrix.

Aliases
  • realRatingMatrix-class
  • realRatingMatrix
  • coerce,matrix,realRatingMatrix-method
  • coerce,realRatingMatrix,matrix-method
  • coerce,realRatingMatrix,dgTMatrix-method
  • coerce,dgTMatrix,realRatingMatrix-method
  • coerce,realRatingMatrix,ngCMatrix-method
  • coerce,realRatingMatrix,dgCMatrix-method
  • coerce,dgCMatrix,realRatingMatrix-method
  • coerce,data.frame,realRatingMatrix-method
  • coerce,realRatingMatrix,data.frame-method
  • rowSds
  • rowSds,realRatingMatrix-method
  • colSds
  • colSds,realRatingMatrix-method
  • binarize
  • binarize,realRatingMatrix-method
  • removeKnownRatings
  • removeKnownRatings,realRatingMatrix-method
  • [<-,realRatingMatrix,ANY,ANY,ANY-method
Examples
## create a matrix with ratings
m <- matrix(sample(c(NA,0:5),100, replace=TRUE, prob=c(.7,rep(.3/6,6))),
	nrow=10, ncol=10, dimnames = list(
	    user=paste('u', 1:10, sep=''),
	    item=paste('i', 1:10, sep='')
    ))
m

## coerce into a realRatingMAtrix
r <- as(m, "realRatingMatrix")
r

## get some information
dimnames(r)
rowCounts(r)
colCounts(r)
rowMeans(r)


## histogram of ratings
hist(getRatings(r), breaks="FD")

## inspect a subset
image(r[1:5,1:5])

## coerce it back to see if it worked
as(r, "matrix")

## coerce to data.frame (user/item/rating triplets)
as(r, "data.frame")

## binarize into a binaryRatingMatrix with all 4+ rating a 1
b <- binarize(r, minRating=4)
b
as(b, "matrix")
Documentation reproduced from package recommenderlab, version 0.2-1, License: GPL-2

Community examples

Looks like there are no examples yet.