| borg_assimilate | R Documentation |
borg_assimilate() attempts to automatically fix detected evaluation risks
by restructuring the pipeline to eliminate information leakage.
borg_assimilate(workflow, risks = NULL, fix = "all")
workflow |
A list containing the evaluation workflow (same structure
as |
risks |
Optional |
fix |
Character vector specifying which risk types to attempt to fix.
Default: |
borg_assimilate() can automatically fix certain types of leakage:
Refits preprocessing objects using only training indices
Recomputes target encodings, embeddings, and derived features using train-only data
Moves threshold selection to training/validation data
Some violations cannot be automatically fixed:
Train-test index overlap (requires new split)
Target leakage in original features (requires domain intervention)
Temporal look-ahead in features (requires feature re-engineering)
A list containing:
The rewritten workflow (modified in place where possible)
Character vector of risk types that were successfully fixed
Character vector of risk types that could not be fixed
BorgRisk object from post-rewrite validation
borg_validate for validation without assimilation,
borg for proactive enforcement.
# Attempt to fix a leaky workflow
workflow <- list(
data = data.frame(x = rnorm(100), y = rnorm(100)),
train_idx = 1:70,
test_idx = 71:100
)
result <- borg_assimilate(workflow)
if (length(result$unfixable) > 0) {
message("Some risks require manual intervention:")
print(result$unfixable)
}
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.