build_ancestor_matrix_from_outcomes: Build ancestor matrix aligned with observed outcome classes

View source: R/hardhat.R

build_ancestor_matrix_from_outcomesR Documentation

Build ancestor matrix aligned with observed outcome classes

Description

Extracts class names from the outcome tibble (factor levels) and builds the ancestor matrix only for classes that actually appear in the data.

Usage

build_ancestor_matrix_from_outcomes(x, outcomes, device = "cpu")

Arguments

x

A data.tree::Node object.

outcomes

A tibble with factor columns (one per hierarchy level), as returned by hardhat::mold()$outcomes.

device

Torch device ("cpu" or "cuda").

Value

A torch_tensor of shape ⁠(1, n_classes, n_classes)⁠.


tabnet documentation built on July 22, 2026, 9:06 a.m.