Imputation of missing values with configurable neural networks, for
mixed-type data (impNNet()) and compositional data with
rounded zeros (impNNetCoDa()). Every network head is a
generalised linear model plus a neural-network correction, so the
network adds non-linear effects and interactions on top of a GLM fit.
Models run on a native torch
backend by default (no Python required), or optionally on keras3.
mice
(as_mids()).deepimp_arch()) and training
settings (deepimp_control(): early stopping, learning-rate
schedule, warm starts, parallel replicates, device) as validated
objects.summary(), convergence and chain-trace
plots, per-fit training history.keep_models = TRUE, predict()).install.packages("deepImp") # CRAN release
# remotes::install_github("matthias-da/deepImp") # development version
torch::install_torch() # the default backend: native libtorch, no Python
# optional: the keras backend (Python + TensorFlow)
# install.packages("keras3"); keras3::install_keras()impNNetCoDa() also needs the
robCompositions package, and as_mids() the
mice package.
Mixed-type imputation, point mode:
library(deepImp)
data(sleep, package = "VIM")
imp <- impNNet(sleep, arch = deepimp_arch_small(), epochs = 50, seed = 1)
summary(imp)
completed <- getImputed(imp)Multiple imputation and pooled inference:
mi <- impNNet(sleep, arch = deepimp_arch_small(dropout = 0), m = 5, draw = "pmm",
epochs = 50, seed = 1)
fit <- with(as_mids(mi), lm(Sleep ~ log(BodyWgt) + Danger))
summary(mice::pool(fit))Compositional data (rounded zeros below a detection limit):
x <- data.frame(a = runif(50, 5, 10), b = runif(50, 5, 10), c = runif(50, 5, 10))
x$a[1:5] <- 0
imp <- impNNetCoDa(x, dl = c(1, 1, 1), label = 0, arch = deepimp_arch_small(), seed = 1)
getImputed(imp)See vignette("deepImp") for a full walkthrough.
Templ, M. (2021). Imputation of rounded zeros for compositional data using neural networks. In: Advances in Compositional Data Analysis (Festschrift). Springer.