validate_terminal_nodes: Validate the output of 'extract_terminal_nodes()'

View source: R/aaa_utils.R

validate_terminal_nodesR Documentation

Validate the output of extract_terminal_nodes()

Description

Boosting backends store their tree structures in opaque containers; a tiny API change can silently produce a malformed leaf matrix (e.g. all zeros), yielding a degenerate dissimilarity matrix without raising any error. This function asserts the shape and type contract so problems surface immediately at extraction time rather than much later, after the C++ co-occurrence call has already produced nonsense.

Usage

validate_terminal_nodes(nodes, data, backend = NA_character_)

Details

Contract: nodes must be a data.frame with nrow(data) rows and at least one column; every column must be coercible to integer; at least one column must contain more than one distinct value.


e2tree documentation built on May 15, 2026, 5:06 p.m.