API Reference
Triangle
The long-format triangle data layer - a tidy table of origin_period / dev_lag / eval_date cells over an ibis expression (duckdb or polars backend), carrying grain, cumulative/incremental, and units metadata.
- Triangle
-
A reserving triangle over an ibis table expression.
- TriangleMeta
-
Triangle-level metadata. Carried through every transformation.
Triangle transforms & interop
Cumulative/incremental conversion, grain changes, as_of() backtest slicing, and lossless round-trips with chainladder-python and bermuda.
- Triangle.from_long()
- Triangle.from_chainladder()
- Triangle.to_chainladder()
- Triangle.from_bermuda()
- Triangle.to_bermuda()
- Triangle.to_cumulative()
- Triangle.to_incremental()
- Triangle.with_dev_grain()
- Triangle.with_origin_grain()
- Triangle.as_of()
- Triangle.latest_diagonal()
- Triangle.filter()
-
Filter rows with ibis deferred predicates, e.g.
t.filter(ibis._.lob == 'wkcomp'). - Triangle.select_fields()
- Triangle.to_wide()
-
Pivot one field to an origin x dev_lag matrix (materializes; for display).
- Triangle.to_pandas()
- Triangle.to_polars()
- Triangle.execute()
- Triangle.count()
- Triangle.with_expr()
-
New Triangle with a replaced expression and optional meta updates.
- Triangle.validate()
Gallery
Discover, retrieve, and fit reserving models through the GalleryEntry contract. Every entry - Bayesian, neural, or statistical - produces a PredictiveDistribution.
- gallery.list()
-
Names of all registered gallery entries.
- gallery.get
- gallery.fit
- gallery.GalleryEntry
Held-out evaluation
The four steps between a fitted entry and a leaderboard row: which cells a fit at as_of is scored on, one model’s arrays at those cells, the cross-model intersection, and the board.
- gallery.next_diagonal()
-
Cells that first become observable on the diagonal after
as_of. - gallery.CohortForecast
-
One model, one cohort, one cutoff, one field, at the held-out cells.
- gallery.Absence
-
Why an array is missing, from a closed vocabulary.
- gallery.align_panel()
-
Put every model on the SAME cells - per score - and report what fell out.
- gallery.leaderboard()
-
The board. One row per model, ordered by model name. No sort key.
- gallery.SCORE_DIRECTION
- gallery.stack()
-
Fit stacking weights on one panel, build stacked forecasts at a later one.
Chain ladder & reserve risk
The distribution-free chain ladder (Mack 1993) and its run-off MSEP, plus the one-year claims development result - the Solvency II reserve-risk view. cdr_methods() is the option surface: which model generates next year’s diagonal, how the reserve is re-estimated once it exists, and what each route has actually been validated against.
- kernels.MackFit
-
A fitted distribution-free chain ladder on one cohort.
- kernels.fit_mack()
-
Fit the distribution-free chain ladder on a single-cohort Triangle.
- kernels.simulate_ultimates()
-
Simulate FULL run-off ultimates from a fitted Mack model.
- kernels.cdr_methods()
-
Every way to get a one-year CDR, and the terms of each.
- kernels.get_cdr_method()
-
The
CDRMethoddescriptor for one route, or a KeyError naming the - kernels.one_year_cdr()
-
Merz-Wuthrich (2008) closed-form msep of the one-year CDR.
- kernels.simulate_one_year_cdr()
-
Actuary in the box: the one-year CDR distribution by re-reserving.
- kernels.rereserve()
-
(n_draws, n_w)one-year CDR draws from simulated next-diagonal values. - kernels.cdr_risk_measures()
-
VaR and TVaR of the one-year LOSS, from simulated CDR draws.
- kernels.CDRResult
-
One-year CDR uncertainty for one cohort, per accident year and in total.
- kernels.MackDiagonal
-
Next year’s diagonal from Mack’s conditional moments.
- kernels.ODPBootstrapDiagonal
-
Next year’s diagonal from an England-Verrall ODP residual bootstrap.
- gallery.GalleryDiagonal
-
Next year’s diagonal from a fitted gallery entry’s posterior predictive.
Evaluation kernels
The unifying predictive-distribution output type and the cross-backend posterior-parity tooling.
- kernels.PredictiveDistribution
-
Sampled predictive distribution over a set of targets.
- kernels.ParityReport
-
Result of comparing one or more ported posteriors to a reference.
- kernels.compare_posteriors()
-
Compare each non-reference posterior in
idatastoidatas[reference].
Wire format
The single place an ibnr result becomes bytes - one Arrow IPC stream per artifact, uncompressed by default, plus a one-way JSON summary for callers that cannot take the draws.
- kernels.to_arrow()
-
Serialize one ibnr result to an Arrow IPC stream.
- kernels.from_arrow()
-
Reconstruct whatever
to_arrow()wrote, dispatching onibnr.kind. - kernels.peek_kind()
-
The artifact type, read from the stream’s schema message.
- kernels.to_summary()
-
A JSON-safe digest for callers that cannot take the draws.
- kernels.CODEC_VERSION
- kernels.CONTENT_TYPE_ARROW
- kernels.CONTENT_TYPE_JSON
- kernels.DEFAULT_QUANTILES
Retrospective harness
Parallel company x line backtesting with staged sampler escalation - the compute seam behind the study scripts.
- kernels.harness.run_retro()
-
Run every task through the staged escalation, in parallel.
- kernels.harness.run_task()
-
Fit + score one task: the worker function. Never raises - a failure
- kernels.harness.RetroTask
-
One unit of work: fit one model to one company x line cohort as of a
- kernels.harness.SamplerSettings
-
One escalation stage’s MCMC budget.
- kernels.harness.ConvergenceGates
-
Pass/fail thresholds on an entry’s
convergence()diagnostics. - kernels.harness.precompile()
-
Compile the Stan program of every (given, else registered) entry that
- kernels.harness.default_max_workers()
-
Worker-pool size when the caller does not choose one: the