Write a config object to a schema.rtemis.org JSON file that can be read back
with read_config and consumed by rtemislive and the rtemis CLI. The
emitted JSON carries a $schema field identifying the config family, so the
reader can dispatch to the right object:
Details
SuperConfig(from setup_SuperConfig) -> supervised schema.DecomposeConfig(from setup_DecomposeConfig) -> decompose schema.ClusterConfig(from setup_ClusterConfig) -> cluster schema.DecompositionConfig(fromsetup_PCA(),setup_ICA(), ...) -> decomposition schema.ClusteringConfig(fromsetup_KMeans(),setup_DBSCAN(), ...) -> clustering schema.PreprocessorConfig(from setup_Preprocessor) -> preprocessor schema.
A config is an input: what a run is being asked to do. Fields it omits
fall back to their setup_* defaults when read, so a config stays valid as
those defaults improve. That is the opposite of a record, which states
what one run actually did, with every value resolved – see write_record.
The two are separate functions rather than one with a flag, because a caller
should have to say which artifact they want.
Examples
x <- setup_SuperConfig(
dat_training_path = "~/Data/iris.csv",
preprocessor_config = setup_Preprocessor(remove_duplicates = TRUE),
hyperparameters = setup_LightRF(),
outer_resampling_config = setup_Resampler(),
question = "Can we tell iris species apart given their measurements?",
outdir = "models/"
)
tmpfile <- file.path(tempdir(), "rtemis.json")
write_config(x, tmpfile, overwrite = TRUE)
#> 2026-08-09 13:22:54
#> ✔ Created file: /var/folders/cr/lgjpmnv97lg6qtnjt9kph7qw0000gn/T//RtmpdcJDNA/rtemis.json
#> [write_lines]