Solver Strategy & Tolerances¶
This document outlines the numerical optimization design, convergence criteria, and tolerances in Risk Bridge.
Numerical Design Decisions¶
- Analytic Derivatives: Rather than relying on costly and noisy finite-difference approximations, the likelihood and constraint modules implement exact, vectorized closed-form gradients and Jacobians.
- Boundary Clamping:
- Probabilities \(\hat{p}\) are clipped to \([\varepsilon_{\text{prob}}, 1 - \varepsilon_{\text{prob}}]\) with \(\varepsilon_{\text{prob}} = 10^{-12}\) to prevent \(\log(0)\) numerical overflows.
- Continuous markers \(z\) are bounded away from 0.
- Lognormal scale parameter \(\sigma\) is restricted to \(\sigma \ge 10^{-8}\).
- Warm Starts: Constrained optimization begins from the unconstrained MLE point \(\hat{\theta}_{\text{ML}}\), significantly reducing the number of interior-point iterations needed to find a feasible solution.
Convergence & Feasibility Acceptance¶
SciPy optimizers report convergence based on gradient and step-size criteria. However, because our constraints represent real-world calibration guarantees, Risk Bridge enforces an independent feasibility gate:
\[
\text{Feasible} \iff \max_{k=1,\dots,K} \lvert g_k(\hat{\theta}) \rvert \le \epsilon
\]
If a solver terminates with status == 0 but the constraint violation exceeds \(\epsilon\), the fit is classified as infeasible (cmle_success = False).
Reproducibility Contract¶
The written environment.json contract defines cross-environment numerical tolerances:
- Same Platform/Environment: rtol = 1e-6, atol = 1e-8.
- Cross-Platform: rtol = 1e-4, atol = 1e-6.