Bayesian reference coverage audit
The initial port covered the buy-side consensus tutorial’s independent forecast update. It did not cover the entire production signal. The complete numerical workflow is now exposed through bayesian_kpi_predictions and BayesianPredictionSettings, preserving the reference method and output names.
Audited source
- Snapshot: Exabel checkout
9e1e92ca26, with no local edits. The signal file matches the current remotemasterblob6c5e7de34ae036e1b4ebe3080ac0684091243163. - Signal: bayesian_kpi_prediction_signal.py.
- Bias filter: kalman_filter.py.
- Horizon inference: latest_prediction_relative_days.py.
Calculation coverage
| Reference behavior | Implementation |
|---|---|
| Actual growth | series_math.actual_growth |
| Previous-actual estimate growth | series_math.estimate_growth |
| Growth-to-level conversion | prediction_math |
| Dispersion-to-growth conversion | prediction_math |
| Shifted expanding prior | series_math.prior_moments |
| Fixed forecast prior | series_math.prior_moments |
| Shifted expanding error precision | series_math.error_precision |
| Fixed forecast error precision | series_math.error_precision |
| Absolute and relative growth errors | series_math.growth_errors |
| Dispersion, count exponent and variance multiplier | prediction_math |
| Shifted consensus bias and Kalman filter | series_math.adjust_consensus_for_bias |
| Independent posterior | prediction_math |
| Correlation-adjusted posterior | series_math.correlation_adjusted_expectation |
| Joint-history alignment and sample covariance | prediction_math |
| Student-t growth and ordered level bounds | prediction_math |
| All 25 output names | prediction_settings.BAYESIAN_VALUES |
| Per-output historical/forward stitching | prediction_math.calculate_prediction_series |
| Publication availability gate | preparation |
| Fixed and latest publication-relative horizons | preparation |
| Training-window start | preparation |
Verification
- Numerical parity: 36 golden scenarios generated by executing the reference’s numerical methods in isolation, without the Exabel runtime. Cases cover both methods, all output selections, bias, error modes, missing histories, dispersion fallback and forecast stitching. Expected missingness is checked alongside values.
- Point-in-time behavior: Later model revisions, actual restatements and observations at or after
as_ofcannot change the result. - Panel contracts: Separate entities, nullable values, empty frames, explicit UTC dates, training starts and publication schedules have runnable tests.
- Historical leakage: Changing later actuals and errors cannot change earlier backtests.
- Compatibility: The earlier
BayesianPosteriorAPI and its golden tests remain unchanged. It is the tutorial interface, not the full reference workflow.
Integration boundaries
- Data access: Model IDs, KPI groups, vendor acquisition and hierarchy resolution remain with callers. The library accepts the existing estimate panel.
- Calendars: Callers provide fiscal period ends and publication schedules. Exabel’s calendar lookup and signal-evaluation machinery are not dependencies.
- Units: Values are ordinary numeric data. Currency conversion and Exabel’s custom currency dtype remain upstream.
- Time windows:
start_dateselects the training sample. Callers filter the output display window after calculation; it must not change the training sample. Exabel’s two-year query prefetch is a loading concern. - Timestamp boundary: All panel reads use the package’s exclusive
known_atboundary. Publication availability uses the reference’s inclusive previous-actual date comparison. External date-version loading semantics are not reproduced. - Delayed actuals: A historical output is refused if earlier realized history was not available at its own reading cutoff; its diagnostics are masked.
- Refusal rows: The package retains subject keys and an explicit eligibility reason where the signal would return no value. Diagnostic columns can still be populated when the prediction is unavailable.
- Forward universe: The panel entry point reports predictions for unrealized subjects. In particular, it does not relabel historical consensus-only subjects as forward predictions when the model is excluded.
Mathematical derivations:
- Independent: Prior and precision update.
- Correlation adjusted: Joint Gaussian conditioning.