Skip to content

Time-varying-load RegressionNode (#37), surpyval 0.16, and 0.8.0 docs - #66

Merged
derrynknife merged 3 commits into
masterfrom
claude/package-review-recommendations-2lmh5a
Jul 22, 2026
Merged

Time-varying-load RegressionNode (#37), surpyval 0.16, and 0.8.0 docs#66
derrynknife merged 3 commits into
masterfrom
claude/package-review-recommendations-2lmh5a

Conversation

@derrynknife

Copy link
Copy Markdown
Owner

Summary

Completes the 0.8.0 payload on top of the already-merged load-sharing (#38) and
common-cause (#44) work:

  • Time-varying-load RegressionNode (AFT exposure model for RBD nodes (load-dependent aging) #37). Adds a schedule= mode: a
    component's covariates can follow a piecewise-constant path (a surpyval
    StepSchedule), and reliability is the exact survival along that path
    (model.sf_tvc). Age-conditioning needs no special case, since
    sf_tvc(age + x) / sf_tvc(age) is exactly sf_tvc(..., given=age) — the
    go-forward reliability from the component's current life under the schedule.
    Works for accelerated-failure-time and proportional-/additive-hazards
    families; proportional-odds does not compose along a path and is refused at
    construction. Serialises with the RBD.
  • surpyval >= 0.16. The schedule mode is built on surpyval's sf_tvc,
    published in 0.16.0; the floor moves from >=0.15,<0.16 to >=0.16,<0.17.
  • 0.8.0 documentation. Concepts gains theory sections for covariate/
    time-varying reliability, load sharing, and common-cause failures; the
    tutorial gains a worked "dependent failures" step exercising all three on the
    pumping skid (every cited number computed from the actual models).

Type of change

  • Bug fix
  • New feature
  • Documentation
  • Refactor / tooling
  • Breaking change

Checklist

  • Tests added/updated (asserting against a reference value where possible) — 8 schedule-mode tests: sf vs sf_tvc (AFT/PH), condition-based given, serialisation round-trips, PO rejection, mean/random
  • black, isort, flake8, and mypy pass (verified with the pinned mypy==2.3.0 against surpyval 0.16.0)
  • coverage run -m pytest passes and stays above the coverage gate (91%)
  • CHANGELOG.md updated under [Unreleased] (Added AFT exposure model for RBD nodes (load-dependent aging) #37; Changed surpyval floor; Documentation note)
  • Any Monte-Carlo tests are seeded (deterministic)

Notes for reviewers

🤖 Generated with Claude Code

https://claude.ai/code/session_01NUGaeQXKxjjiQ1ULT1ApXS


Generated by Claude Code

claude added 3 commits July 22, 2026 08:35
RegressionNode now accepts a `schedule=` (a surpyval StepSchedule) as an
alternative to a fixed `covariates` vector. When the load a component runs
under varies over its life, reliability is the exact survival along that
covariate path via `model.sf_tvc(x, schedule)`, rather than `model.sf(x, Z)`
at a single operating point.

This is the load-dependent-aging / digital-twin node of issue #37,
re-scoped to reuse the existing RegressionNode rather than a bespoke
exposure/virtual-age class: the covariate path IS the load history, and
surpyval owns the survival-under-a-path computation. Conditioning on `age`
needs no special handling in the condition-based layer, because
`sf_tvc(age + x) / sf_tvc(age)` is exactly surpyval's
`sf_tvc(..., given=age)` — the go-forward reliability from the component's
current life under the schedule.

Works for accelerated-failure-time and proportional-/additive-hazards
families; proportional-odds does not compose along a covariate path and is
rejected at construction. The schedule persists through serialisation
(change-point / interval schedules; cyclic schedules not yet serialisable).

Exactly one of `covariates` or `schedule` must be given. The schedule-mode
tests are skipped on surpyval builds that predate `sf_tvc`, so CI stays
green until that ships to PyPI.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01NUGaeQXKxjjiQ1ULT1ApXS
surpyval 0.16.0 publishes `sf_tvc` / `StepSchedule` to PyPI, so the
RegressionNode schedule mode added in the previous commit now has a real
released dependency. Bump the floor from >=0.15,<0.16 to >=0.16,<0.17.

This also fixes CI: against the older PyPI surpyval (which lacked
`StepSchedule`), mypy flagged `regression_node.py` importing
`StepSchedule` as an undefined attribute, and the schedule tests skipped
(leaving that code path uncovered). On 0.16 the attribute resolves and the
eight schedule tests run — verified locally with the pinned mypy 2.3.0 and
the full suite (coverage 91%).

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01NUGaeQXKxjjiQ1ULT1ApXS
The how-to guide and API reference already covered load sharing, common-cause
failures, and covariate/time-varying reliability, but the theory page and the
end-to-end tutorial did not. Fill both gaps ahead of the release.

Concepts gains three sections:
- Covariate-dependent and time-varying reliability (sf(x, Z), the survival-
  along-a-path sf_tvc, the age-conditioning identity, and which families
  compose along a covariate path).
- Dependent failures: load sharing (the cumulative-exposure / virtual-age
  model, the hypoexponential closed form, and the phi == 1 reduction to
  k-of-n).
- Common-cause failures (beta-factor and MGL, the basic-event probability, and
  the exact shock-conditioning that makes beta = 0 reproduce independence).

The tutorial gains a worked "dependent failures" step on the same pumping
skid: the pumps modelled as a load-sharing pair, a beta-factor common cause on
the identical filters, and one component under a ramping duty schedule. Every
cited number is computed from the actual models. Later steps renumber
accordingly, and the landing-page and tutorial "where to next" blurbs now point
at the new theory.

Also fixes the CHANGELOG: the surpyval-requirement "Changed" note had been
inserted between the Added bullets, so the LoadSharingModel and CCF entries
were sitting under Changed; they move back under Added, and a Documentation
note is added.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01NUGaeQXKxjjiQ1ULT1ApXS
@derrynknife
derrynknife merged commit 0c35230 into master Jul 22, 2026
8 checks passed
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.

2 participants