Skip to content

Incoming admission predictor refactor#162

Merged
zmek merged 2 commits intomainfrom
incoming-admission-predictor-refactor
Apr 19, 2026
Merged

Incoming admission predictor refactor#162
zmek merged 2 commits intomainfrom
incoming-admission-predictor-refactor

Conversation

@zmek
Copy link
Copy Markdown
Collaborator

@zmek zmek commented Apr 19, 2026

No description provided.

zmek added 2 commits April 18, 2026 10:47
…r.predict()

Move prediction_window and prediction_times out of fit() so a single trained
model can serve any prediction window without retraining.

- IncomingAdmissionPredictor subclasses (Direct/Parametric/Empirical):
  * fit() stores a full 24-hour arrival_rates_dict; prediction_window and
    prediction_times become deprecated kwargs with a DeprecationWarning fallback
  * predict()/predict_mean() now require prediction_window and slice the
    24-hour profile dynamically via _iter_prediction_inputs
  * Add _resolve_prediction_window, _snap_to_interval_boundary (with
    UserWarning when snapping), and _normalize_prediction_time helpers
  * Remove find_nearest_previous_prediction_time
- Thread prediction_window through call sites:
  aggregate.get_prob_dist_using_survival_curve, predict.emergency_demand,
  predict.service (including _safe_predict_mean); drop the now-obsolete
  window-mismatch validation checks
- train.incoming_admission_predictor: stop forwarding the deprecated kwargs
- Tests: rewrite test_incoming_admission_predictors for the new API and
  deprecation path; update test_service (drop window-mismatch branch)
- Notebooks: refresh 3e, 3f and 4a against the new API
- Docs: clean up Sphinx :meth:/:class:/:func:/:data: roles so auto-generated
  docs render correctly; fix type hints flagged by mypy (Optional[...] on
  prediction_window_hours/NTimes); patch 4c output metadata for nbformat

Note: saved models from older versions are no longer supported.
- Add prediction_time, filter_keys, and filter_key; nest prediction_context in
  DeprecationWarning path only
- Update service, emergency_demand, and aggregate call sites
- Add tests for new API, legacy dict, and filter_key when multiple services
- Refresh module and class docstrings (fit #136 + service/weights wording
@zmek zmek force-pushed the incoming-admission-predictor-refactor branch from 3ede94d to d9fb3fb Compare April 19, 2026 07:45
@zmek zmek merged commit 68f5611 into main Apr 19, 2026
6 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.

1 participant