Skip to content

docs: add doctest Examples for development estimators and Mack fixes#786

Closed
EKtheSage wants to merge 3 commits into
casact:mainfrom
EKtheSage:docs/method-examples-barnett-mack-clark-etc
Closed

docs: add doctest Examples for development estimators and Mack fixes#786
EKtheSage wants to merge 3 commits into
casact:mainfrom
EKtheSage:docs/method-examples-barnett-mack-clark-etc

Conversation

@EKtheSage
Copy link
Copy Markdown
Contributor

@EKtheSage EKtheSage commented May 14, 2026

Summary

  • Add Examples sections with .. testsetup::, .. testcode::, and .. testoutput:: directives to BarnettZehnwirth, ClarkLDF, IncrementalAdditive, TweedieGLM, and DevelopmentML
  • Each example demonstrates how key parameters affect output (e.g., groupby, formula, power/link, fit_incrementals)
  • Fix MackChainladder class-level and full_std_err_ docstrings to use correct :: directives so Sphinx doctests execute them correctly

Test plan

  • Verify Sphinx doctest build runs without errors on the modified files
  • Confirm .. testoutput:: blocks match actual estimator output
  • Check that MackChainladder doctests pass end-to-end

Note

Low Risk
Changes are limited to documentation/doctest blocks and a new GitHub Actions workflow; no runtime logic is modified, but the new workflow can introduce merge conflicts or unexpected pushes to the docs branch if misconfigured.

Overview
Adds new Examples sections with .. testsetup:: / .. testcode:: / .. testoutput:: doctest blocks to BarnettZehnwirth, ClarkLDF, TweedieGLM, IncrementalAdditive, and DevelopmentML, demonstrating how key parameters change fitted outputs.

Fixes MackChainladder docstrings to use doctest-compatible directive syntax and expands examples (including a case showing how pre-smoothing affects total_mack_std_err_).

Introduces a GitHub Actions workflow (sync-main-to-docs.yml) that, on every push to main, checks out docs/great-docs-prototype, merges origin/main, and pushes the result back to that branch.

Reviewed by Cursor Bugbot for commit 1df94ec. Bugbot is set up for automated code reviews on this repo. Configure here.

EKtheSage and others added 3 commits May 14, 2026 00:20
On every push to main, GitHub Actions automatically merges main into
docs/great-docs-prototype so the docs branch stays current with all
code changes while keeping its doc-engine files intact.
…rectives

Add Examples sections using .. testsetup::, .. testcode::, and .. testoutput::
for BarnettZehnwirth, ClarkLDF, IncrementalAdditive, TweedieGLM, and
DevelopmentML. Place import chainladder in testsetup and other imports in
testcode. Correct MackChainladder class and full_std_err_ docstrings to use
double-colon directives and .. testoutput:: so Sphinx doctests run them.

Co-authored-by: Cursor <cursoragent@cursor.com>
Restore original class Parameters/Attributes text from main. Add Examples
with .. testsetup:: / .. testcode:: / .. testoutput:: showing how outputs
change for ClarkLDF (growth, sample_weight, groupby), BarnettZehnwirth
(formula vs PTF), IncrementalAdditive (shape and future_trend), TweedieGLM
(design_matrix and power/link), DevelopmentML (fit_incrementals and
weighted_step), and MackChainladder (Development averaging before fit).
Fix class-level Mack doctest directives to use :: and repair full_std_err_
testoutput::; add blank line after testsetup in total_process_risk example.

Co-authored-by: Cursor <cursoragent@cursor.com>
@codecov
Copy link
Copy Markdown

codecov Bot commented May 14, 2026

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 86.09%. Comparing base (5c1fc23) to head (1df94ec).

Additional details and impacted files
@@            Coverage Diff             @@
##             main     #786      +/-   ##
==========================================
- Coverage   86.13%   86.09%   -0.05%     
==========================================
  Files          86       86              
  Lines        4941     4925      -16     
  Branches      643      639       -4     
==========================================
- Hits         4256     4240      -16     
  Misses        486      486              
  Partials      199      199              
Flag Coverage Δ
unittests 86.09% <ø> (-0.05%) ⬇️

Flags with carried forward coverage won't be shown. Click here to find out more.

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

Copy link
Copy Markdown

@cursor cursor Bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Cursor Bugbot has reviewed your changes and found 1 potential issue.

Fix All in Cursor

❌ Bugbot Autofix is OFF. To automatically fix reported issues with cloud agents, enable autofix in the Cursor dashboard.

Reviewed by Cursor Bugbot for commit 1df94ec. Configure here.

git config user.email "github-actions[bot]@users.noreply.github.com"
git checkout docs/great-docs-prototype
git merge origin/main --no-edit -m "chore: sync main into docs/great-docs-prototype"
git push origin docs/great-docs-prototype
Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Unrelated workflow file included in docs-only PR

Medium Severity

A new CI workflow sync-main-to-docs.yml was added that automatically merges main into docs/great-docs-prototype on every push to main. This file is not mentioned in the PR description, which exclusively describes doctest and Sphinx directive changes. The workflow triggers on all pushes to main (not just docs-related ones), will fail without error handling if the target branch doesn't exist or merge conflicts arise, and represents a significant infrastructure change that warrants its own dedicated review.

Fix in Cursor Fix in Web

Reviewed by Cursor Bugbot for commit 1df94ec. Configure here.

@henrydingliu
Copy link
Copy Markdown
Collaborator

random question. do doctests contribute towards codecov?

@kennethshsu
Copy link
Copy Markdown
Collaborator

I think this PR is too large and should be broken up into smaller parts. I would at least break up some the docstrings and great docs into two. Also unit tests failing on dcostrings.

@kennethshsu
Copy link
Copy Markdown
Collaborator

random question. do doctests contribute towards codecov?

Currently no, only pytests contribute towards codecov. I think there's a way though.

@EKtheSage
Copy link
Copy Markdown
Contributor Author

I think this PR is too large and should be broken up into smaller parts. I would at least break up some the docstrings and great docs into two. Also unit tests failing on dcostrings.

Sorry about that, great docs should not be in here. That was a github action to update great-docs branch on my repo to sync with the main branch here. I can drop it. But other than that, the rest of the PR is docstrings examples updates. Do you want to break them into smaller PRs like Barnett, Mack, Clark etc?

@kennethshsu
Copy link
Copy Markdown
Collaborator

Hi @EKtheSage, for now I’d recommend separating out the Great Docs changes.

Even with that split, the PR is still on the larger side. I’m okay with moving forward with the docstring improvements for the 6 methods in a single PR this time since they are all just examples, though I wouldn’t recommend doing this going forward. PRs should be kept as small as possible.

That said, there is still a failing unit test. Do you mind taking a look and resolving it?

Please also use the PR template if possible, and avoid duplicating PRs? :)

Sorry, I know this can feel like a lot of red tape, but I’d really love to get this PR merged. Thanks so much for the energy and effort here. I’ll be happy to review the revision. Thank you, @EKtheSage!!

@kennethshsu
Copy link
Copy Markdown
Collaborator

I see that the other PR is not really a duplicate but cover more methods. We really should slim those down to make review easier. I'll reply on the other thread for issues related there.

@EKtheSage
Copy link
Copy Markdown
Contributor Author

Closing as superseded by smaller scoped PRs for #704: #799 and #802 cover the development estimator and ClarkLDF work from this branch. The replacement PRs are rebased from current main, scoped by subsystem, and intentionally exclude .github/workflows/sync-main-to-docs.yml.

@EKtheSage EKtheSage closed this May 16, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants