Skip to contents

Serialises a pigauto_fit object to disk, including the torch model state. The saved file can be loaded on any machine with the same pigauto version.

Usage

save_pigauto(fit, path, compress = TRUE)

Arguments

fit

pigauto_fit object.

path

character. File path to save to (recommended extension: .pigauto).

compress

logical. Use gzip compression (default TRUE).

Value

Invisible path.

Details

Standard saveRDS() does not work for pigauto fits because torch tensor states cannot be serialised by R's native mechanism. This function converts the model state to a portable raw format before saving.

Examples

if (FALSE) { # \dontrun{
save_pigauto(fit, "my_model.pigauto")
fit2 <- load_pigauto("my_model.pigauto")
} # }