Skip to contents

Serializes a pptr or pprf model to JSON format compatible with the C++ CLI. The JSON includes the model structure, group labels, training parameters, and optionally variable importance metrics.

Usage

save_json(model, path, ...)

# S3 method for class 'ppmodel'
save_json(model, path, include_metrics = TRUE, ...)

Arguments

model

A pptr or pprf model (inheriting from ppmodel).

path

File path to write the JSON to. If it does not end in .json, that suffix is appended.

...

Additional arguments (currently unused).

include_metrics

If TRUE (default), include variable importance and (for forests) OOB error in the output. Set to FALSE to save only the model structure and metadata.

Value

Invisibly returns the path of the written file, as a character string, including any appended .json suffix. Called for its side effect of serializing model to that file.

See also

Examples

model <- pptr(Species ~ ., data = iris, seed = 0)
path <- tempfile(fileext = ".json")
save_json(model, path)