Skip to contents

Performs hyperparameter optimization for CISS-VAE using Optuna, with support for Rich progress bars and flexible layer arrangement strategies.

Usage

autotune_cissvae(
  data,
  index_col = NULL,
  val_proportion = 0.1,
  replacement_value = 0,
  columns_ignore = NULL,
  clusters,
  save_model_path = NULL,
  save_search_space_path = NULL,
  n_trials = 20,
  study_name = "vae_autotune",
  device_preference = "cuda",
  show_progress = FALSE,
  optuna_dashboard_db = NULL,
  load_if_exists = TRUE,
  seed = 42,
  verbose = FALSE,
  constant_layer_size = FALSE,
  evaluate_all_orders = FALSE,
  max_exhaustive_orders = 100,
  num_hidden_layers = c(1, 4),
  hidden_dims = c(64, 512),
  latent_dim = c(10, 100),
  latent_shared = c(TRUE, FALSE),
  output_shared = c(TRUE, FALSE),
  lr = c(1e-04, 0.001),
  decay_factor = c(0.9, 0.999),
  beta = 0.01,
  num_epochs = 500,
  batch_size = 4000,
  num_shared_encode = c(0, 1, 3),
  num_shared_decode = c(0, 1, 3),
  encoder_shared_placement = c("at_end", "at_start", "alternating", "random"),
  decoder_shared_placement = c("at_start", "at_end", "alternating", "random"),
  refit_patience = 2,
  refit_loops = 100,
  epochs_per_loop = 500,
  reset_lr_refit = c(TRUE, FALSE)
)

Arguments

data

Data frame or matrix containing the input data

index_col

String name of index column to preserve (optional)

clusters

Integer vector specifying cluster assignments for each row

save_model_path

Optional path to save the best model's state_dict

save_search_space_path

Optional path to save search space configuration

n_trials

Number of Optuna trials to run

study_name

Name identifier for the Optuna study

device_preference

Preferred device ("cuda" or "cpu")

show_progress

Whether to display Rich progress bars during training

optuna_dashboard_db

RDB storage URL/file for Optuna dashboard

load_if_exists

Whether to load existing study from storage

seed

Base random seed for reproducible results

verbose

Whether to print detailed diagnostic information

constant_layer_size

Whether all hidden layers use same dimension

evaluate_all_orders

Whether to test all possible layer arrangements

max_exhaustive_orders

Max arrangements to test when evaluate_all_orders=TRUE

num_hidden_layers

Numeric(2) vector: (min, max) for number of hidden layers

hidden_dims

Numeric vector: hidden layer dimensions to test

latent_dim

Numeric(2) vector: (min, max) for latent dimension

latent_shared

Logical vector: whether latent space is shared across clusters

output_shared

Logical vector: whether output layer is shared across clusters

lr

Numeric(2) vector: (min, max) learning rate range

decay_factor

Numeric(2) vector: (min, max) LR decay factor range

beta

Numeric: KL divergence weight (fixed or range)

num_epochs

Integer: number of initial training epochs (fixed or range)

batch_size

Integer: mini-batch size (fixed or range)

num_shared_encode

Numeric vector: numbers of shared encoder layers to test

num_shared_decode

Numeric vector: numbers of shared decoder layers to test

encoder_shared_placement

Character vector: placement strategies for encoder shared layers

decoder_shared_placement

Character vector: placement strategies for decoder shared layers

refit_patience

Integer: early stopping patience for refit loops

refit_loops

Integer: maximum number of refit loops

epochs_per_loop

Integer: epochs per refit loop

reset_lr_refit

Logical vector: whether to reset LR before refit

Value

List containing imputed data, best model, study object, and results dataframe