Simplify recurrent module (DEVELOPMENT.md §4.C)#104
Merged
Conversation
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.
|
You have reached your Codex usage limits for code reviews. You can see your limits in the Codex usage dashboard. |
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.
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.