Learn R Programming

recommenderlab (version 0.1-9)

evaluate: Evaluate a Recommender Models

Description

Evaluates a single or a list of recommender model given an evaluation scheme.

Usage

evaluate(x, method, ...)

## S3 method for class 'evaluationScheme,character': evaluate(x, method, type="topNList", n=1:10, parameter=NULL, progress = TRUE, keepModel=FALSE) ## S3 method for class 'evaluationScheme,list': evaluate(x, method, type="topNList", n=1:10, parameter=NULL, progress = TRUE, keepModel=FALSE)

Arguments

x
an evaluation scheme (class "evaluationScheme").
method
a character string or a list. If a single character string is given it defines the recommender method used for evaluation. If several recommender methods need to be compared, method contains a nested list. Each element describes a recom
type
evaluate "topNList" or "ratings"?
n
N (number of recommendations) of the top-N lists generated (only if type="topNList").
parameter
a list with parameters for the recommender algorithm (only used when method is a single method).
progress
logical; report progress?
keepModel
logical; store used recommender models?
...
further arguments.

Value

  • Returns an object of class "evaluationResults" or if method is a list an object of class "evaluationResultList".

See Also

evaluationScheme, evaluationResults. evaluationResultList.

Examples

Run this code
### evaluate top-N list recommendations on a 0-1 data set
data("MSWeb")
MSWeb10 <- sample(MSWeb[rowCounts(MSWeb) >10,], 20)

## create an evaluation scheme
es <- evaluationScheme(MSWeb10, method="cross-validation",
        k=4, given=3)

## run evaluation
ev <- evaluate(es, "POPULAR", n=c(1,3,5,10))
ev

## look at the results (by the length of the topNList)
avg(ev)
plot(ev, annotate = TRUE)

## now run evaluate with a list
algorithms <- list(
		RANDOM = list(name = "RANDOM", param = NULL),
		POPULAR = list(name = "POPULAR", param = NULL)
		)

evlist <- evaluate(es, algorithms, n=c(1,3,5,10))
plot(evlist, legend="topright")

## select the first results
evlist[[1]]

### Evaluate using a data set with real-valued ratings
data("Jester5k")
es <- evaluationScheme(Jester5k[1:25], method="cross-validation",
  k=4, given=10, goodRating=5)
## Note: goodRating is used to determine positive ratings

## predict top-N recommendation lists
ev <- evaluate(es, "RANDOM", type="topNList", n=10)
avg(ev)

## predict missing ratings
ev <- evaluate(es, "RANDOM", type="ratings")
avg(ev)

Run the code above in your browser using DataLab