View source: R/extend-causaldisco-algs.R
| register_engine | R Documentation |
The built-in engines ("bnlearn", "causalDisco", "pcalg", "tetrad") are
backed by R6 search classes (BnlearnSearch, CausalDiscoSearch,
PcalgSearch, TetradSearch) that make_runner() knows how to build and
configure. register_engine() lets you plug in a backend for a package
that isn't one of the built-ins, so that it can be selected by name from
make_runner() the same way as a built-in engine.
register_engine(name, make_runner_fn, pkgs = character(0))
name |
Engine name (string). Cannot be one of the built-in engine names ("bnlearn", "causalDisco", "pcalg", "tetrad"). |
make_runner_fn |
A function implementing the engine. See Details. |
pkgs |
Character vector of package names required by the engine.
Checked, with an informative error if missing, before |
make_runner_fn must accept alg and ..., and return a runner: a list
with two elements,
set_knowledge, a function that takes a single Knowledge
object and configures background knowledge on the underlying search, and
run, a function that takes a single data frame, runs the search,
and returns the algorithm's result using as_disco().
make_runner() calls make_runner_fn with alg, test, alpha,
score, and any additional arguments it was itself called with. Pick up
whichever of these your engine needs by naming them explicitly, and let
... absorb the rest.
Other Extending causalDisco:
as_disco(),
distribute_engine_args(),
list_registered_engines(),
list_registered_tetrad_algorithms(),
make_method(),
make_runner(),
new_disco_method(),
register_tetrad_algorithm(),
reset_engine_registry(),
reset_tetrad_alg_registry()
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.