impNNet() gains a draw mode: draw = "pmm"
(predictive mean matching) or draw = "normal" imputes by
draws from the predictive distribution, and the classification heads
sample from their softmax instead of taking the most probable class.
bootstrap = TRUE (the default in draw mode) fits every
column model on a bootstrap resample of the observed rows and validates
on the out-of-bag rows. Draw mode runs a fixed number of sweeps (default
5); point mode (draw = "none", the default) is
unchanged.getImputed(m = "long") returns all completed data sets
in the mice long format, and the new as_mids()
hands them to mice::pool(). It warns when the replicates
come from point mode.plot(imp, type = "trace") shows them, one line
per replicate.deepimp_arch(glm_offset = TRUE), the default): a linear
model under the regression heads, a multinomial logit
(nnet::multinom()) under the classification heads. The
correction starts at zero and the GLM state competes in restore-best, so
a head is never worse on its validation rows than its GLM.
glm_ridge adds a small ridge penalty against separation and
rare levels. glm_offset = FALSE gives the network of 1.1.0.
This applies to impNNetCoDa() as well.deepimp_control() collects the training settings:
epochs, patience, batch_size
(also "auto"), validation_split,
restore_best, lr_schedule = "plateau",
device ("cpu", "cuda",
"auto"; torch), num_threads,
warm_start, parallel and min_obs.
impNNet() and impNNetCoDa() take it as
control; their epochs, patience,
batch_size and validation_split arguments
remain as shortcuts.deepimp_arch(weight_decay = ) adds weight decay to the
MLP weights.deepimp_control(warm_start = TRUE) continues each
column model from its weights of the previous sweep, with a shorter
patience; the previous weights compete in restore-best.deepimp_control(parallel = TRUE) runs the replicates in
parallel with future.apply (torch backend); seeded results equal those
of a sequential run with the same number of torch threads.info$history.patience = 10 (was 40),
batch_size = "auto" (was 32), and warm starts in point
mode. In a simulation at n = 1000-3000 they were about ten times faster
than the 1.1.0 defaults, with no measurable loss of accuracy. Draw mode
refits from scratch in every sweep.impNNet(keep_models = TRUE) keeps the fitted models as
plain R arrays, and the new predict() method imputes new
data with them, without retraining, in the mode of the fit. The object
can be saved with saveRDS().summary() returns a "summary.deepimp"
object with a print method: mode, sweeps run, convergence per replicate
(info$converged), epochs per fit and the variables caught
by a safeguard. A new help page ?deepimp documents the
object.verbose has three levels: 0 silent,
1 a progress bar, 2 a log of every fit
(TRUE means 1).m,
iterations, eps, seed, …).min_obs (default 20) observed values keep their starting
values, with a warning; more encoded predictors than observed rows give
a warning. info$skipped lists them.keep_models, no parallel replicates, no
device). Both backends now share the early-stopping rule:
for a GLM-offset head the patience counts from the untrained state
(keras: baseline of the early-stopping callback). New tests
check the shared stopping and restore-best semantics and comparable
accuracy.impNNetCoDa() and initialize = "kNNa" need it.
This removes 58 of 103 recursive hard dependencies. future and
future.apply (parallel replicates) and mice (as_mids()) are
suggested too.predict() for new data,
compositional data, and backend setup including Python for keras3.data-raw/beer.R
documenting how the beer data were derived
(vnewold2: 1 = fresh, 2 = aged).Major rewrite of the package for a configurable, dual-backend neural-network imputer.
deepimp_arch() (number and size of hidden layers, dropout,
activation, batch normalisation, optimiser, learning rate), replacing
the previously hard-coded network.torch backend (default; no
Python required) and an optional keras3 backend, selected
with backend = "torch" / "keras".impNNetCoDa() reimplemented on the shared imputation
engine for rounded zeros in compositional data, with
correction = "truncate" (default, Templ 2021),
"expectation", or "none"."deepimp" object; read the
completed data with getImputed() (or
as.data.frame()), and inspect with print(),
summary(), and plot().seed argument. Reproducibility
is exact when dropout = 0; with dropout > 0
the backend’s training-time randomness is not fully pinned by the seed
in the current torch build (repeated runs are close but may not be
bit-identical).vignette("deepImp"), and a package overview
page (?deepImp).impNNetCoDa(initialize = "kNNa") no longer aborts at
high rounded-zero rates. The compositional-kNN initialiser
(robCompositions::impKNNa()) can fail with
'probs' not in [0, 1] when a large fraction of every part
falls below the detection limit; the initialiser now falls back to
knn (with a warning) instead of stopping the
imputation.impNNet() was redesigned. Legacy arguments
dense, small, normalize_x, and
normalize_y are soft-deprecated (a warning maps them onto
the new API). The arguments model_numeric,
model_binary, model_nominal, and
loss were removed; configure the network through
arch and backend instead.m > 1, impNNet() /
impNNetCoDa() return several completed data sets. These are
stochastic replicate completions, not statistically valid multiple
imputation.