Estimate DLM parameters (obsStd, processStd, and optionally arCoefficients)
by maximum likelihood via autodiff.
The entire optimization step — valueAndGrad(loss) (Kalman filter forward
pass + AD backward pass) and optax Adam moment/parameter updates — is
wrapped in a single jit() call, so every iteration runs from compiled code.
The parameterization maps unconstrained reals → positive values:
obsStd = exp(θ_s), processStd[i] = exp(θ_{w,i})
AR coefficients (when fitAr = true) are optimized directly
(unconstrained — not log-transformed, matching MATLAB DLM behavior).
When obsStdFixed is supplied (a per-timestep σ array, e.g. known measurement
uncertainties), the observation noise is not estimated — it is treated as
a known constant. Only processStd (and optionally arCoefficients) are optimized.
The returned obsStd field will be NaN in this case.
Estimate DLM parameters (obsStd, processStd, and optionally arCoefficients) by maximum likelihood via autodiff.
The entire optimization step —
valueAndGrad(loss)(Kalman filter forward pass + AD backward pass) and optax Adam moment/parameter updates — is wrapped in a singlejit()call, so every iteration runs from compiled code.The parameterization maps unconstrained reals → positive values: obsStd = exp(θ_s), processStd[i] = exp(θ_{w,i}) AR coefficients (when
fitAr = true) are optimized directly (unconstrained — not log-transformed, matching MATLAB DLM behavior).When
obsStdFixedis supplied (a per-timestep σ array, e.g. known measurement uncertainties), the observation noise is not estimated — it is treated as a known constant. Only processStd (and optionally arCoefficients) are optimized. The returnedobsStdfield will beNaNin this case.