Skip to content

Robust BART from_json: safe defaults and warnings for missing fields #319

@andrewherren

Description

@andrewherren

Part of #315 (cross-version deserialization, RFC 0002).

Update BART from_json() (Python) and the R BART deserialization functions to check for each optional field before reading it, falling back to a safe default and emitting a warning that names the field, the assumed default, and the inferred version bracket (from #318).

Missing field Safe default
covariate_preprocessor / preprocessor_metadata None / NULL — warn; disables DataFrame prediction
rfx_model_spec "" / None — warn if has_rfx = TRUE
has_rfx_basis FALSE / False
num_rfx_basis 1
outcome (in outcome_model) "continuous"
link (in outcome_model) "identity"
probit_outcome_model FALSE / False
cloglog_num_categories 0
num_chains 1
keep_every 1

Hard errors should be reserved for genuinely unrecoverable fields (forest structures, outcome_scale, outcome_mean).

Affects: stochtree/bart.py, R/bart.R

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions