htd {HEMDAG} | R Documentation |
HTD-DAG
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
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 |
root |
name of the class that it is the top-level of the hierarchy ( |
Details
The HTD-DAG
algorithm modifies the flat scores according to the hierarchy of a DAG through a unique run across
the nodes of the graph. For a given example
, the flat predictions
are hierarchically corrected to
, by per-level visiting the nodes of the DAG from top to bottom according to the following simple rule:
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
data(graph);
data(scores);
root <- root.node(g);
S.htd <- htd(S,g,root);