Learn R Programming

reco (version 0.2.0.4)

ap_k: Ranking Metrics for Top-K Items

Description

ap_k calculates Average Precision at K (ap@k). Please refer to https://en.wikipedia.org/wiki/Information_retrieval#Average_precision

ndcg_k() calculates Normalized Discounted Cumulative Gain at K (ndcg@k). Please refer to https://en.wikipedia.org/wiki/Discounted_cumulative_gain#Normalized_DCG

Usage

ap_k(predictions, actual, ...)

ndcg_k(predictions, actual, ...)

Arguments

predictions

matrix of predictions. Predctions can be defined 2 ways:

  1. predictions = integer matrix with item indices (correspond to column numbers in actual)

  2. predictions = character matrix with item identifiers (characters which correspond to colnames(actual)) which has attribute "indices" (integer matrix with item indices which correspond to column numbers in actual).

actual

sparse Matrix of relevant items. Each non-zero entry considered as relevant item. Value of the each non-zero entry considered as relevance for calculation of ndcg@k. It should inherit from Matrix::sparseMatrix. Internally Matrix::RsparseMatrix is used.

...

other arguments (not used at the moment)