vaeac_impute_missing_entries: Impute Missing Values Using Vaeac

View source: R/approach_vaeac.R

vaeac_impute_missing_entriesR Documentation

Impute Missing Values Using Vaeac

Description

Impute Missing Values Using Vaeac

Usage

vaeac_impute_missing_entries(
  x_explain_with_NaNs,
  n_samples,
  vaeac_model,
  checkpoint,
  sampler,
  batch_size,
  verbose = 0,
  seed = NULL,
  n_explain = NULL,
  index_features = NULL
)

Arguments

x_explain_with_NaNs

A 2D matrix, where the missing entries to impute are represented by NaN.

n_samples

Integer. The number of imputed versions we create for each row in x_explain_with_NaNs.

vaeac_model

An initialized vaeac model that we are going to use to generate the MC samples.

checkpoint

List containing the parameters of the vaeac model.

sampler

A sampler object used to sample the MC samples.

batch_size

Positive integer (default is 64). The number of samples to include in each batch during the training of the vaeac model. Used in torch::dataloader().

verbose

Boolean. An integer specifying the level of verbosity. Use 0 (default) for no verbosity, 1 for low verbose, and 2 for high verbose.

seed

Positive integer (default is 1). Seed for reproducibility. Specifies the seed before any randomness based code is being run.

n_explain

Positive integer. The number of explicands.

index_features

Optional integer vector. Used internally in shapr package to index the coalitions.

Details

Function that imputes the missing values in 2D matrix where each row constitute an individual. The values are sampled from the conditional distribution estimated by a vaeac model.

Value

A data.table where the missing values (NaN) in x_explain_with_NaNs have been imputed n_samples times. The data table will contain extra id columns if index_features and n_explain are provided.

Author(s)

Lars Henry Berge Olsen


NorskRegnesentral/shapr documentation built on April 19, 2024, 1:19 p.m.