fmax: Compute Fmax

Description Usage Arguments Details Value Examples

Description

Compute the best hierarchical Fmax either one-shot or averaged across folds

Usage

1
2
3
4
5
6
7
8
9
compute.fmax(
  target,
  predicted,
  n.round = 3,
  verbose = TRUE,
  b.per.example = FALSE,
  folds = NULL,
  seed = NULL
)

Arguments

target

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

predicted

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

n.round

number of rounding digits to be applied to predicted (default=3).

verbose

a boolean value. If TRUE (def.) the number of iterations are printed on stdout.

b.per.example

a boolean value.

  • TRUE: results are returned for each example;

  • FALSE: only the average results are returned;

folds

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

seed

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

Details

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

Value

Two different outputs respect to the input parameter b.per.example:

Examples

1
2
3
4
5
6
7
data(graph);
data(labels);
data(scores);
root <- root.node(g);
L <- L[,-which(colnames(L)==root)];
S <- S[,-which(colnames(S)==root)];
fmax <- compute.fmax(L, S, n.round=3, verbose=TRUE, b.per.example=TRUE, folds=5, seed=23);

HEMDAG documentation built on Feb. 12, 2021, 5:13 p.m.