View source: R/sample_from_leaves.R
| sample_from_leaves | R Documentation |
Draws synthetic samples by sampling, for each observation, a leaf from the
forest and then drawing each feature independently (marginally) from the real
observations that fall into that leaf. This is the intra-leaf sampling step
used internally by adversarial_rf to generate synthetic data
during the adversarial loop, exposed here as a stand-alone function.
sample_from_leaves(
arf,
x_real,
params = NULL,
round = TRUE,
factor_cols = NULL,
lvls = NULL,
prep = TRUE
)
arf |
A trained ARF, as returned by |
x_real |
Data whose intra-leaf structure is used for sampling, typically the data the forest was trained on. |
params |
Optional circuit parameters as returned by |
round |
Round continuous variables to their maximum precision in the real
data? Only relevant when |
factor_cols |
Optional logical vector flagging the factor columns of
|
lvls |
Optional list of factor levels for the factor columns of
|
prep |
Prepare |
A dataset of nrow(x_real) synthetic samples. When params
is supplied, its class and column types match the original data; otherwise a
data.table with factor columns encoded as character.
Watson, D., Blesch, K., Kapar, J., & Wright, M. (2023). Adversarial random forests for density estimation and generative modeling. In Proceedings of the 26th International Conference on Artificial Intelligence and Statistics, pp. 5357-5375.
adversarial_rf, forde, forge
arf <- adversarial_rf(iris)
# Minimally processed output (factors as character)
x_synth <- sample_from_leaves(arf, iris)
# Fully post-processed output, consistent with forge()
psi <- forde(arf, iris)
x_synth <- sample_from_leaves(arf, iris, params = psi)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.