Skip to content

Simplify recurrent module (DEVELOPMENT.md §4.C)#104

Merged
derrynknife merged 2 commits into
masterfrom
claude/development-4c-points-7r17e2
Jun 16, 2026
Merged

Simplify recurrent module (DEVELOPMENT.md §4.C)#104
derrynknife merged 2 commits into
masterfrom
claude/development-4c-points-7r17e2

Conversation

@derrynknife

Copy link
Copy Markdown
Owner

Address the four simplification points for the recurrent package:

  • Extract the copy-pasted multi-start MLE scaffolding from the four repair
    fitters (GeneralizedRenewal, GeneralizedOneRenewal, ARA, ARI) into a shared
    RenewalFitMixin: _multistart owns the start loop, best-start selection and
    the two convergence-failure raises; _bounds_transform owns bounds_convert;
    _attach_inference owns _neg_ll/_mle/_n_obs storage; _initial_dist_params
    de-duplicates the first-event initialisation. Each fitter keeps its own
    likelihood/optimiser call so the numerics are unchanged.

  • Make ProportionalIntensityModel inherit RecurrenceSimulationMixin instead of
    the stale pre-mixin simulation copy, gaining seeding, the max_events
    backstop and the data-returning simulators; the covariate vector Z is
    threaded through to the sampler by the public entry points.

  • Give the parametric intensity models (HPP/CrowAMSAA/Duane/CoxLewis) and the
    proportional-intensity regression fitters AIC/BIC/standard errors by setting
    _neg_ll/_mle/_n_obs and inheriting LikelihoodInferenceMixin, which is
    generalised off its renewal-only parameter-naming assumption via a
    _parameter_names hook. MSE / from_params models carry no likelihood and
    still raise.

  • Add an IntensityModel ABC carrying the iif/log_iif/cif/inv_cif/
    parameter_initialiser contract once, and strip the duplicated docstring
    boilerplate from Duane/CrowAMSAA/CoxLewis (the maths is left distinct).

Add tests for the new inference, regression simulation and ABC contract.

Address the four simplification points for the recurrent package:

- Extract the copy-pasted multi-start MLE scaffolding from the four repair
  fitters (GeneralizedRenewal, GeneralizedOneRenewal, ARA, ARI) into a shared
  RenewalFitMixin: _multistart owns the start loop, best-start selection and
  the two convergence-failure raises; _bounds_transform owns bounds_convert;
  _attach_inference owns _neg_ll/_mle/_n_obs storage; _initial_dist_params
  de-duplicates the first-event initialisation. Each fitter keeps its own
  likelihood/optimiser call so the numerics are unchanged.

- Make ProportionalIntensityModel inherit RecurrenceSimulationMixin instead of
  the stale pre-mixin simulation copy, gaining seeding, the max_events
  backstop and the data-returning simulators; the covariate vector Z is
  threaded through to the sampler by the public entry points.

- Give the parametric intensity models (HPP/CrowAMSAA/Duane/CoxLewis) and the
  proportional-intensity regression fitters AIC/BIC/standard errors by setting
  _neg_ll/_mle/_n_obs and inheriting LikelihoodInferenceMixin, which is
  generalised off its renewal-only parameter-naming assumption via a
  _parameter_names hook. MSE / from_params models carry no likelihood and
  still raise.

- Add an IntensityModel ABC carrying the iif/log_iif/cif/inv_cif/
  parameter_initialiser contract once, and strip the duplicated docstring
  boilerplate from Duane/CrowAMSAA/CoxLewis (the maths is left distinct).

Add tests for the new inference, regression simulation and ABC contract.
@chatgpt-codex-connector

Copy link
Copy Markdown

You have reached your Codex usage limits for code reviews. You can see your limits in the Codex usage dashboard.

@derrynknife derrynknife merged commit 488cfba into master Jun 16, 2026
4 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