lik {arf}  R Documentation 
Compute the density of input data.
lik(arf, params, x, oob = FALSE, log = TRUE, batch = NULL, parallel = TRUE)
arf 
Pretrained 
params 
Parameters learned via 
x 
Input data. Densities will be computed for each sample. 
oob 
Only use outofbag leaves for likelihood estimation? If

log 
Return likelihoods on log scale? Recommended to prevent underflow. 
batch 
Batch size. The default is to compute densities for all of

parallel 
Compute in parallel? Must register backend beforehand, e.g.
via 
This function computes the density of input data according to a FORDE model using a pretrained ARF. Each sample's likelihood is a weighted average of its likelihood in all leaves whose split criteria it satisfies. Intraleaf densities are fully factorized, since ARFs satisfy the local independence criterion by construction. See Watson et al. (2022).
A vector of likelihoods, optionally on the log scale.
Watson, D., Blesch, K., Kapar, J., & Wright, M. (2022). Adversarial random forests for density estimation and generative modeling. arXiv preprint, 2205.09435.
# Estimate average loglikelihood
arf < adversarial_rf(iris)
psi < forde(arf, iris)
ll < lik(arf, psi, iris, log = TRUE)
mean(ll)