htd: HTD-DAG

Description Usage Arguments Details Value Examples

View source: R/htd.dag.R

Description

Implementation of the top-down procedure to correct the scores of the hierarchy according to the constraints that the score of a node cannot be greater than a score of its parents.

Usage

1
htd(S, g, root = "00")

Arguments

S

a named flat scores matrix with examples on rows and classes on columns.

g

a graph of class graphNEL. It represents the hierarchy of the classes.

root

name of the class that it is the top-level of the hierarchy (def:00).

Details

The HTD-DAG algorithm modifies the flat scores according to the hierarchy of a DAG G through a unique run across the nodes of the graph. For a given example x, the flat predictions f(x) = \hat{y} are hierarchically corrected to \bar{y}, by per-level visiting the nodes of the DAG from top to bottom according to the following simple rule:

\bar{y}_i := ≤ft\{ \begin{array}{lll} \hat{y}_i & {\rm if} \quad i \in root(G) \\ \min_{j \in par(i)} \bar{y}_j & {\rm if} \quad \min_{j \in par(i)} \bar{y}_j < \hat{y}_i \\ \hat{y}_i & {\rm otherwise} \end{array} \right.

The node levels correspond to their maximum path length from the root.

Value

A matrix with the scores of the classes corrected according to the HTD-DAG algorithm.

Examples

1
2
3
4
data(graph);
data(scores);
root <- root.node(g);
S.htd <- htd(S,g,root);

Example output

HEMDAG: Hierarchical Ensemble Methods for DAG-structured taxonomies
Please cite HEMDAG if you use it: see citation('HEMDAG') for details

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