docs: add BootstrapODPSample doctest examples#836
Conversation
Adds Sphinx doctest Examples section to the BootstrapODPSample class showing basic fit (resampled_triangles_.shape and scale_), downstream stochastic IBNR via Chainladder, and the effect of drop_high on scale_. Uses random_state=42 and n_sims=100 for deterministic, fast output. Refs casact#704
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## main #836 +/- ##
=======================================
Coverage 86.94% 86.94%
=======================================
Files 86 86
Lines 4994 4994
Branches 644 644
=======================================
Hits 4342 4342
Misses 462 462
Partials 190 190
Flags with carried forward coverage won't be shown. Click here to find out more. ☔ View full report in Codecov by Sentry. 🚀 New features to boost your workflow:
|
| 51301.13 | ||
| 16149.47 | ||
|
|
||
| Outlier link ratios can distort the residual distribution that the |
There was a problem hiding this comment.
equating outlier with drop_high=True is not theoretically sound. can you pick any actual outlier to drop (may involve displaying and inspecting the ldf) or use a different rationale for using drop_high=True?
There was a problem hiding this comment.
Good catch. You're right that drop_high=True is not an outlier test, so that wording was misleading. I'll rephrase it as a sensitivity check on the column maxima and push the fix shortly.
Rewords the paragraph introducing the drop_high=True example to describe it as a leave-one-out sensitivity check on the column maxima rather than outlier removal, since drop_high mechanically removes the column max without any outlier test. Addresses review feedback on casact#836.
| The estimator also supports a leave-one-out sensitivity check on the | ||
| residual distribution. Setting ``drop_high=True`` excludes the highest | ||
| link ratio in each development column before computing residuals, without | ||
| making any outlier judgement, so the resulting ``scale_`` measures how |
There was a problem hiding this comment.
good to have international representation on this package
Adds a Sphinx doctest
Examplessection to theBootstrapODPSampleclass.Refs #704 (Stochastic / Simulation → BootstrapODPSample row).
Summary of Changes
Examplesblock toBootstrapODPSampleinchainladder/adjustments/bootstrap.py... testcode::/.. testoutput::groups covering:fiton the RAA sample — showsresampled_triangles_.shapeandscale_.Chainladder().fit(sims).ibnr_.sum('origin')aggregated to mean / std across 100 simulations.drop_high=Trueshrinksscale_.random_state=42andn_sims=100so output is deterministic, fast, and stable across CI runners.Related GitHub Issue(s)
Additional Context for Reviewers
Doctest CI passed locally and on GitHub Actions (
Doctest (ubuntu-latest, 3.12)).pytest chainladder/adjustments/tests -q→ 16 passed.Intentionally excludes
.github/workflows/sync-main-to-docs.yml, matching the split-PR convention from docs: add tail estimator doctest examples #801.Open to feedback on whether the IBNR example should also surface
total_process_risk_/total_parameter_risk_from a pairedMackChainladderview — happy to extend in a follow-up if useful.I passed tests locally for both code (
uv run pytest) and documentation changes (uv run jb build docs --builder=custom --custom-builder=doctest)Note
Low Risk
Docstring-only documentation change; the only risk is doctest brittleness if numeric outputs or sampling behavior change across environments.
Overview
Adds a new
Examplessection to theBootstrapODPSampledocstring with Sphinx doctests.The examples show (1) deterministic
fitoutput (resampled_triangles_.shapeandscale_) on the RAA sample, (2) feeding bootstrap samples intoChainladderto summarize simulated IBNR mean/std, and (3) howdrop_high=Truechanges the resultingscale_.Reviewed by Cursor Bugbot for commit 48ab897. Bugbot is set up for automated code reviews on this repo. Configure here.