fix(capecod): include on-level factor in exposure weighting (#1308, #1319) - #1339
Open
priyam0k wants to merge 3 commits into
Open
fix(capecod): include on-level factor in exposure weighting (#1308, #1319)#1339priyam0k wants to merge 3 commits into
priyam0k wants to merge 3 commits into
Conversation
priyam0k
requested review from
genedan,
henrydingliu and
kennethshsu
as code owners
September 11, 2026 01:01
Pyright Type CompletenessView the full Project (full
Other symbols referenced but not exported by
Symbols without documentation:
Patch (exported symbols added or changed by this PR): 0.0% fully typed (0 / 1)
Patch symbol details
|
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## main #1339 +/- ##
==========================================
+ Coverage 91.76% 91.79% +0.03%
==========================================
Files 96 96
Lines 5475 5475
Branches 706 706
==========================================
+ Hits 5024 5026 +2
+ Misses 327 326 -1
+ Partials 124 123 -1
Flags with carried forward coverage won't be shown. Click here to find out more. ☔ View full report in Codecov by Harness. 🚀 New features to boost your workflow:
|
| tort_history, change_col="rate_change", date_col="date", vertical_line=True | ||
| ) | ||
|
|
||
| floored_patterns = dict( |
…1319) - Fix CapeCod._get_capecod_aprioris to weight exposure by on-level factors (sw_olf_array) - Refactor Friedland Chapter 10 Exhibit II to route through CapeCod._onlevel natively - Add test_capecod_onlevel_friedland_exhibit_ii to test_capecod.py
priyam0k
force-pushed
the
fix/issue-1308-capecod-onlevel
branch
from
September 11, 2026 12:02
c89009b to
a98795e
Compare
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary of Changes
Related GitHub Issue(s)
Additional Context for Reviewers
All pre-commit ruff checks and tests pass cleanly.
Checklist
Note
Medium Risk
Changes core Cape Cod apriori math for any fit with on-leveled
sample_weight, which directly shifts derived loss ratios and ultimates; scope is narrow and guarded by new textbook reconciliation tests.Overview
Cape Cod now multiplies used-up exposure by the sample-weight on-level factor (
sw_olf_array) when buildingweighted_exposurefor the all-years apriori, so rate-level adjustments on earned premium affect the weighted loss ratio the same way they already did in the loss numerator.A regression test reproduces Friedland Chapter 10 Exhibit II (rate parallelogram on premium, tort OLF on losses, floored development, trend) and checks apriori,
detrended_apriori_, and total ultimate. The Chapter 10 notebook is updated to drive Exhibit II through aPipelineand model outputs (detrended_apriori_,expectation_,ibnr_,ultimate_) instead of hand-rolled detrending; minor formatting fixes allow dropping the notebook’s ruff grandfather entry inpyproject.toml.Reviewed by Cursor Bugbot for commit a98795e. Bugbot is set up for automated code reviews on this repo. Configure here.