Skip to contents

Returns one row per terminal leaf (endpoint) with stable endpoint identifiers and stored node fields suitable for downstream reporting. All values are read directly from stored node fields; no refitting, no prediction, and no recomputation of tree metrics is performed.

Scope: This function reports structural endpoint fields only. It does not include endpoint class counts, target-class proportions, event rates, odds, or staging order. Per-endpoint class counts are available via cta_endpoint_counts. Staging-table and event-rate summaries are available via cta_staging_table.

Usage

cta_endpoint_summary(tree)

Arguments

tree

A cta_tree from oda_cta_fit.

Value

A data.frame with one row per terminal leaf and columns:

endpoint_id

Integer sequential index 1..n in node order.

endpoint_node_id

Integer tree node identifier for this leaf, corresponding to node_id in cta_endpoint_table.

path

Character; AND-joined branch labels from root to this leaf (e.g. "V14<=0.5 AND V15>0.5").

depth

Integer depth from root (root = 1).

terminal_prediction

Integer class label assigned to this endpoint (stored leaf majority_class).

n_obs

Integer raw observation count at this endpoint.

n_weighted

Numeric weighted observation count. Equals n_obs when case weights are not active (not NA).

denominator

Integer endpoint denominator (equal to n_obs); included to align with MPE/MDSA terminology.

For a no-tree fit the returned data frame has zero rows but the correct column structure and types.

Examples

data(mtcars)
X    <- mtcars[, c("cyl", "disp", "hp", "wt")]
y    <- as.integer(mtcars$am)
tree <- oda_cta_fit(X, y, mindenom = 5L, mc_iter = 500L, mc_seed = 42L)
cta_endpoint_summary(tree)
#>   endpoint_id endpoint_node_id     path depth terminal_prediction n_obs
#> 1           1                2  wt>3.18     2                   1    14
#> 2           2                3 wt<=3.18     2                   0    18
#>   n_weighted denominator
#> 1         14          14
#> 2         18          18