borg_validate: Validate Complete Evaluation Workflow

View source: R/borg_validate.R

borg_validateR Documentation

Validate Complete Evaluation Workflow

Description

borg_validate() performs post-hoc validation of an entire evaluation workflow, checking all components for information leakage.

Usage

borg_validate(workflow, strict = FALSE)

Arguments

workflow

A list containing the evaluation workflow components:

data

The full dataset

train_idx

Integer vector of training indices

test_idx

Integer vector of test indices

preprocess

Optional preprocessing object(s)

model

The fitted model object

predictions

Model predictions on test data

metrics

Computed evaluation metrics

strict

Logical. If TRUE, any hard violation causes an error. Default: FALSE (returns report only).

Details

borg_validate() inspects each component of an evaluation workflow:

  1. Split validation: Checks train/test index isolation

  2. Preprocessing audit: Traces preprocessing parameters to verify train-only origin

  3. Feature audit: Checks for target leakage and proxy features

  4. Model audit: Validates that model used only training data

  5. Threshold audit: Checks if any thresholds were optimized on test data

Value

A BorgRisk object containing a comprehensive assessment of the workflow.

See Also

borg for proactive enforcement, borg_inspect for single-object inspection.

Examples


# Validate an existing workflow
data <- data.frame(x = rnorm(100), y = rnorm(100))
result <- borg_validate(list(
  data = data,
  train_idx = 1:70,
  test_idx = 71:100
))

# Check validity
if (!result@is_valid) {
  print(result)  # Shows detailed risk report
}



BORG documentation built on March 20, 2026, 5:09 p.m.