View source: R/borg_wrappers.R
| borg_register_hooks | R Documentation |
Registers BORG validation hooks that automatically check data dependencies when using common ML framework functions. This is an experimental feature.
borg_register_hooks(
frameworks = c("rsample", "caret", "mlr3"),
action = c("error", "warn", "message")
)
frameworks |
Character vector. Which frameworks to hook into. Options: "rsample", "caret", "mlr3". Default: all available. |
action |
Character. What to do when dependencies detected: "error" (block), "warn" (warn but proceed), "message" (info only). |
This function uses R's trace mechanism to add BORG checks to framework functions. The hooks are session-specific and do not persist.
To remove hooks, use borg_unregister_hooks().
Invisible NULL. Called for side effect.
if (requireNamespace("rsample", quietly = TRUE)) {
# Register hooks for rsample
borg_register_hooks("rsample")
# Now vfold_cv() will check for dependencies
spatial_data <- data.frame(
lon = runif(50), lat = runif(50), response = rnorm(50)
)
options(borg.check_data = spatial_data)
options(borg.check_coords = c("lon", "lat"))
# Remove hooks
borg_unregister_hooks()
}
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.