load_json: Load a model from a JSON file.

View source: R/json.R

load_jsonR Documentation

Load a model from a JSON file.

Description

Deserializes a pptr or pprf model from a JSON file. The model can be used for prediction immediately. If variable importance metrics and OOB fields were saved, they are restored into the model's lazy-computation cache so later accessor calls (oob_error(), permuted_importance(), etc.) return the stored values without recomputation.

Usage

load_json(path)

Arguments

path

File path to read the JSON from.

Details

Note that formula, x, and y are not stored in the JSON and will be NULL on the loaded model. Formula-based prediction and any accessor that requires training data will error unless the user re-attaches those fields.

Value

A pptr or pprf model (with the appropriate _classification / _regression subclass).

See Also

save_json, pptr, pprf

Examples

model <- pptr(Species ~ ., data = iris, seed = 0)
path <- tempfile(fileext = ".json")
save_json(model, path)
loaded <- load_json(path)
predict(loaded, as.matrix(iris[, 1:4]))


ppforest2 documentation built on July 21, 2026, 9:07 a.m.