Skip to contents

Preferred explicit entry point for the LORT workflow layer. LORT is a non-canonical workflow composition: at each recursive endpoint it runs a full MDSA family scan (cta_descendant_family), selects the min-D member, and recurses until no further structure is found or a compute guard fires. It uses canon CTA/MDSA components but is not itself a canon CTA.exe behavior.

Usage

lort_fit(
  X,
  y,
  w = NULL,
  mc_iter = 5000L,
  mc_seed = 42L,
  mc_stop = 99.9,
  mc_stopup = NA,
  alpha_split = 0.05,
  prune_alpha = 0.05,
  loo = "stable",
  min_n = 30L,
  max_depth = 8L,
  max_nodes = 31L,
  family_max_steps = 20L,
  verbose = FALSE
)

Arguments

X

Data frame or matrix of candidate predictor columns.

y

Integer class variable vector. Must have exactly two distinct values.

w

Optional numeric case-weight vector. Default NULL (unit weights).

mc_iter

Integer; maximum Monte Carlo iterations per node. Default 5000L.

mc_seed

Integer or NULL; RNG seed set once at LORT start. Child-node MDSA scans consume the stream in deterministic right-then-left traversal order without resetting the seed. Default 42L.

mc_stop

Numeric; confidence bound for lower-tail early MC stopping (percent). Default 99.9.

mc_stopup

Numeric; confidence bound for upper-tail early MC stopping (percent). Default NA (disabled; matches MegaODA behavior).

alpha_split

Numeric; node-level significance threshold. Default 0.05.

prune_alpha

Numeric; pruning significance threshold. Default 0.05.

loo

LOO gate mode per node: "off" (no gate), "stable" (MegaODA LOO STABLE; accept when |WESSL - WESS| <= 0.01 pp; default), "pvalue" (Fisher p strictly less than 0.05), or a single numeric in (0, 1) (Fisher p strictly less than the supplied threshold).

min_n

Integer; minimum endpoint n to attempt recursion. Endpoints smaller than min_n become terminal (stop reason "min_n"). Default 30L.

max_depth

Integer; safety cap on recursion depth. Nodes at depth >= max_depth become terminal (stop reason "max_depth"). Default 8L.

max_nodes

Integer; safety cap on total ORT nodes. When node count exceeds max_nodes the current endpoint becomes terminal (stop reason "max_nodes"). Default 31L.

family_max_steps

Integer; maximum MDSA family members evaluated at each recursive node. Default 20L.

verbose

Logical; emit [ORT] progress messages. Default FALSE.

Value

A dual-tagged cta_ort / cta_tree object. cta_ort-aware methods (predict.cta_ort, print.cta_ort, summary.cta_ort, plot.cta_ort, cta_ort_node_table) operate on the full composite tree. ort_settings$method is always "lort".

Details

lort_fit() is functionally equivalent to cta_fit(..., recursive = TRUE). cta_fit(..., recursive = TRUE) is retained as a legacy-compatible alias and will continue to work; prefer lort_fit() for new code. SORT and GORT are reserved and not implemented.

Examples

X <- data.frame(
  A = c(rep(0L, 20), rep(1L, 20), rep(1L, 20)),
  B = c(rep(0L, 20), rep(0L, 20), rep(1L, 20))
)
y <- c(rep(0L, 20), rep(0L, 20), rep(1L, 20))
fit <- lort_fit(X, y, mc_iter = 100L, mc_seed = 42L, loo = "off", min_n = 5L)
print(fit)
#> Locally Optimal Recursive Tree (LORT)
#>   selection: greedy local min-D per recursive node
#>   global optimization: no
#>   SDA anchored: no
#>   Strata: 3 terminal strata
#>   Guards: min_n=5, max_depth=8, max_nodes=31
#>   mc_seed=42, mc_iter=100
#>   Strata consistency check: PASSED
#> 
#> Terminal strata (ascending class-1 proportion):
#>   Stage 1   n=20      prop=1.0000  stop=no_tree     A>0.5 AND B>0.5
#>   Stage 2   n=20      prop=1.0000  stop=no_tree     A>0.5 AND B<=0.5
#>   Stage 3   n=20      prop=1.0000  stop=no_tree     A<=0.5