tuneHyperparams: Hyperparameter tuning used by NIMIWAE() function

View source: R/tuneHyperparams.R

tuneHyperparamsR Documentation

Hyperparameter tuning used by NIMIWAE() function

Description

Hyperparameter tuning used by NIMIWAE() function

Usage

tuneHyperparams(
  FUN = NULL,
  method = "NIMIWAE",
  dataset,
  data,
  data_types,
  data_types_0,
  Missing,
  g,
  rdeponz = F,
  learn_r = T,
  phi0 = NULL,
  phi = NULL,
  Cs,
  ignorable = F,
  covars_r = rep(1, ncol(data)),
  arch = "IWAE",
  draw_xmiss = T,
  sigma = "elu",
  h = c(128L, 64L),
  n_hidden_layers = c(1L, 2L),
  n_hidden_layers_r0 = NULL,
  bs = 1000L,
  lr = c(0.001, 0.01),
  dim_z = as.integer(c(floor(ncol(data)/2), floor(ncol(data)/4))),
  niws = 5L,
  n_imputations = 5L,
  n_epochs = 2002L,
  data_types_HIVAE = NULL,
  one_hot_max_sizes = NULL,
  ohms = NULL,
  MissingDatas = NULL,
  save_imps = F,
  dir_name = ".",
  normalize = T
)

Arguments

FUN

run_<> function for other methods (not NIMIWAE)

method

String specifying the method to tune hyperparameters. Can be "NIMIWAE" (default), "MIWAE", "VAEAC", "HIVAE", "MEAN", or "MF". Hyperparameters are not tuned for "MEAN" or "MF"

data

Data matrix (N x P)

data_types

vector of length=ncol(data). Valid values: "real", "count", "cat" or "pos"

Missing

Missingness mask matrix (N x P)

g

Training-validation-test split partitioning

rdeponz

TRUE/FALSE: Whether to allow missingness (r) to depend on the latent variable (z). Default is FALSE

learn_r

TRUE/FALSE: Whether to learn missingness model via appended NN (TRUE, default), or fit a known logistic regression model (FALSE). If FALSE, 'phi0' and 'phi' must be specified

phi0

(optional) Intercept of logistic regression model, if learn_r = FALSE.

phi

(optional) Vector of coefficients of logistic regression model for each input covariates 'covars_r', if learn_r = FALSE. 'phi' must be the same length as the number of input covariates, or 'sum(covars_r)'.

Cs

(optional) # factors for categorical variables. Must be of length = # of categorical variables.

ignorable

TRUE/FALSE: Whether missingness is ignorable (MCAR/MAR) or nonignorable (MNAR, default). If missingness is known to be ignorable, "ignorable=T" omits missingness model.

covars_r

Vector of 1's and 0's of whether each feature is included as covariates in the missingness model. Need not be specified if 'ignorable = T'. Default is using all features as covariates in missingness model. Must be length P (or 'ncol(data)')

arch

Architecture of NIMIWAE. Can be "IWAE" or "VAE". "VAE" is specific case of the "IWAE" where only one sample is drawn from the joint posterior of (z, xm).

sigma

activation function ("relu" or "elu")

h

integer, number of nodes per hidden layer

n_hidden_layers

integer, #hidden layers (except missingness model Decoder_r)

bs

integer, batch size (training)

lr

float, learning rate

dim_z

integer, dimensionality of latent z. Default: 5

data_types_HIVAE

Specify for HIVAE only.

one_hot_max_sizes

Specify for VAEAC only.

ohms

Specify for VAEAC only.

MissingDatas

Specify for VAEAC only.

n_hidden_layers_r

integer, #hidden layers for Decoder_r (default: 0)

niw

integer, number of importance weights (samples drawn from each latent space). Default: 5

n_epoch

integer, maximum number of epochs (without early stop). Default: 2002

Value

res object: method's fit on test set, after training on training set and validating best set of hyperparameter values using the validation set.

Author(s)

David K. Lim, deelim@live.unc.edu

References

https://github.com/DavidKLim/NIMIWAE


DavidKLim/NIMIWAE documentation built on Jan. 19, 2024, 11:18 p.m.