An S7 representation of a target density that proxymix is asked to
approximate. A target may carry an evaluable log_density, a matrix of
i.i.d. samples, or both. Each of the three fitting regimes consumes a
different subset:
Arguments
- n_dim
Integer scalar — the ambient dimension
p(the property is calledn_dimrather thandimbecause S7 reservesdimas an attribute name).- log_density
Optional function:
function(x)taking a numeric matrixnbypand returning a length-nnumeric vector oflog f(x).- samples
Optional
nbypnumeric matrix of i.i.d. samples from the target.- support
Optional declaration of the target's support.
NULL(the default) means the full \(\mathbb{R}^p\). Otherwise a listlist(lower = , upper = )of per-coordinate bounds, each of length 1 (recycled) orn_dim, with-Inf/Infpermitted for unbounded coordinates. A bounded or one-sided support drives automatic support-matched importance proposal selection in regime (iii); seefit_kld_em().- normalised
Logical scalar declaring whether
log_densityintegrates to one.TRUE,FALSE, orNA(unknown). Defaults toNA. Downstream diagnostics treatNAandFALSEidentically and label any KLD estimate as shifted.- log_normalizer
Numeric scalar
log Z(f)of the suppliedlog_density, if known. DefaultNA_real_. Whennormalised = FALSEandlog_normalizeris finite, downstream diagnostics can correct shifted KLD estimates by+ log_normalizer.- name
Human-readable name.
- metadata
Optional list of additional descriptors.
Details
regime
"moment"needs samples (or both moments via metadata);regime
"sample"needs samples;regime
"kld"needs the log-density.
Use gmm_target() or gmm_target_from_samples() to construct.
Importance-sampled KLD-EM (regime "kld") only requires log_density
to be specified up to an unknown additive constant — the self-normalised
weights are invariant to scaling. The package's diagnostics downstream,
however, do depend on normalisation: an importance-sampled KLD estimate
against an unnormalised log-density measures
\(\widehat{KL}(f \Vert g) - \log Z(f)\) rather than
\(\widehat{KL}(f \Vert g)\), and a squared-Hellinger Monte Carlo
estimate is only meaningful when both densities integrate to one.
Declare the target's normalisation explicitly via normalised (and,
where possible, supply log_normalizer) so that the package can label
shifted KLDs as shifted and refuse misleading Hellinger reports.
See also
Other classes:
autoplot.gmm_fit,
glance.gmm_fit,
gmm(),
gmm_counterfactual_law(),
gmm_dim(),
gmm_fit(),
gmm_n_components(),
gmm_weights(),
is_proposal(),
tidy.gmm
Examples
tgt <- banana_target()
tgt
#> <gmm_target>: "banana" in p = 2 dimensions
#> log_density : supplied
#> samples : <absent>
#> normalised : TRUE
#> log Z(f) : 0