Build ancestor matrix aligned with observed outcome classes
Source:R/hardhat.R
build_ancestor_matrix_from_outcomes.RdExtracts class names from the outcome tibble (factor levels) and builds the ancestor matrix only for classes that actually appear in the data.
Arguments
- x
A
data.tree::Nodeobject.- outcomes
A tibble with factor columns (one per hierarchy level), as returned by
hardhat::mold()$outcomes.- device
Torch device ("cpu" or "cuda").