Save and load a model
save_model.Rdsave_model() writes a fitted model to an RDS file: the Rust fit as a
versioned JSON artifact (spec, estimates, covariance, fit statistics,
fitted values, and provenance with the package version and a hash of
the training data; for a GAM also the spline knots and constraints; for
an elastic net one artifact per lambda; for a network its feature
scaling and every weight; for a Bayesian model its draws and sampler
diagnostics), with the formula terms, factor levels and other settings
that stats::predict() needs. load_model() reads it back; the
estimates round-trip exactly. A loaded model predicts and simulates but
has no training data, so robust_vcov(), and LOO and the posterior
predictive checks of a bayes_glm_fit() model, need the original fit.
Arguments
- model
A model from
glm_fit(),gam_fit(),elastic_net_fit(),glmm_fit(),bayes_glm_fit(),bayes_glmm_fit(),dglm_fit(),zeroinfl_fit(),hurdle_fit(),expectreg_fit(),cann_fit(),attention_cann_fit()ortabular_net_fit().- file
Path of the RDS file.