derivkit.forecasting.dali module#

DALI forecasting utilities.

derivkit.forecasting.dali.build_dali(function: Callable[[ArrayLike], floating | ndarray[tuple[Any, ...], dtype[floating]]], theta0: ArrayLike, cov: ArrayLike, *, method: str | None = None, n_workers: int = 1, **dk_kwargs: Any) tuple[ndarray[tuple[Any, ...], dtype[floating]], ndarray[tuple[Any, ...], dtype[floating]]]#

Builds the doublet-DALI tensors (G, H) for the given model.

Parameters:
  • function – The scalar or vector-valued function to differentiate. It should accept a list or array of parameter values as input and return either a scalar or a np.ndarray of observable values.

  • theta0 – The points at which the derivative is evaluated. A 1D array or list of parameter values matching the expected input of the function.

  • cov – The covariance matrix of the observables. Should be a square matrix with shape (n_observables, n_observables), where n_observables is the number of observables returned by the function.

  • method – Method name or alias (e.g., "adaptive", "finite"). If None, the derivkit.derivative_kit.DerivativeKit default is used.

  • n_workers – Number of workers for per-parameter parallelization/threads. Default 1 (serial). Inner batch evaluation is kept serial to avoid oversubscription.

  • dk_kwargs – Additional keyword arguments passed to derivkit.calculus_kit.CalculusKit.

Returns:

A tuple (G, H) where G has shape (P, P, P) and H has shape (P, P, P, P), with P being the number of model parameters.