pxr {HEMDAG} | R Documentation |
Precision-Recall curves
Description
Compute the Precision-Recall (PxR) values through precrec package.
Usage
precision.at.all.recall.levels.single.class(labels, scores)
precision.at.given.recall.levels.over.classes(
target,
predicted,
folds = NULL,
seed = NULL,
recall.levels = seq(from = 0.1, to = 1, by = 0.1)
)
Arguments
labels |
vector of the true labels (0 negative, 1 positive examples). |
scores |
a numeric vector of the values of the predicted labels (scores). |
target |
matrix with the target multilabel: rows correspond to examples and columns to classes.
|
predicted |
a numeric matrix with predicted values (scores): rows correspond to examples and columns to classes. |
folds |
number of folds on which computing the PXR. If |
seed |
initialization seed for the random generator to create folds. Set |
recall.levels |
a vector with the desired recall levels ( |
Details
precision.at.all.recall.levels.single.class
computes the precision at all recall levels just for a single class.
precision.at.given.recall.levels.over.classes
computes the precision at fixed recall levels over classes.
Value
precision.at.all.recall.levels.single.class
returns a two-columns matrix, representing a pair of precision and recall values.
The first column is the precision, the second the recall;
precision.at.given.recall.levels.over.classes
returns a list with two elements:
average: a vector with the average precision at different recall levels across classes;
fixed.recall: a matrix with the precision at different recall levels: rows are classes, columns precision at different recall levels;
Examples
data(labels);
data(scores);
data(graph);
root <- root.node(g);
L <- L[,-which(colnames(L)==root)];
S <- S[,-which(colnames(S)==root)];
labels <- L[,1];
scores <- S[,1];
rec.levels <- seq(from=0.25, to=1, by=0.25);
pxr.single <- precision.at.all.recall.levels.single.class(labels, scores);
pxr <- precision.at.given.recall.levels.over.classes(L, S, folds=5, seed=23,
recall.levels=rec.levels);