Prepare metadata or a summary-only warm-start artifact
Source:R/warm_start_model_artifact.R
prepare_warm_start_model.RdPrepare metadata or a summary-only warm-start artifact
Usage
prepare_warm_start_model(model, metadata = list(), omit_audit = FALSE)Arguments
- model
A valid pairwiseLLM_warm_model or
ensemble_warm_start_models()ensemble.- metadata
Named list with optional scalar character
name,version,domain,notes,license,prepared_at,preparation_package_version, andextraction_provenance(a named character vector). Supplied fields replace existing fields. Timestamps use UTCYYYY-MM-DDTHH:MM:SSZstrings.- omit_audit
Explicitly omit row-level development evidence. Default FALSE.
Details
Preparation adds a preparation timestamp/package version when absent, not a
training date. Extraction provenance defaults to c(status = "unavailable");
user-supplied records are not independently verified. Schema identity or a
later Python status check is not extraction provenance.
Ordinary preparation preserves audit records. Explicit omission creates format 2 for legacy models; format-3 models remain format 3. Both use summary-only audit status, retaining deployment parameters, tuning settings and nested-validation summaries. IDs, OOF rows, fold records, tuning traces and contextual warning messages are omitted; warning counts remain. Format-3 artifacts retain compact CV identity digests, not the original plan. Summaries cannot be recomputed without the original evidence. An already reduced artifact cannot recover its audit through this function.
Ensembles retain ensemble format 1; audit omission recursively reduces each component, preserving its format generation and existing metadata. Supplied preparation metadata applies to the ensemble only.
No raw texts are added. Review task labels, notes, domain, and provenance for restricted information before bundling; this is not a general anonymizer. User models do not need complete publication metadata. Task-specific outcome scales remain standardized independently; storage does not link BTL scales.
See also
save_warm_start_model(), register_warm_start_model()
Other adaptive warm start:
ensemble_warm_start_models(),
extract_warm_start_features(),
fit_warm_start_model(),
make_warm_start_cv_plan(),
make_warm_start_prior(),
pairwiseLLM_warm_model,
predict.pairwiseLLM_warm_ensemble(),
predict.pairwiseLLM_warm_model(),
register_warm_start_model(),
save_warm_start_model(),
summary.pairwiseLLM_warm_ensemble(),
summary.pairwiseLLM_warm_predictions(),
warm_start_coefficients(),
warm_start_feature_schema(),
warm_start_python_status()
Examples
if (requireNamespace("glmnet", quietly = TRUE) &&
requireNamespace("withr", quietly = TRUE)) {
local({
# Synthetic features illustrate the interface, not predictive validity.
example_features <- function(seed) {
withr::local_seed(seed)
fields <- warm_start_feature_schema()$feature
x <- as.data.frame(matrix(runif(15 * length(fields)), nrow = 15))
names(x) <- fields
x$n_tokens <- 11:25
x$token_length_mean <- 2 + 10 * x$token_length_mean
x$token_length_std <- 0.2 + x$token_length_std
x$dale_chall_readability_score <- 5 + 20 * x$dale_chall_readability_score
x <- data.frame(item_id = as.character(1:15), x)
attr(x, "warm_start_schema") <- "writing_features_v1"
x
}
features <- example_features(3103)
theta <- 10 + 0.4 * features$n_tokens - 2 * features$token_length_mean
# A small alpha grid keeps this example fast; the default has 41 values.
model <- fit_warm_start_model(features$item_id, theta, "synthetic-a",
features = features, alpha_grid = c(0, 1))
deployment <- prepare_warm_start_model(model,
metadata = list(name = "example", domain = "Synthetic demonstration"),
omit_audit = TRUE)
predict(deployment, features)
})
}
#> # A tibble: 15 × 3
#> item_id raw_prediction calibrated_prediction
#> <chr> <dbl> <dbl>
#> 1 1 0.529 0.553
#> 2 2 0.188 0.199
#> 3 3 0.125 0.134
#> 4 4 -1.67 -1.73
#> 5 5 0.790 0.825
#> 6 6 -1.76 -1.82
#> 7 7 0.859 0.896
#> 8 8 0.838 0.874
#> 9 9 0.922 0.961
#> 10 10 -1.20 -1.25
#> 11 11 -0.194 -0.198
#> 12 12 -0.709 -0.733
#> 13 13 -0.344 -0.354
#> 14 14 0.259 0.273
#> 15 15 1.36 1.42