% Generated by roxygen2: do not edit by hand
% Please edit documentation in R/hardhat.R
\name{build_ancestor_matrix_from_outcomes}
\alias{build_ancestor_matrix_from_outcomes}
\title{Build ancestor matrix aligned with observed outcome classes}
\usage{
build_ancestor_matrix_from_outcomes(x, outcomes, device = "cpu")
}
\arguments{
\item{x}{A \code{data.tree::Node} object.}

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

\item{device}{Torch device ("cpu" or "cuda").}
}
\value{
A \code{torch_tensor} of shape \verb{(1, n_classes, n_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.
}
