hierarchical.checkers: Hierarchical constraints checker

hierarchical.checkersR Documentation

Hierarchical constraints checker

Description

Check if the true path rule is violated or not. In other words this function checks if the score of a parent or an ancestor node is always larger or equal than that of its children or descendants nodes.

Usage

check.hierarchy.single.sample(y.hier, g, root = "00")

check.hierarchy(S.hier, g, root = "00")

Arguments

y.hier

vector of scores relative to a single example. It must be a named numeric vector (names are functional classes).

g

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

root

name of the class that is on the top-level of the hierarchy (def. root="00").

S.hier

the matrix with the scores of the classes corrected in according to hierarchy. It must be a named matrix: rows are examples and columns are functional classes.

Value

A list of 3 elements:

  • status:

    • OK if none hierarchical constraints have bee broken;

    • NOTOK if there is at least one hierarchical constraints broken;

  • hierarchy_constraints_broken:

    • TRUE: example did not respect the hierarchical constraints;

    • FALSE: example broke the hierarchical constraints;

  • hierarchy_constraints_satisfied: how many terms satisfied the hierarchical constraint;

Examples

data(graph);
data(scores);
root <- root.node(g);
S.hier <- htd(S,g,root);
S.hier.single.example <- S.hier[sample(ncol(S.hier),1),];
check.hierarchy.single.sample(S.hier.single.example, g, root=root);
check.hierarchy(S.hier, g, root);

marconotaro/hemdag documentation built on Nov. 21, 2024, 10:05 p.m.