| Title: | A Multi-Backend Benchmark Harness and Recommender for Causal Discovery |
|---|---|
| Description: | Provides a single typed interface over a curated portfolio of causal-structure-discovery algorithms drawn from several R and Python back-ends, together with a structural-causal-model scenario grid, fair graph-recovery metrics, and an evidence-routed recommender that inspects a data set and suggests a discovery method suited to its characteristics. Every back-end is optional and loaded lazily only when used, so the harness, the scenario grid, the metrics, and the recommender's routing logic all run with no suggested package installed. |
| Authors: | Max Moldovan [aut, cre, cph] (ORCID: <https://orcid.org/0000-0001-9680-8474>) |
| Maintainer: | Max Moldovan <[email protected]> |
| License: | MIT + file LICENSE |
| Version: | 0.2.0.9000 |
| Built: | 2026-10-15 23:24:36 UTC |
| Source: | https://github.com/max578/cdzoo |
The federation's emit / adapt generic. The cd_result method turns a
recovered graph into the shared orchestra_manifest contract:
inferential_target = "structure", the recovered edges carried as a tidy
params edge list, and the provenance – which method ran, the routing
rationale, the routing confidence, and whether the result is a single method
or a consensus – in the typed summary and metadata. The full adjacency
matrix (and, for a consensus, the per-edge agreement) rides in metadata for
a consumer that wants the matrix rather than the edge list. When no graph was
recovered (an absent back-end), the manifest abstains and says so. The
payload is integrity-hashed so a consumer can verify it with
verify_manifest().
as_orchestra_manifest(x, ...)as_orchestra_manifest(x, ...)
x |
A cd_result. |
... |
Further arguments passed to methods. The cd_result method
accepts |
An orchestra_manifest S7 object.
verify_manifest(), cd_auto(), cd_discover()
g <- matrix(c(0, 0, 1, 0), 2, 2, dimnames = list(c("x1", "x2"), c("x1", "x2"))) as_orchestra_manifest(cd_result(graph = g, method = "demo", method_name = "Demo", family = "constraint"))g <- matrix(c(0, 0, 1, 0), 2, 2, dimnames = list(c("x1", "x2"), c("x1", "x2"))) as_orchestra_manifest(cd_result(graph = g, method = "demo", method_name = "Demo", family = "constraint"))
Inspects a data set with cd_diagnose()'s transparent characteristics,
routes it to a discovery method suited to that regime, runs the best
installed method on the route, and returns the recovered graph together with
the routing rationale and a confidence label. Because causal discovery has no
run-time ground truth, this is a recommender, not a selector: it reports why
it chose and how sure it is, and – in "consensus" mode – returns a
stability-weighted union of several methods with per-edge agreement.
cd_auto( data, mode = c("route", "consensus"), report = TRUE, top_k = 3L, threshold = 0.05, density_components = 4L )cd_auto( data, mode = c("route", "consensus"), report = TRUE, top_k = 3L, threshold = 0.05, density_components = 4L )
data |
A numeric matrix or data frame of observations by variables, an
evaluable-density object (a proxymix |
mode |
|
report |
A single logical. When |
top_k |
The number of methods to combine in |
threshold |
The partial-correlation edge threshold for the density route. |
density_components |
The number of mixture components to fit when routing an evaluable target density. |
The route is decided by four data-characteristic thresholds, checked in this
order and reported in the result's provenance$thresholds: a curvature
heuristic above 0.05 routes to a kernel conditional-independence test; a
non-Gaussian margin fraction of 0.5 or more routes to the LiNGAM family; a
correlation condition number above 1000 (a latent-structure hint) routes to
a confounder-robust method; and a residual-variance ratio below 2 routes to
the equal-variance continuous-optimisation methods. Failing all four, the
benchmark's strongest overall method is used.
When data is an evaluable density rather than a sample – a proxymix gmm,
gmm_fit, or gmm_target (requires the suggested proxymix package) –
the conditional-independence (Markov) structure is read off the mixture in
closed form, the route for the case where a density can be evaluated but not
sampled.
When data is a sufficient statistic (cd_suffstat(), a correlation matrix
and its sample size), the recommender routes among the sufficient-statistic
methods. A correlation matrix carries only the latent-structure hint, so the
rationale states plainly that the non-Gaussianity, nonlinearity, and
equal-variance tests could not be run.
A cd_result whose rationale, confidence, and alternatives
(always a list of method labels, in the route's preference order) record
the recommendation. In "consensus" mode the per-edge agreement and the
individual member results are stored in the result's provenance (as
agreement and runs).
cd_diagnose(), cd_discover(), list_methods()
if (requireNamespace("pcalg", quietly = TRUE)) { sim <- cd_scenario("linear_laplace", seed = 1) rec <- cd_auto(sim$data, report = FALSE) rec@rationale }if (requireNamespace("pcalg", quietly = TRUE)) { sim <- cd_scenario("linear_laplace", seed = 1) rec <- cd_auto(sim$data, report = FALSE) rec@rationale }
Runs each installed method across the chosen scenarios and seeds, scores
every run against the scenario's known truth with cd_score(), and returns
the per-run results as a tidy data frame. Each run is isolated, so a back-end
that errors on a cell records a failed status rather than stopping the
benchmark.
cd_benchmark( methods = NULL, scenarios = NULL, seeds = 1:4, cost_limit = c("medium", "fast", "slow", "very_slow"), verbose = TRUE, mc.cores = 1L )cd_benchmark( methods = NULL, scenarios = NULL, seeds = 1:4, cost_limit = c("medium", "fast", "slow", "very_slow"), verbose = TRUE, mc.cores = 1L )
methods |
A character vector of method ids to run, or |
scenarios |
A character vector of scenario names, or |
seeds |
An integer vector of seeds; each scenario is realised once per seed. |
cost_limit |
A single string: the costliest method tier to include, one
of |
verbose |
A single logical: report progress per scenario. |
mc.cores |
A single positive integer: the number of cores to run the
grid on. The default |
The default skips methods costlier than cost_limit so a first pass is
quick; raise the limit to include the slower kernel and search methods. With
no back-end installed the result has zero rows. A requested method that
cannot run is dropped with a warning naming it and the reason (an unknown id,
an absent back-end, or a cost above the limit) – never silently.
A data frame with one row per (scenario, method, seed) run, with
columns scenario, family, method, method_family, language,
seed, status, skeleton_f1, shd, orient_recall, and runtime_s.
cd_scenario(), cd_score(), list_methods()
if (requireNamespace("pcalg", quietly = TRUE)) { res <- cd_benchmark( methods = "pc_pcalg", scenarios = "linear_gaussian", seeds = 1:2, verbose = FALSE ) res[, c("scenario", "method", "skeleton_f1", "shd")] }if (requireNamespace("pcalg", quietly = TRUE)) { res <- cd_benchmark( methods = "pc_pcalg", scenarios = "linear_gaussian", seeds = 1:2, verbose = FALSE ) res[, c("scenario", "method", "skeleton_f1", "shd")] }
Builds a positive-definite correlation matrix over a set of binary variables
from their pairwise two-by-two co-occurrence counts – the aggregated form in
which co-occurrence data (comorbidity, market-basket, species co-occurrence)
is usually published. The result feeds straight into
cd_discover_suffstat().
cd_correlation_from_counts(pairs, type = c("phi", "tetra"), repair = TRUE)cd_correlation_from_counts(pairs, type = c("phi", "tetra"), repair = TRUE)
pairs |
A data frame with one row per variable pair and columns |
type |
|
repair |
Whether to project an indefinite matrix to the nearest
positive-definite correlation matrix. Defaults to |
A matrix assembled pair by pair is not guaranteed positive semi-definite, so
it is repaired to the nearest positive-definite correlation matrix by
eigenvalue clipping when repair = TRUE; the eigenvalue floor reached and
the repair distortion are recorded in the result's "repair" attribute.
Every unordered variable pair must appear exactly once; a repeated pair is an
error rather than a silent overwrite. A pair that is absent from pairs is
taken to have zero correlation (the off-diagonal entry stays zero before
repair).
A correlation matrix with a "repair" attribute recording the
minimum eigenvalue before and after repair, the Frobenius distortion, and
the pair and variable counts.
pairs <- data.frame( var_i = "a", var_j = "b", n11 = 900, n10 = 100, n01 = 100, n00 = 8900) cd_correlation_from_counts(pairs)pairs <- data.frame( var_i = "a", var_j = "b", n11 = 900, n10 = 100, n01 = 100, n00 = 8900) cd_correlation_from_counts(pairs)
Reports the data characteristics the recommender uses to route a problem, as
a one-row data frame. Use it to see what cd_auto() sees before it chooses a
method.
cd_diagnose(data)cd_diagnose(data)
data |
A numeric matrix or data frame of observations (rows) by variables (columns). |
On large data sets the statistics are computed on a deterministic, evenly spaced subsample of rows (at most 5000 rows for the normality test, 2000 for the regression heuristics), so the diagnostics are pure: repeated calls on the same data return the same characteristics, and the caller's random-number state is never touched.
A one-row data frame of the characteristics described in
cd_auto()'s routing.
sim <- cd_scenario("linear_laplace", seed = 1) cd_diagnose(sim$data)sim <- cd_scenario("linear_laplace", seed = 1) cd_diagnose(sim$data)
Runs a single registered discovery method on a data set and returns the
recovered graph as a cd_result. Use list_methods() to see the registered
methods and which back-ends are installed, and cd_auto() to let the
recommender choose a method for you.
cd_discover(data, method)cd_discover(data, method)
data |
A numeric matrix or data frame of observations (rows) by variables (columns). |
method |
A single string: the id of a registered method (see
|
A method that consumes a sufficient statistic (its accepts is "suffstat",
such as "pc_suffstat") can still be run here on a data matrix: the data is
reduced to its correlation matrix and sample size first. To run such a method
on an already-aggregated statistic instead, use cd_discover_suffstat().
A cd_result. When the back-end raises an error, the result carries
an empty graph and the error in its status; an absent back-end is a hard
error pointing at the package or module to install.
cd_auto(), list_methods(), cd_score()
if (requireNamespace("pcalg", quietly = TRUE)) { sim <- cd_scenario("linear_gaussian", seed = 1) res <- cd_discover(sim$data, "pc_pcalg") res }if (requireNamespace("pcalg", quietly = TRUE)) { sim <- cd_scenario("linear_gaussian", seed = 1) res <- cd_discover(sim$data, "pc_pcalg") res }
Runs constraint-based discovery directly on a correlation (or covariance)
matrix and its sample size, returning a cd_result in the same amat.cpdag
convention as cd_discover(). This is the entry point for data that arrives
already aggregated – a published correlation matrix, a privacy-preserving
summary, or the output of cd_correlation_from_counts() – with no row-level
observation matrix to pass to cd_discover().
cd_discover_suffstat( C, n, method = c("pc", "fci", "ggm"), test = c("gauss", "magnitude"), alpha = 0.05, tau = 0.05 )cd_discover_suffstat( C, n, method = c("pc", "fci", "ggm"), test = c("gauss", "magnitude"), alpha = 0.05, tau = 0.05 )
C |
A square correlation or covariance matrix; covariance input is standardised. Variable names are taken from its dimnames. |
n |
A single positive number: the sample size the statistic summarises. |
method |
One of |
test |
One of |
alpha |
The Fisher-Z significance level for |
tau |
The partial-correlation magnitude threshold for |
method = "ggm" returns the Gaussian-graphical-model skeleton (an undirected
edge wherever the partial correlation given all other variables clears tau)
and needs no back-end. method = "pc" and method = "fci" run the PC and
FCI algorithms from pcalg and add such orientation as the data identify;
FCI additionally allows latent confounders.
test = "gauss" uses the Fisher-Z significance test at level alpha, as
cd_discover() does. test = "magnitude" instead prunes an edge when the
partial correlation magnitude falls below tau; use it when n is so large
that a significance test would call every pair dependent.
A cd_result whose provenance$source is "suffstat".
cd_discover(), cd_correlation_from_counts(), cd_score()
if (requireNamespace("pcalg", quietly = TRUE)) { sim <- cd_scenario("linear_gaussian", seed = 1) # discover from the sufficient statistic alone -- no row-level data res <- cd_discover_suffstat(stats::cor(sim$data), nrow(sim$data), "pc") cd_score(res, sim$truth) }if (requireNamespace("pcalg", quietly = TRUE)) { sim <- cd_scenario("linear_gaussian", seed = 1) # discover from the sufficient statistic alone -- no row-level data res <- cd_discover_suffstat(stats::cor(sim$data), nrow(sim$data), "pc") cd_score(res, sim$truth) }
Returns the edges of a cd_result (or a bare adjacency matrix) as a data frame, one row per edge, with the orientation made explicit.
cd_edges(x, agreement = FALSE)cd_edges(x, agreement = FALSE)
x |
A cd_result or a square adjacency matrix in |
agreement |
A single logical. When |
A data frame with columns from, to, and type ("-->" for a
directed edge, "---" for an undirected one), and – when agreement = TRUE – an agreement column. Zero rows when the graph is empty.
Other results:
cd_result()
g <- matrix(c(0, 0, 1, 0), 2, 2, dimnames = list(c("x1", "x2"), c("x1", "x2"))) cd_edges(cd_result(graph = g, method = "demo"))g <- matrix(c(0, 0, 1, 0), 2, 2, dimnames = list(c("x1", "x2"), c("x1", "x2"))) cd_edges(cd_result(graph = g, method = "demo"))
Prints a readable account of a cd_result: the method that ran and its
status, the routing rationale and confidence, the alternatives the
recommender considered, the data-characteristic thresholds that decided the
route (when cd_auto() produced the result), and – for a "consensus"
result – the per-edge agreement among the combined methods. It is the
auditable companion to print(), which stays compact.
cd_explain(x)cd_explain(x)
x |
x, invisibly. Called for the account it prints.
cd_auto(), cd_result, cd_edges()
if (requireNamespace("pcalg", quietly = TRUE)) { sim <- cd_scenario("linear_laplace", seed = 1) cd_explain(cd_auto(sim$data, report = FALSE)) }if (requireNamespace("pcalg", quietly = TRUE)) { sim <- cd_scenario("linear_laplace", seed = 1) cd_explain(cd_auto(sim$data, report = FALSE)) }
A summary of sixteen established causal-discovery methods run across the nine
structural-causal-model scenarios of cd_scenarios(), each method scored
against the scenario's known DAG and averaged over random-graph seeds. It is
the evidence that grounds the routing preferences in cd_auto(), and the
worked example in the package vignette.
cd_field_benchmarkcd_field_benchmark
A data frame with 143 rows and 11 columns:
Scenario name (see cd_scenarios()).
The scenario's structural-causal-model family.
Method id (see list_methods()).
Human-readable method name.
Algorithm family.
Mean structural Hamming distance to the true DAG (lower is better).
Standard deviation of the structural Hamming distance across seeds.
Mean skeleton (adjacency) F1 (higher is better).
Mean orientation recall.
Mean wall-clock runtime in seconds.
Number of random-graph seeds averaged.
One row per (scenario, method). The kernel conditional-independence method
(pc_kci_cl) was not run on the ten-variable scenario, so that one
(scenario, method) cell is absent, giving 143 rows.
cd_benchmark(), cd_auto(), cd_scenarios()
# overall ranking by mean structural Hamming distance across scenarios agg <- aggregate(shd ~ method_name, data = cd_field_benchmark, FUN = mean) agg[order(agg$shd), ]# overall ranking by mean structural Hamming distance across scenarios agg <- aggregate(shd ~ method_name, data = cd_field_benchmark, FUN = mean) agg[order(agg$shd), ]
Bundles the metadata that drives selection – family, language, native output
type, cost, and assumptions – with the adapter that runs a back-end
algorithm on a data matrix and returns its estimate in the shared
amat.cpdag convention. The available predicate reports whether the
back-end can run in the current session, so a method whose package or Python
module is absent is skipped rather than failing.
cd_method( id = character(0), name = "", family = "constraint", language = "R", output = "cpdag", citation = "", cost = "fast", assumptions = "", accepts = "data", available = function() NULL, run = function() NULL )cd_method( id = character(0), name = "", family = "constraint", language = "R", output = "cpdag", citation = "", cost = "fast", assumptions = "", accepts = "data", available = function() NULL, run = function() NULL )
id |
A single string identifying the method; this is the value passed to
|
name |
A single string giving the human-readable method name. |
family |
A single string naming the algorithm family, one of
|
language |
A single string, |
output |
A single string giving the native output type, one of |
citation |
A single string citing the method's source. |
cost |
A single string giving the rough computational cost, one of
|
assumptions |
A single string describing the method's modelling assumptions. |
accepts |
A single string naming the input the method's |
available |
A function of no arguments returning a single logical: can the method run in the current session? |
run |
A function taking the method's input (a numeric data matrix, or a
|
An S7 object of class cd_method.
Other registry:
list_methods(),
register_method()
cd_method( id = "demo", name = "Demo", family = "constraint", available = function() TRUE, run = function(data) list(amat = NULL, runtime_s = 0, status = "ok") )cd_method( id = "demo", name = "Demo", family = "constraint", available = function() TRUE, run = function(data) list(amat = NULL, runtime_s = 0, status = "ok") )
The object returned by cd_discover() and cd_auto(). It holds the
recovered graph as an adjacency matrix in the pcalg amat.cpdag
convention, where
graph[i, j] == 1 and graph[j, i] == 0 encodes the directed edge
, and graph[i, j] == graph[j, i] == 1 encodes an
undirected (unoriented) edge .
cd_result( graph = numeric(0), method = NA_character_, method_name = "", family = NA_character_, language = "R", output = "cpdag", runtime_s = NA_real_, status = "ok", rationale = "", confidence = NA_character_, alternatives = list(), provenance = list() )cd_result( graph = numeric(0), method = NA_character_, method_name = "", family = NA_character_, language = "R", output = "cpdag", runtime_s = NA_real_, status = "ok", rationale = "", confidence = NA_character_, alternatives = list(), provenance = list() )
graph |
A square numeric adjacency matrix in the |
method |
A single string: the identifier of the method that produced the result. |
method_name |
A single string: the human-readable method name. |
family |
A single string: the algorithm family (constraint, score, functional, continuous-optimisation, hybrid, or density). |
language |
A single string: the back-end language, |
output |
A single string: the native output type, one of |
runtime_s |
A single number: wall-clock runtime in seconds. |
status |
A single string: |
rationale |
A single string: why the recommender chose this method. |
confidence |
A single string: |
alternatives |
A list of method labels the recommender considered as alternatives, in its preference order. |
provenance |
A list of call metadata (data characteristics, options). |
The rationale, confidence, and alternatives properties are populated by
cd_auto() and are empty for a single-method cd_discover() call.
An S7 object of class cd_result.
Other results:
cd_edges()
g <- matrix(c(0, 0, 1, 0), 2, 2, dimnames = list(c("x1", "x2"), c("x1", "x2"))) cd_result(graph = g, method = "pc_pcalg", method_name = "PC (Fisher-Z)")g <- matrix(c(0, 0, 1, 0), 2, 2, dimnames = list(c("x1", "x2"), c("x1", "x2"))) cd_result(graph = g, method = "pc_pcalg", method_name = "PC (Fisher-Z)")
Realises one of the built-in structural-causal-model scenarios at a given
seed and returns the data together with the true graph, the independent
oracle a recovered structure is scored against by cd_score().
cd_scenario(name, seed = 1L)cd_scenario(name, seed = 1L)
name |
A single string: the scenario name (see |
seed |
A single integer-valued seed for reproducibility; any finite number is accepted (a value beyond integer range is folded back into it). |
A list with data (the observation matrix), truth (the true graph
in amat.cpdag convention), dag (the raw simulator DAG), scenario,
family, p, and n.
cd_scenarios(), cd_score(), cd_benchmark()
sim <- cd_scenario("linear_gaussian", seed = 1) dim(sim$data) sim$truthsim <- cd_scenario("linear_gaussian", seed = 1) dim(sim$data) sim$truth
Lists the structural-causal-model scenarios available to cd_scenario() and
cd_benchmark().
cd_scenarios()cd_scenarios()
A data frame with columns name, p, n, family, and
description.
cd_scenarios()cd_scenarios()
Compares a discovery result – a cd_result or a bare adjacency matrix –
with the true graph and returns the skeleton, distance, and orientation
metrics. The truth is typically the truth element of a cd_scenario().
cd_score(x, truth)cd_score(x, truth)
x |
A cd_result or a square adjacency matrix in |
truth |
The true graph in |
Both matrices are normalised before scoring, so any non-zero entry counts as an edge mark and the three metrics see the same graph whether the input is 0/1 or weighted. When the estimate carries no dimnames but matches the truth's dimensions, it is scored positionally against the truth's variable order.
A one-row data frame with skeleton_f1, skeleton_precision,
skeleton_recall, shd, and orient_recall. skeleton_f1 is NA when
the truth has no edges (recall is undefined there); an empty estimate
against a non-empty truth scores 0.
if (requireNamespace("pcalg", quietly = TRUE)) { sim <- cd_scenario("linear_gaussian", seed = 1) res <- cd_discover(sim$data, "pc_pcalg") cd_score(res, sim$truth) }if (requireNamespace("pcalg", quietly = TRUE)) { sim <- cd_scenario("linear_gaussian", seed = 1) res <- cd_discover(sim$data, "pc_pcalg") cd_score(res, sim$truth) }
Wraps a correlation (or covariance) matrix and its sample size as a tagged
object that cd_auto() accepts in place of a data matrix, so the recommender
can route and run on data that arrives already aggregated. The matrix is
validated and standardised exactly as cd_discover_suffstat() does.
cd_suffstat(C, n)cd_suffstat(C, n)
C |
A square correlation or covariance matrix; covariance input is standardised. Variable names are taken from its dimnames. |
n |
A single positive number: the sample size the statistic summarises. |
An object of class cd_suffstat: a list with the validated
correlation matrix C and the sample size n.
cd_auto(), cd_discover_suffstat()
sim <- cd_scenario("linear_gaussian", seed = 1) ss <- cd_suffstat(stats::cor(sim$data), nrow(sim$data)) ss$nsim <- cd_scenario("linear_gaussian", seed = 1) ss <- cd_suffstat(stats::cor(sim$data), nrow(sim$data)) ss$n
Returns every registered method as a cd_method list, or – with
as_data_frame = TRUE – a data frame summarising the registry and which
back-ends are installed in the current session.
list_methods(as_data_frame = TRUE, refresh = FALSE)list_methods(as_data_frame = TRUE, refresh = FALSE)
as_data_frame |
A single logical. When |
refresh |
A single logical. When |
Python back-end availability is checked passively: cdzoo never initialises
Python (which can trigger interpreter provisioning) just to report it. A
Python back-end shows installed = TRUE once reticulate's interpreter is
initialised or configured (for example via RETICULATE_PYTHON); set
options(cdzoo.python_init = TRUE) to let this check initialise Python
eagerly. Probe results are cached for the session.
A data frame with columns id, name, family, language,
cost, accepts ("data" or "suffstat"), and installed, or a named
list of cd_method objects.
Other registry:
cd_method(),
register_method()
list_methods()list_methods()
A versioned, hashed, provenance-complete S7 result object,
property-compatible with the federation's reference orchestra_manifest. A
cd_result is adapted into one through as_orchestra_manifest(): the
recovered edges ride in params (inferential_target = "structure"), the
method, routing rationale, confidence, and consensus flag ride in metadata
and the typed summary, and the payload is integrity-hashed so a tampered
graph is detected downstream.
An S7 object of class orchestra_manifest.
as_orchestra_manifest(), verify_manifest()
g <- matrix(0, 2, 2, dimnames = list(c("x", "y"), c("x", "y"))) g["x", "y"] <- 1 m <- as_orchestra_manifest(cd_result(graph = g, method = "demo")) m@inferential_target m@summary$abstained verify_manifest(m)$okg <- matrix(0, 2, 2, dimnames = list(c("x", "y"), c("x", "y"))) g["x", "y"] <- 1 m <- as_orchestra_manifest(cd_result(graph = g, method = "demo")) m@inferential_target m@summary$abstained verify_manifest(m)$ok
Draws the recovered graph with the variables on a circle and an arrow for each directed edge, a plain segment for each undirected one. It uses base graphics only, so it needs no plotting back-end.
x |
A cd_result with a non-empty graph. |
... |
Further graphical parameters passed to the node points. |
x, invisibly.
g <- matrix(0, 3, 3, dimnames = list(paste0("x", 1:3), paste0("x", 1:3))) g["x1", "x2"] <- 1 g["x2", "x3"] <- 1 plot(cd_result(graph = g, method = "demo"))g <- matrix(0, 3, 3, dimnames = list(paste0("x", 1:3), paste0("x", 1:3))) g["x1", "x2"] <- 1 g["x2", "x3"] <- 1 plot(cd_result(graph = g, method = "demo"))
Adds a cd_method to the registry so it can be run by cd_discover() and
considered by cd_auto(). Registering a method with the id of an existing
one replaces it.
register_method(method)register_method(method)
method |
A cd_method to register. |
The method id, invisibly.
Other registry:
cd_method(),
list_methods()
m <- cd_method( id = "noop", name = "No-op", family = "constraint", available = function() TRUE, run = function(data) list(amat = NULL, runtime_s = 0, status = "ok") ) register_method(m) "noop" %in% list_methods()$idm <- cd_method( id = "noop", name = "No-op", family = "constraint", available = function() TRUE, run = function(data) list(amat = NULL, runtime_s = 0, status = "ok") ) register_method(m) "noop" %in% list_methods()$id
Recomputes the payload hash from the object's own load-bearing slots and
compares it to the stored data_hash. A mismatch means the payload was
modified after emission. Matches the reference contract's
verify_manifest().
verify_manifest(m)verify_manifest(m)
m |
An |
A list with logical ok and a human-readable message.
g <- matrix(c(0, 0, 1, 0), 2, 2, dimnames = list(c("x1", "x2"), c("x1", "x2"))) m <- as_orchestra_manifest(cd_result(graph = g, method = "demo")) verify_manifest(m)g <- matrix(c(0, 0, 1, 0), 2, 2, dimnames = list(c("x1", "x2"), c("x1", "x2"))) m <- as_orchestra_manifest(cd_result(graph = g, method = "demo")) verify_manifest(m)