derivkit.forecasting.dali_bias module#
DALI systematic-bias tensor utilities.
- derivkit.forecasting.dali_bias.build_dali_bias_tensor(function: Callable[[Sequence[float] | NDArray[floating]], floating | NDArray[floating]], theta0: Sequence[float] | NDArray[floating], cov: Sequence[Sequence[float]] | NDArray[floating], delta_nu: Sequence[float] | NDArray[floating] | Sequence[Sequence[float]], *, bias_order: int = 3, method: str | None = None, n_workers: int = 1, **dk_kwargs: Any) dict[int, NDArray[float64]]#
Builds the systematic mismatch tensors entering the DALI bias expansion.
The tensors describe how the data-model mismatch
delta_nucouples to successive derivatives of the model.- Parameters:
function – The scalar or vector-valued model function.
theta0 – Fiducial parameter values at which derivatives are evaluated.
cov – Covariance matrix of the observables.
delta_nu – Difference between two data vectors, which may represent a systematic mismatch or a difference between model predictions. Accepts a 1D array or a column vector of shape
(n_observables, 1). The input is flattened internally.bias_order – Highest mismatch tensor order to compute. Supported values are given in
derivkit.forecasting.forecast_core.SUPPORTED_DERIVATIVE_ORDERS.method – Numerical differentiation method. If
None, thederivkit.derivative_kit.DerivativeKitdefault is used.n_workers – Number of workers for per-parameter parallelization/threads. Default
1(serial).**dk_kwargs – Additional keyword arguments passed to DerivKit’s differentiation machinery.
- Returns:
A dictionary mapping derivative orders 1 through
bias_orderto their corresponding mismatch tensors. Zeroth-order terms are omitted because they are independent of the parameter displacement.- Raises:
TypeError – If
bias_orderis not an integer.ValueError – If
bias_orderis unsupported,theta0is empty, or the data mismatch does not match the number of observables.