Validate that a model implements the shapleydecomp interface
Source:R/validate.R
validate_model_interface.RdChecks that the required S3 methods exist for the given model class and runs a minimal smoke test if parameters and factors are provided.
Usage
validate_model_interface(
model,
params = NULL,
factors = NULL,
summary_vars = NULL,
baseline_year = NULL,
verbose = TRUE
)See also
Other model interface:
build_counterfactual(),
get_baseline_value(),
prepare_decomp(),
run_simulation(),
summarize_results(),
warm_start
Examples
sir <- new.env()
sys.source(system.file("examples", "sir_model.R", package = "shapleydecomp"),
envir = sir)
validate_model_interface(
sir$create_sir_model(),
sir$create_sir_params(),
factors = c("beta_reduction", "treatment_effect"),
summary_vars = c("infections", "deaths"),
baseline_year = 2000
)
#> Validating shapleydecomp interface for class 'sir_model'
#> [OK] run_simulation.sir_model
#> [OK] summarize_results.sir_model
#> [OK] build_counterfactual.sir_model
#> [OK] get_baseline_value.sir_model
#> [--] prepare_decomp.sir_model (optional)
#> [--] supports_warm_start.sir_model (optional)
#> [--] get_warm_start_state.sir_model (optional)
#> [--] run_from_warm_start.sir_model (optional)
#> Running smoke test...
#> [OK] run_simulation + summarize_results
#> [OK] get_baseline_value('beta_reduction')
#> [OK] get_baseline_value('treatment_effect')
#> [OK] build_counterfactual('beta_reduction')
#> Smoke test passed.
#> Validation complete.