Extract, threshold, and intersect fixed-gate chain responses
computeActiveByImportance.RdCompose model-specific companion-importance extraction with
activeByImportance() and an optional intersection over supplied preceding
active sets. This convenience wrapper implements only the fixed threshold
policy. chainPipeline() separately applies its fallback and common history
policy around this result.
Arguments
- pathModel
Directory passed to
extractChainImportance().- suffix
Companion suffix passed to extraction and positional response name removal in
activeByImportance().- thresh
Numeric inclusive mean normalized-importance threshold in percentage points. It has no default and is forwarded without validation.
- stableK
Value compared with 1 and used as the number of current plus supplied preceding sets to intersect. It is not coerced or validated here.
- history
List-like object whose final
stableK - 1elements are supplied tointersect()after the current raw set. The function does not establish whether these are raw or previously stabilized sets.
Value
A character vector of stripped response names, in current fixed-gate order, that survive the optional intersections. It can be empty.
Composition rule
Let \(G_0\) be the character vector returned by
activeByImportance(extractChainImportance(...), thresh = thresh).
Extraction always uses its default useModel = TRUE. If
stableK <= 1, or fewer than stableK - 1 history elements are
available, the helper returns \(G_0\) unchanged. Otherwise, for the
retained history tail \(G_1,\ldots,G_{K-1}\), it returns
$$G_0\cap G_1\cap\cdots\cap G_{K-1}.$$
Base intersect() preserves the current vector's order while removing
duplicate names. No fallback replaces an empty extraction or intersection.
In chainPipeline(), this wrapper is called with stableK = 1 and an
empty history. The pipeline first replaces an empty raw result with all
declared responses, then applies its own window by intersecting the current
set with preceding returned active sets. Consequently, standalone wrapper
output and pipeline fallback/stability must not be described as one rule.
Conditions and side effects
Validation and failures are inherited from extraction, the fixed table
gate, tail(), Reduce(), and intersect(). In particular, a missing
stableK comparison can error, and unusual history element types retain
base R behavior. The helper reads models through the extractor but writes no
file, sets no seed, draws no random value directly, and emits no deliberate
condition.
See also
extractChainImportance() for model parsing and normalization,
activeByImportance() for threshold semantics, and chainPipeline() for
pipeline fallback and the common fixed/shadow history policy.
Examples
root <- tempfile("ssel-chain-stability-")
dir.create(root)
train <- data.frame(
alpha.o = 1:12,
beta.o = rep(c(0, 1), 6),
x = rep(1:4, 3),
y = c(2.1, 1.7, 3.5, 2.8, 5.2, 4.1,
6.4, 5.3, 7.1, 6.8, 8.2, 7.5)
)
fit <- caret::train(
y ~ ., data = train, method = "lm",
trControl = caret::trainControl(method = "none")
)
saveRDS(fit, file.path(root, "lm_target_demo.Rds"))
computeActiveByImportance(
pathModel = root,
suffix = ".o",
thresh = 0,
stableK = 2,
history = list("alpha")
)
#> [1] "alpha"
# Only a currently active name also present in the supplied set survives.
unlink(root, recursive = TRUE)