The hardware and bandwidth for this mirror is donated by dogado GmbH, the Webhosting and Full Service-Cloud Provider. Check out our Wordpress Tutorial.
If you wish to report a bug, or if you are interested in having us mirror your free-software or open-source project, please feel free to contact us at mirror[@]dogado.de.

Saving and Using Saved Models

2026-03-03

Saving a trained CISS-VAE model

library(reticulate)
library(rCISSVAE)

# Train a model
res <- run_cissvae(data)

# Save the trained model to disk
save_cissvae_model(res$model, "trained_vae.pt")

# IMPORTANT
# The Python environment must be active so 'torch' can be imported.

Loading a saved model and imputing data

library(rCISSVAE)
library(reticulate)

## Activate your Python environment 
reticulate::use_virtualenv("cissvae_environment", required = TRUE)

## Load full model object
model <- load_cissvae_model(
  file = "trained_vae.pt"
)

## Perform imputation on new data
# Make sure your `data` has valid NAs and `clusters` vector is ready
imputed_df <- impute_with_cissvae(
  model_py = model,
  data = data,
  index_col = "index",
  columns_ignore = NULL,
  clusters = clusters,
  imputable_matrix = NULL,
  binary_feature_mask = NULL,
  val_proportion = 0.1,
  replacement_value = 0,
  batch_size = 4000L,
  seed = 42
)

# `imputed_df` is returned to R as a data.frame

If you have binary variables in your dataset, make sure to define the binary_feature_mask and convert the probabilities for the binary variables into {0, 1} values using desired thresholding.

These binaries (installable software) and packages are in development.
They may not be fully stable and should be used with caution. We make no claims about them.
Health stats visible at Monitor.