---------------------------------------------------------------------- This is the API documentation for the ibnr library. ---------------------------------------------------------------------- ## 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(expr: 'ir.Table', meta: 'TriangleMeta | None' = None) A reserving triangle over an ibis table expression. All transformations are lazy ibis expressions, written once and executable on both the duckdb and polars backends. ``execute()`` / ``to_pandas()`` / ``to_polars()`` materialize. TriangleMeta(origin_grain: 'str' = 'Y', dev_grain: 'str' = 'Y', measure: 'Measure' = 'cumulative', units: 'str | None' = None) -> None 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. from_long(data, **kwargs) -> 'Triangle' from_chainladder(tri: 'cl.Triangle', **kwargs) -> 'Triangle' to_chainladder(self) -> 'cl.Triangle' from_bermuda(tri, **kwargs) -> 'Triangle' to_bermuda(self) to_cumulative(self) -> 'Triangle' to_incremental(self) -> 'Triangle' with_dev_grain(self, grain: 'str') -> 'Triangle' with_origin_grain(self, grain: 'str') -> 'Triangle' as_of(self, eval_date: 'dt.date | str') -> 'Triangle' latest_diagonal(self) -> 'Triangle' filter(self, *predicates) -> 'Triangle' Filter rows with ibis deferred predicates, e.g. ``t.filter(ibis._.lob == 'wkcomp')``. select_fields(self, fields: 'str | list[str]') -> 'Triangle' to_wide(self, field: 'str | None' = None) -> 'pd.DataFrame' Pivot one field to an origin x dev_lag matrix (materializes; for display). to_pandas(self) -> 'pd.DataFrame' to_polars(self) -> 'pl.DataFrame' execute(self) -> 'pd.DataFrame' count(self) -> 'int' with_expr(self, expr: 'ir.Table', **meta_changes) -> 'Triangle' New Triangle with a replaced expression and optional meta updates. validate(self, strict: 'bool' = True) -> 'list[str]' ## Gallery Discover, retrieve, and fit reserving models through the GalleryEntry contract. Every entry - Bayesian, neural, or statistical - produces a PredictiveDistribution. ## 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. ## 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. ## Evaluation kernels The unifying predictive-distribution output type and the cross-backend posterior-parity tooling. ## 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. ## Retrospective harness Parallel company x line backtesting with staged sampler escalation - the compute seam behind the study scripts.