Learn R Programming

HEMDAG (version 2.1.3)

PXR: Precision at fixed Recall level

Description

Function to compute the Precision at fixed Recall levels (PXR) over classes through PerfMeas package

Usage

PXR.at.multiple.recall.levels.over.classes(target, pred, rec.levels = seq(from
  = 0.1, to = 1, by = 0.1), folds = NULL, seed = NULL)

Arguments

target

matrix with the target multilabels: rows correspond to examples and columns to classes. \(target[i,j]=1\) if example \(i\) belongs to class \(j\), \(target[i,j]=0\) otherwise.

pred

a numeric matrix with predicted values (scores): rows correspond to examples and columns to classes.

rec.levels

a vector with the desired recall levels (def: from:0.1, to:0.9, by:0.1)

folds

number of folds on which computing the AUROC. If folds=NULL (def.), the one-shot AUROC is computed, otherwise the AUROC is computed averaged across folds.

seed

initialization seed for the random generator to create folds. Set seed only if folds\(\neq\)NULL. If seed\(\neq\)NULL and folds=NULL, the AUROC averaged across folds is computed without seed initialization.

Value

a list with two elements:

  1. average: a vector with the the average precisions at different recall levels across classes

  2. per.class: a matrix with the precisions at different recall levels: rows are classes, columns precisions at different recall level

Details

The PXR across all classes is computed either one-shot or averaged across stratified folds.

Function to compute the precision at fixed recall levels across all classes either one-shot or averaged across stratified folds

Names of rows and columns of target and pred matrix must be provided in the same order, otherwise a stop message is returned

Examples

Run this code
# NOT RUN {
data(labels);
data(scores);
data(graph);
root <- root.node(g);
L <- L[,-which(colnames(L)==root)];
S <- S[,-which(colnames(S)==root)];
rec.levels <- seq(from=0.1, to=1, by=0.1);
PXR <- PXR.at.multiple.recall.levels.over.classes(L, S, rec.levels=rec.levels, folds=5, seed=23);
# }

Run the code above in your browser using DataLab