| save_as | R Documentation | 
Functions to save a trained or untrained Ruta learner into a file and load it
save_as(
  learner,
  file = paste0(substitute(learner), ".tar.gz"),
  dir,
  compression = "gzip"
)
load_from(file)
| learner | The  | 
| file | In  | 
| dir | Directory where to save the file. Use  | 
| compression | Type of compression to be used, for R function  | 
save_as returns the filename where the model has been saved,
load_from returns the loaded model as a "ruta_autoencoder" object
x <- as.matrix(iris[, 1:4])
if (interactive() && keras::is_keras_available()) {
  # Save a trained model
  saved_file <-
    autoencoder(2) |>
    train(x) |>
    save_as("my_model.tar.gz", dir = tempdir())
  # Load and use the model
  encoded <- load_from(saved_file) |> encode(x)
}
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.