aquakin.profile_likelihood#

aquakin.profile_likelihood(reactor, C0, observations, t_obs, free_params, *, grid, profile_param=None, profile_ic=None, delta=1.92, warm_start=True, polish=True, polish_passes=2, polish_tol=0.05, anchor=None, transforms=None, initial_params=None, observed_species=None, loss='nll', sigma=None, priors=None, use_priors=True, free_ic=None, optimizer=OptimizerConfig(method='lbfgsb', n_starts=8, jitter=0.5, jitter_schedule=None, seed=0, max_iter=500, tol=1e-06, param_halfwidth=None))[source]#

Profile-likelihood analysis of one parameter or initial condition.

Fixes the profiled quantity at each value in grid, re-optimises every other free quantity with aquakin.calibrate(), and returns the profile of best-attainable objective plus the likelihood-ratio confidence interval.

Exactly one of profile_param or profile_ic must be given. The profiled quantity is removed from the corresponding free set automatically if present. Single batch only: C0 / observations / t_obs are single arrays, not lists.

Parameters:
  • reactor (Reactor) – As for aquakin.calibrate() (single batch).

  • C0 (Array) – As for aquakin.calibrate() (single batch).

  • observations (Array) – As for aquakin.calibrate() (single batch).

  • t_obs (Array) – As for aquakin.calibrate() (single batch).

  • free_params (list[str]) – As for aquakin.calibrate() (single batch).

  • grid (array-like) – Values at which to fix the profiled quantity.

  • profile_param (str, optional) – Name of a rate parameter to profile.

  • profile_ic (str, optional) – Name of a species whose initial concentration to profile.

  • delta (float, optional) – Likelihood-ratio threshold for the confidence interval. Default 1.92 = 0.5 * chi2_{1, 0.95} (the one-degree-of-freedom 95% level). Use with loss="nll" and a calibrated sigma so the objective is a proper negative log-likelihood and the threshold is meaningful.

  • warm_start (bool, optional) – If True (default), run a cold multistart only at the anchor grid point and warm-start each subsequent point from its neighbour’s fit, so consecutive points stay in one local minimum (a continuation sweep). If False, run an independent multistart at every grid point.

  • polish (bool, optional) – If True (default), after the sweep re-fit any grid point whose loss exceeds a neighbour’s (by more than polish_tol), warm-started from that neighbour, for up to polish_passes passes. Removes points stranded in a worse local minimum than the continuation found nearby.

  • anchor (float, optional) – Grid value to start the continuation sweep from. Defaults to the grid midpoint. Ignored when warm_start=False.

  • initial_params (Array | None) – Forwarded to each inner aquakin.calibrate() call (free_ic is a FreeICConfig, optimizer an OptimizerConfig; the profiled parameter/species is removed from free_ic for the inner fits). optimizer.n_starts applies to the cold anchor (and to every point when warm_start=False); warm-started points use a single start. The inner fits force laplace=False (the profile, not the Laplace posterior, is the identifiability estimate here).

  • transforms (dict[str, str] | None) – Forwarded to each inner aquakin.calibrate() call (free_ic is a FreeICConfig, optimizer an OptimizerConfig; the profiled parameter/species is removed from free_ic for the inner fits). optimizer.n_starts applies to the cold anchor (and to every point when warm_start=False); warm-started points use a single start. The inner fits force laplace=False (the profile, not the Laplace posterior, is the identifiability estimate here).

  • observed_species (list[str] | None) – Forwarded to each inner aquakin.calibrate() call (free_ic is a FreeICConfig, optimizer an OptimizerConfig; the profiled parameter/species is removed from free_ic for the inner fits). optimizer.n_starts applies to the cold anchor (and to every point when warm_start=False); warm-started points use a single start. The inner fits force laplace=False (the profile, not the Laplace posterior, is the identifiability estimate here).

  • loss (str) – Forwarded to each inner aquakin.calibrate() call (free_ic is a FreeICConfig, optimizer an OptimizerConfig; the profiled parameter/species is removed from free_ic for the inner fits). optimizer.n_starts applies to the cold anchor (and to every point when warm_start=False); warm-started points use a single start. The inner fits force laplace=False (the profile, not the Laplace posterior, is the identifiability estimate here).

  • sigma – Forwarded to each inner aquakin.calibrate() call (free_ic is a FreeICConfig, optimizer an OptimizerConfig; the profiled parameter/species is removed from free_ic for the inner fits). optimizer.n_starts applies to the cold anchor (and to every point when warm_start=False); warm-started points use a single start. The inner fits force laplace=False (the profile, not the Laplace posterior, is the identifiability estimate here).

  • priors (dict[str, tuple[float, float]] | None) – Forwarded to each inner aquakin.calibrate() call (free_ic is a FreeICConfig, optimizer an OptimizerConfig; the profiled parameter/species is removed from free_ic for the inner fits). optimizer.n_starts applies to the cold anchor (and to every point when warm_start=False); warm-started points use a single start. The inner fits force laplace=False (the profile, not the Laplace posterior, is the identifiability estimate here).

  • use_priors (bool) – Forwarded to each inner aquakin.calibrate() call (free_ic is a FreeICConfig, optimizer an OptimizerConfig; the profiled parameter/species is removed from free_ic for the inner fits). optimizer.n_starts applies to the cold anchor (and to every point when warm_start=False); warm-started points use a single start. The inner fits force laplace=False (the profile, not the Laplace posterior, is the identifiability estimate here).

  • free_ic (FreeICConfig | None) – Forwarded to each inner aquakin.calibrate() call (free_ic is a FreeICConfig, optimizer an OptimizerConfig; the profiled parameter/species is removed from free_ic for the inner fits). optimizer.n_starts applies to the cold anchor (and to every point when warm_start=False); warm-started points use a single start. The inner fits force laplace=False (the profile, not the Laplace posterior, is the identifiability estimate here).

  • optimizer (OptimizerConfig) – Forwarded to each inner aquakin.calibrate() call (free_ic is a FreeICConfig, optimizer an OptimizerConfig; the profiled parameter/species is removed from free_ic for the inner fits). optimizer.n_starts applies to the cold anchor (and to every point when warm_start=False); warm-started points use a single start. The inner fits force laplace=False (the profile, not the Laplace posterior, is the identifiability estimate here).

  • polish_passes (int)

  • polish_tol (float)

Return type:

ProfileResult