Inverse of apply_recipe(). Accepts a data frame or an atomic vector.
For an atomic factor / character vector with a recipe that holds
multiple level maps, column must name which map to invert. Atomic
numeric, integer, logical, and Date / POSIXct vectors are
returned unchanged (no inverse map applies — these are pass-through
under apply_recipe() too).
Arguments
- x
A data frame or an atomic vector to translate from synthetic-namespace to original-namespace.
- rec
A
masque_recipeobject.- column
Optional column name. Only consulted for atomic factor / character
xwhen the recipe holds more than one level map. Ignored for atomic numeric / logical / Date-like input (pass-through), but if supplied is validated against the recipe's known columns.
Details
The most common pattern is round-tripping pipeline predictions:
fit <- my_model(synthetic(m)) # train on synthetic
orig_in_synth_space <- apply_recipe(original, recipe(m)) # forward
preds_synth <- predict(fit, orig_in_synth_space)
preds_orig <- unmask(preds_synth, recipe(m)) # inverseUnknown levels (synthetic aliases not in the recipe's map) fail
closed with an informative error rather than silently coercing to
NA.