Saves an impute_result to a directory. R-native fields are written
to an RDS file. The CISSVAE PyTorch model, if present, is saved
separately as a state_dict checkpoint (.pt) so that the live
Python object is never passed to saveRDS (which cannot serialise it).
The model architecture is captured automatically from the live object and
stored inside the RDS so that load_impute_result can
reconstruct it without any additional input from the user.
Arguments
- x
An object of class
impute_result.- dir
Character string. Path to the directory in which to write files. Created recursively if it does not exist.
- name
Character string. Base name used for output files. Defaults to
"result". Two files are written:<name>.rds— R data (all fields except the live model).<name>_state_dict.pt— PyTorch model weights.
- overwrite
Logical. If
FALSE(default), an error is raised when output files already exist. Set toTRUEto overwrite silently.
Value
Invisibly, a named list with elements meta (path to the RDS)
and model (path to the .pt file, or NULL if no model
was present).