aquakin.CalibrationResult#
- class aquakin.CalibrationResult(params, params_named, loss, converged, message, n_iter, parameter_names, transforms, posterior_cov=None, posterior_std_unconstrained=None, params_named_std=None, hessian_unconstrained=None, priors_applied=<factory>, C0_fitted=None, ic_named=None)[source]#
Bases:
objectResult of
calibrate().- Variables:
params (jnp.ndarray) – Full parameter vector after optimisation (fixed entries unchanged).
params_named (dict[str, float]) – Free parameters by namespaced name, in physical space.
loss (float) – The full scalar objective at the MAP: the summed data loss plus any prior penalty. It is the same value regardless of
optimizer— forloss="nll"it is the complete Gaussian negative log-likelihood (including thesum(log(sigma))normaliser), not the Gauss-Newton0.5*||residual||^2(which drops that constant).converged (bool) – Whether SciPy declared convergence.
message (str) – Optimiser status message.
n_iter (int) – Optimiser iteration count:
nitfor the L-BFGS-B optimiser, and the Jacobian-evaluation count (njev, ~one per trust-region iteration) for the Gauss-Newton least-squares optimiser, which exposes no direct iteration count. Either way it is an iteration-scale figure, not the raw residual/function-evaluation count.parameter_names (list[str]) – Ordered free-parameter names. Matches the rows / cols of
posterior_covandhessian_unconstrainedwhen present.transforms (list[str]) – Transform used for each free parameter, in the same order.
posterior_cov (jnp.ndarray, optional) –
(d, d)covariance matrix in unconstrained space (Laplace).Noneiflaplace=Falsewas passed.posterior_std_unconstrained (jnp.ndarray, optional) – Marginal std devs in unconstrained space.
params_named_std (dict[str, float], optional) – Marginal std devs propagated back to physical space via the delta method (
|dp/dtheta| * std_unconstrained).hessian_unconstrained (jnp.ndarray, optional) – Raw FD Hessian of the loss at the MAP, unconstrained-space.
priors_applied (dict[str, tuple[float, float]], optional) – Gaussian priors (physical-space
(mean, std)) that were added to the objective, by free-parameter name. Empty if no priors were active.C0_fitted (list[jnp.ndarray], optional) – When
free_icis used, the fitted initial-state vector for each dataset (full species vectors, free pools set to their fitted values).Noneif no initial conditions were fit.ic_named (list[dict[str, float]], optional) – When
free_icis used, the fitted free initial pools per dataset, by species name.Noneif no initial conditions were fit.
- Parameters:
params (Array)
params_named (dict[str, float])
loss (float)
converged (bool)
message (str)
n_iter (int)
parameter_names (list[str])
transforms (list[str])
posterior_cov (Array | None)
posterior_std_unconstrained (Array | None)
params_named_std (dict[str, float] | None)
hessian_unconstrained (Array | None)
priors_applied (dict[str, tuple[float, float]])
C0_fitted (list | None)
ic_named (list | None)
- __init__(params, params_named, loss, converged, message, n_iter, parameter_names, transforms, posterior_cov=None, posterior_std_unconstrained=None, params_named_std=None, hessian_unconstrained=None, priors_applied=<factory>, C0_fitted=None, ic_named=None)#
- Parameters:
params (Array)
params_named (dict[str, float])
loss (float)
converged (bool)
message (str)
n_iter (int)
parameter_names (list[str])
transforms (list[str])
posterior_cov (Array | None)
posterior_std_unconstrained (Array | None)
params_named_std (dict[str, float] | None)
hessian_unconstrained (Array | None)
priors_applied (dict[str, tuple[float, float]])
C0_fitted (list | None)
ic_named (list | None)
- Return type:
None
Methods
__init__(params, params_named, loss, ...[, ...])predictive_band(reactor, C0, t_eval, *[, ...])Posterior-predictive band by propagating Laplace draws through a solve.
Attributes
C0_fittedhessian_unconstrainedic_namedparams_named_stdposterior_covposterior_std_unconstrainedparamsparams_namedlossconvergedmessagen_iterparameter_namestransformspriors_applied- predictive_band(reactor, C0, t_eval, *, n_draw=200, percentiles=(2.5, 97.5), seed=0, eig_keep=None, observed_species=None)[source]#
Posterior-predictive band by propagating Laplace draws through a solve.
Samples the calibrated parameters from the Laplace posterior
N(MAP, posterior_cov), inverse-transforms each draw to physical space, sets it into the fitted parameter vector, integratesreactorfromC0overt_eval, and returns the pointwise percentile envelope across draws. The draws are taken fromself.posterior_cov— the same eigen-truncated covariance behindparams_named_std— so the band and the reported marginal std devs regularise identically. The non-identifiable directions were already dropped (at calibrate time, vialaplace_eig_keep), so they carry zero variance and the draws stay finite.Requires that the calibration was run with
laplace=True(so a Hessian is available). The suppliedC0may differ from the calibration initial state — e.g. propagate the calibrated-rate uncertainty through a held-out / validation batch.- Parameters:
reactor (Reactor) – Reactor to integrate (forward solves only; any adjoint is fine).
C0 (jnp.ndarray) – Initial state to propagate.
t_eval (jnp.ndarray) – Output times; the band is reported at these points.
n_draw (int) – Number of posterior draws.
percentiles (tuple[float, float]) – Lower / upper band percentiles (default the central 95%).
seed (int) – Seed for the draws (reproducible).
eig_keep (float, optional) – Deprecated and ignored. The identifiable-subspace truncation is now applied once, at calibrate time, via
calibrate(laplace=LaplaceConfig(eig_keep=...)), so the band andparams_named_stdshare one regulariser. Passing a value here emits aDeprecationWarning.observed_species (list[str], optional) – Restrict the returned band to these species.
Nonereturns all.
- Return type: