Returns closures for value and gradient evaluation of a score at any
parameter vector theta, using analytic or finite-difference derivatives.
Usage
score_diff_path(
score,
data,
ctx = NULL,
method = c("auto", "analytic", "fd"),
fd_step = NULL,
fd_scheme = NULL
)Arguments
- score
A
ustat_score.- data
Data object passed to score evaluators.
- ctx
Optional context from
score_setup(). IfNULL, one is created viascore_setup().- method
One of
c("auto", "analytic", "fd")for gradients.- fd_step
Optional finite-difference step override.
- fd_scheme
Optional finite-difference scheme override.
Value
A list with closures:
value(idxs, theta, rng = NULL)for one subset;value_batch(subs, theta, rng = NULL)for many subsets;grad(idxs, theta, rng = NULL)for one-subset gradients;grad_batch(subs, theta, rng = NULL)for batch gradients;metawith derivative settings.