ehrdyn-icu 2.4.0__tar.gz

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (130) hide show
  1. ehrdyn_icu-2.4.0/LICENSE +21 -0
  2. ehrdyn_icu-2.4.0/PKG-INFO +357 -0
  3. ehrdyn_icu-2.4.0/README.md +319 -0
  4. ehrdyn_icu-2.4.0/configs/full_benchmark/kdd198_v2_generator_contract.json +1 -0
  5. ehrdyn_icu-2.4.0/expected/canonical_v2_five_task_manifest.json +22 -0
  6. ehrdyn_icu-2.4.0/fixtures/kdd245v2r/gaussian.json +37 -0
  7. ehrdyn_icu-2.4.0/pyproject.toml +79 -0
  8. ehrdyn_icu-2.4.0/release/v2.3.0/controlled_planner_returns.csv +481 -0
  9. ehrdyn_icu-2.4.0/setup.cfg +4 -0
  10. ehrdyn_icu-2.4.0/src/ehrdyn/__init__.py +12 -0
  11. ehrdyn_icu-2.4.0/src/ehrdyn_icu.egg-info/PKG-INFO +357 -0
  12. ehrdyn_icu-2.4.0/src/ehrdyn_icu.egg-info/SOURCES.txt +128 -0
  13. ehrdyn_icu-2.4.0/src/ehrdyn_icu.egg-info/dependency_links.txt +1 -0
  14. ehrdyn_icu-2.4.0/src/ehrdyn_icu.egg-info/entry_points.txt +3 -0
  15. ehrdyn_icu-2.4.0/src/ehrdyn_icu.egg-info/requires.txt +25 -0
  16. ehrdyn_icu-2.4.0/src/ehrdyn_icu.egg-info/top_level.txt +2 -0
  17. ehrdyn_icu-2.4.0/src/kdd2027_benchmark/__init__.py +6 -0
  18. ehrdyn_icu-2.4.0/src/kdd2027_benchmark/baseline.py +32 -0
  19. ehrdyn_icu-2.4.0/src/kdd2027_benchmark/canonical.py +80 -0
  20. ehrdyn_icu-2.4.0/src/kdd2027_benchmark/cli.py +547 -0
  21. ehrdyn_icu-2.4.0/src/kdd2027_benchmark/config.py +80 -0
  22. ehrdyn_icu-2.4.0/src/kdd2027_benchmark/controlled_headroom.py +56 -0
  23. ehrdyn_icu-2.4.0/src/kdd2027_benchmark/credentialed_constructor.py +496 -0
  24. ehrdyn_icu-2.4.0/src/kdd2027_benchmark/current_five_task/__init__.py +6 -0
  25. ehrdyn_icu-2.4.0/src/kdd2027_benchmark/current_five_task/authoritative_semantics.py +135 -0
  26. ehrdyn_icu-2.4.0/src/kdd2027_benchmark/current_five_task/contracts.py +439 -0
  27. ehrdyn_icu-2.4.0/src/kdd2027_benchmark/current_five_task/lineage_source_port.py +161 -0
  28. ehrdyn_icu-2.4.0/src/kdd2027_benchmark/current_five_task/reconstruct.py +1768 -0
  29. ehrdyn_icu-2.4.0/src/kdd2027_benchmark/current_five_task/runtime_config.json +83 -0
  30. ehrdyn_icu-2.4.0/src/kdd2027_benchmark/current_five_task/runtime_config.py +65 -0
  31. ehrdyn_icu-2.4.0/src/kdd2027_benchmark/ehr_component_scorer.py +255 -0
  32. ehrdyn_icu-2.4.0/src/kdd2027_benchmark/entrant_runtime.py +158 -0
  33. ehrdyn_icu-2.4.0/src/kdd2027_benchmark/errors.py +2 -0
  34. ehrdyn_icu-2.4.0/src/kdd2027_benchmark/evaluator.py +148 -0
  35. ehrdyn_icu-2.4.0/src/kdd2027_benchmark/fitted/__init__.py +8 -0
  36. ehrdyn_icu-2.4.0/src/kdd2027_benchmark/fitted/configs/kdd248e3c_contract_repair_v1.json +182 -0
  37. ehrdyn_icu-2.4.0/src/kdd2027_benchmark/fitted/configs/kdd248e4r5_tail_safe_plugin_v1.json +142 -0
  38. ehrdyn_icu-2.4.0/src/kdd2027_benchmark/fitted/configs/kdd262_matched_fitted_simulator_ope_v1.json +186 -0
  39. ehrdyn_icu-2.4.0/src/kdd2027_benchmark/fitted/configs/kdd263_paper_fitted_workflow_v1.json +120 -0
  40. ehrdyn_icu-2.4.0/src/kdd2027_benchmark/fitted/configs/kdd267_21_method_successor_v1.json +168 -0
  41. ehrdyn_icu-2.4.0/src/kdd2027_benchmark/fitted/configs/kdd267_candidate_adapter_base_v1.json +150 -0
  42. ehrdyn_icu-2.4.0/src/kdd2027_benchmark/fitted/interface.py +101 -0
  43. ehrdyn_icu-2.4.0/src/kdd2027_benchmark/fitted/kdd069_model_types.py +29 -0
  44. ehrdyn_icu-2.4.0/src/kdd2027_benchmark/fitted/kdd069_rssm_models.py +179 -0
  45. ehrdyn_icu-2.4.0/src/kdd2027_benchmark/fitted/kdd069_sequence_models.py +114 -0
  46. ehrdyn_icu-2.4.0/src/kdd2027_benchmark/fitted/kdd155v3_model_free.py +212 -0
  47. ehrdyn_icu-2.4.0/src/kdd2027_benchmark/fitted/kdd161_model_free.py +237 -0
  48. ehrdyn_icu-2.4.0/src/kdd2027_benchmark/fitted/kdd164_metric_selection.py +285 -0
  49. ehrdyn_icu-2.4.0/src/kdd2027_benchmark/fitted/kdd166_pomdp_benchmark.py +294 -0
  50. ehrdyn_icu-2.4.0/src/kdd2027_benchmark/fitted/kdd194_staged_training.py +343 -0
  51. ehrdyn_icu-2.4.0/src/kdd2027_benchmark/fitted/kdd202a_ope_reference.py +159 -0
  52. ehrdyn_icu-2.4.0/src/kdd2027_benchmark/fitted/kdd202b_policy_ope.py +497 -0
  53. ehrdyn_icu-2.4.0/src/kdd2027_benchmark/fitted/kdd229_ope_precision.py +104 -0
  54. ehrdyn_icu-2.4.0/src/kdd2027_benchmark/fitted/kdd248_full_episode.py +1090 -0
  55. ehrdyn_icu-2.4.0/src/kdd2027_benchmark/fitted/kdd248_plugin_policy_evaluation.py +400 -0
  56. ehrdyn_icu-2.4.0/src/kdd2027_benchmark/fitted/kdd248_source_training.py +1030 -0
  57. ehrdyn_icu-2.4.0/src/kdd2027_benchmark/fitted/kdd267_policy_extension.py +257 -0
  58. ehrdyn_icu-2.4.0/src/kdd2027_benchmark/fitted/known_effect.py +269 -0
  59. ehrdyn_icu-2.4.0/src/kdd2027_benchmark/fitted/known_effect_diagnostics.py +146 -0
  60. ehrdyn_icu-2.4.0/src/kdd2027_benchmark/fitted/paper_models.py +111 -0
  61. ehrdyn_icu-2.4.0/src/kdd2027_benchmark/fitted/run_kdd262_matched_fitted_simulator_ope.py +2063 -0
  62. ehrdyn_icu-2.4.0/src/kdd2027_benchmark/fitted/source_helpers.py +43 -0
  63. ehrdyn_icu-2.4.0/src/kdd2027_benchmark/fitted/workflow.py +472 -0
  64. ehrdyn_icu-2.4.0/src/kdd2027_benchmark/fixture.py +63 -0
  65. ehrdyn_icu-2.4.0/src/kdd2027_benchmark/full_direct_evaluator.py +366 -0
  66. ehrdyn_icu-2.4.0/src/kdd2027_benchmark/full_ope.py +497 -0
  67. ehrdyn_icu-2.4.0/src/kdd2027_benchmark/full_pomdp_core.py +533 -0
  68. ehrdyn_icu-2.4.0/src/kdd2027_benchmark/full_pomdp_types.py +483 -0
  69. ehrdyn_icu-2.4.0/src/kdd2027_benchmark/full_pomdp_v2.py +282 -0
  70. ehrdyn_icu-2.4.0/src/kdd2027_benchmark/full_suite.py +581 -0
  71. ehrdyn_icu-2.4.0/src/kdd2027_benchmark/gates.py +49 -0
  72. ehrdyn_icu-2.4.0/src/kdd2027_benchmark/gym_env.py +108 -0
  73. ehrdyn_icu-2.4.0/src/kdd2027_benchmark/identity.py +29 -0
  74. ehrdyn_icu-2.4.0/src/kdd2027_benchmark/kdd267_candidates.py +1284 -0
  75. ehrdyn_icu-2.4.0/src/kdd2027_benchmark/kdd267_controlled.py +574 -0
  76. ehrdyn_icu-2.4.0/src/kdd2027_benchmark/kdd267_h4_planner.py +275 -0
  77. ehrdyn_icu-2.4.0/src/kdd2027_benchmark/kdd267_inventory.py +122 -0
  78. ehrdyn_icu-2.4.0/src/kdd2027_benchmark/kdd267_planner_primitives.py +116 -0
  79. ehrdyn_icu-2.4.0/src/kdd2027_benchmark/manifest.py +98 -0
  80. ehrdyn_icu-2.4.0/src/kdd2027_benchmark/offline_datasets.py +218 -0
  81. ehrdyn_icu-2.4.0/src/kdd2027_benchmark/package_schemas/aggregate_metrics.schema.json +40 -0
  82. ehrdyn_icu-2.4.0/src/kdd2027_benchmark/package_schemas/credentialed_aggregate_receipt.schema.json +208 -0
  83. ehrdyn_icu-2.4.0/src/kdd2027_benchmark/package_schemas/credentialed_controlled_stop_receipt.schema.json +52 -0
  84. ehrdyn_icu-2.4.0/src/kdd2027_benchmark/package_schemas/ehr_component_result.schema.json +133 -0
  85. ehrdyn_icu-2.4.0/src/kdd2027_benchmark/package_schemas/ehr_component_submission.schema.json +98 -0
  86. ehrdyn_icu-2.4.0/src/kdd2027_benchmark/package_schemas/entrant_api_and_component_source.schema.json +26 -0
  87. ehrdyn_icu-2.4.0/src/kdd2027_benchmark/package_schemas/entrant_protocol.schema.json +21 -0
  88. ehrdyn_icu-2.4.0/src/kdd2027_benchmark/package_schemas/kdd267_controlled_smoke_receipt.schema.json +108 -0
  89. ehrdyn_icu-2.4.0/src/kdd2027_benchmark/package_schemas/kdd267_fitted_smoke_receipt.schema.json +72 -0
  90. ehrdyn_icu-2.4.0/src/kdd2027_benchmark/package_schemas/kdd267_method_inventory_receipt.schema.json +77 -0
  91. ehrdyn_icu-2.4.0/src/kdd2027_benchmark/package_schemas/leaderboard_submission.schema.json +78 -0
  92. ehrdyn_icu-2.4.0/src/kdd2027_benchmark/package_schemas/planner_adapter_and_policy_output.schema.json +12 -0
  93. ehrdyn_icu-2.4.0/src/kdd2027_benchmark/package_schemas/recursive_entrant_request.schema.json +16 -0
  94. ehrdyn_icu-2.4.0/src/kdd2027_benchmark/package_schemas/recursive_prediction_output.schema.json +18 -0
  95. ehrdyn_icu-2.4.0/src/kdd2027_benchmark/package_schemas/stage_resource_instrumentation.schema.json +47 -0
  96. ehrdyn_icu-2.4.0/src/kdd2027_benchmark/package_schemas/transition_submission.schema.json +39 -0
  97. ehrdyn_icu-2.4.0/src/kdd2027_benchmark/paper_tasks.py +60 -0
  98. ehrdyn_icu-2.4.0/src/kdd2027_benchmark/privacy.py +83 -0
  99. ehrdyn_icu-2.4.0/src/kdd2027_benchmark/public_bundle.py +41 -0
  100. ehrdyn_icu-2.4.0/src/kdd2027_benchmark/public_controlled.py +38 -0
  101. ehrdyn_icu-2.4.0/src/kdd2027_benchmark/public_ope.py +136 -0
  102. ehrdyn_icu-2.4.0/src/kdd2027_benchmark/public_pomdp.py +337 -0
  103. ehrdyn_icu-2.4.0/src/kdd2027_benchmark/report.py +39 -0
  104. ehrdyn_icu-2.4.0/src/kdd2027_benchmark/resources.py +106 -0
  105. ehrdyn_icu-2.4.0/src/kdd2027_benchmark/schema.py +110 -0
  106. ehrdyn_icu-2.4.0/src/kdd2027_benchmark/split.py +18 -0
  107. ehrdyn_icu-2.4.0/src/kdd2027_benchmark/submission.py +51 -0
  108. ehrdyn_icu-2.4.0/src/kdd2027_benchmark/transition_entrant.py +47 -0
  109. ehrdyn_icu-2.4.0/src/kdd2027_benchmark/world_model_entrant.py +247 -0
  110. ehrdyn_icu-2.4.0/src/kdd2027_benchmark/world_model_full.py +377 -0
  111. ehrdyn_icu-2.4.0/src/kdd2027_benchmark/world_model_smoke.py +161 -0
  112. ehrdyn_icu-2.4.0/tests/test_kdd214_release.py +169 -0
  113. ehrdyn_icu-2.4.0/tests/test_kdd215_release.py +184 -0
  114. ehrdyn_icu-2.4.0/tests/test_kdd217ar3a.py +221 -0
  115. ehrdyn_icu-2.4.0/tests/test_kdd235a.py +123 -0
  116. ehrdyn_icu-2.4.0/tests/test_kdd235b.py +109 -0
  117. ehrdyn_icu-2.4.0/tests/test_kdd245v2m_minimal_release.py +107 -0
  118. ehrdyn_icu-2.4.0/tests/test_kdd245v2r_ehr_component_scorer.py +207 -0
  119. ehrdyn_icu-2.4.0/tests/test_kdd257_credentialed_constructor.py +160 -0
  120. ehrdyn_icu-2.4.0/tests/test_kdd263_fitted_workflow.py +46 -0
  121. ehrdyn_icu-2.4.0/tests/test_kdd263_paper_identity.py +79 -0
  122. ehrdyn_icu-2.4.0/tests/test_kdd267_21_method_artifact.py +239 -0
  123. ehrdyn_icu-2.4.0/tests/test_kdd277_terminal_reward.py +334 -0
  124. ehrdyn_icu-2.4.0/tests/test_known_effect.py +134 -0
  125. ehrdyn_icu-2.4.0/tests/test_post_submission_bugfix.py +154 -0
  126. ehrdyn_icu-2.4.0/tests/test_v24_usability.py +233 -0
  127. ehrdyn_icu-2.4.0/world_model_entrant_example/ensemble.json +1 -0
  128. ehrdyn_icu-2.4.0/world_model_entrant_example/entrant.py +81 -0
  129. ehrdyn_icu-2.4.0/world_model_entrant_example/gaussian.json +1 -0
  130. ehrdyn_icu-2.4.0/world_model_entrant_example/point.json +1 -0
@@ -0,0 +1,21 @@
1
+ MIT License
2
+
3
+ Copyright (c) 2026 Yunsung Chung
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in all
13
+ copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
+ SOFTWARE.
@@ -0,0 +1,357 @@
1
+ Metadata-Version: 2.4
2
+ Name: ehrdyn-icu
3
+ Version: 2.4.0
4
+ Summary: EHRDyn benchmark workflows for offline reinforcement learning from EHRs
5
+ License-Expression: MIT
6
+ Project-URL: Homepage, https://ehrdyn.github.io
7
+ Project-URL: Repository, https://github.com/cys1102/ehrdyn
8
+ Classifier: Intended Audience :: Science/Research
9
+ Classifier: Programming Language :: Python :: 3
10
+ Classifier: Programming Language :: Python :: 3.11
11
+ Classifier: Programming Language :: Python :: 3.12
12
+ Classifier: Programming Language :: Python :: 3.13
13
+ Classifier: Topic :: Scientific/Engineering :: Artificial Intelligence
14
+ Requires-Python: <3.14,>=3.11
15
+ Description-Content-Type: text/markdown
16
+ License-File: LICENSE
17
+ Requires-Dist: jsonschema==4.26.0
18
+ Requires-Dist: numpy==2.3.3
19
+ Provides-Extra: gym
20
+ Requires-Dist: gymnasium==1.2.2; extra == "gym"
21
+ Provides-Extra: datasets
22
+ Requires-Dist: gymnasium==1.2.2; extra == "datasets"
23
+ Requires-Dist: minari[hdf5]==0.5.3; extra == "datasets"
24
+ Requires-Dist: pillow==13.0.0; extra == "datasets"
25
+ Provides-Extra: credentialed
26
+ Requires-Dist: pandas==3.0.3; extra == "credentialed"
27
+ Provides-Extra: test
28
+ Requires-Dist: pandas==3.0.3; extra == "test"
29
+ Requires-Dist: scipy==1.17.0; extra == "test"
30
+ Requires-Dist: scikit-learn==1.8.0; extra == "test"
31
+ Requires-Dist: torch==2.9.0; extra == "test"
32
+ Provides-Extra: fitted
33
+ Requires-Dist: pandas==3.0.3; extra == "fitted"
34
+ Requires-Dist: scipy==1.17.0; extra == "fitted"
35
+ Requires-Dist: scikit-learn==1.8.0; extra == "fitted"
36
+ Requires-Dist: torch==2.9.0; extra == "fitted"
37
+ Dynamic: license-file
38
+
39
+ # EHRDyn
40
+
41
+ EHRDyn is a benchmark for evaluating offline reinforcement learning from
42
+ electronic health records (EHRs). It aligns five MIMIC-IV task contracts across
43
+ credentialed EHR dynamics and support diagnostics, frozen EHR-fitted
44
+ observational simulators, and 40 public controlled environments. These
45
+ complementary surfaces test transition models, policies, world models, and
46
+ off-policy evaluation (OPE) estimators without treating simulator returns as
47
+ clinical counterfactual truth.
48
+
49
+ The shared simulator suite contains 21 policy specifications and six OPE
50
+ estimators. The fitted and controlled surfaces use the same method order;
51
+ severity rules are not part of either inventory. Discrete XQL and the compact
52
+ Dreamer V1--V3 implementations are benchmark adaptations, not official
53
+ reproductions of the original systems.
54
+
55
+ The repository and benchmark display name is EHRDyn. The Python package and
56
+ command-line interface retain the compatibility name `ehrdyn-icu`.
57
+
58
+ ## Benchmark surfaces
59
+
60
+ | Surface | Access | Evaluated object or submission | Evaluation reference | Start here |
61
+ | --- | --- | --- | --- | --- |
62
+ | EHR dynamics and support | Credentialed MIMIC-IV v3.1 | Transition-prediction submission | Recorded next observations and logged trajectories | [MIMIC access](MIMIC_ACCESS.md), [component scorer](EHR_COMPONENT_SCORER.md) |
63
+ | EHR-fitted simulator | Credentialed full workflow; public synthetic smoke | Named policy or candidate transition implementation | Direct return in a frozen fitted observational simulator | [Paper artifact](PAPER_ARTIFACT.md) |
64
+ | Controlled policy evaluation | Public | Policy or world-model entrant | Direct return in a frozen synthetic mechanism | [World-model entrant](RECURSIVE_WORLD_MODEL_ENTRANT.md) |
65
+ | Simulator OPE | Public controlled workflow; credentialed fitted workflow; public smoke | Six included OPE implementations | Direct simulator return for each fixed policy | [OPE contract](OPE_CONTRACT.md) |
66
+
67
+ EHRDyn reports a multi-metric profile rather than one composite score. The
68
+ current controlled environments are public development assets, not a hidden
69
+ test service.
70
+
71
+ The public controlled workflows and synthetic smokes require no MIMIC access.
72
+ Credentialed rows run only in an authorized, caller-owned MIMIC-IV environment
73
+ and keep all restricted inputs and outputs local.
74
+
75
+ The controlled policy and world-model surfaces expose isolated entrant
76
+ interfaces. The current OPE surface provides six versioned Python estimator
77
+ implementations; it does not yet define an isolated estimator-subprocess
78
+ schema.
79
+
80
+ ## Installation
81
+
82
+ Python 3.11, 3.12, or 3.13 is required. Dependencies are frozen in `uv.lock`.
83
+ The base install supports the public CLI, component scorer, controlled
84
+ environments, and entrant smokes. Installed defaults are package resources, so
85
+ these commands do not depend on the repository being the working directory.
86
+
87
+ ```bash
88
+ python -m venv .venv
89
+ source .venv/bin/activate
90
+ python -m pip install .
91
+
92
+ ehrdyn-icu --help
93
+ ehrdyn-icu --version
94
+ ehrdyn-icu validate-paper-tasks
95
+ ehrdyn-icu validate-schemas
96
+ ehrdyn-icu method-inventory
97
+ ehrdyn-icu score-ehr-components \
98
+ --output build/ehr-component-score.json
99
+ ehrdyn-icu generate-full-suite \
100
+ --output build/controlled-suite.csv
101
+ ehrdyn-icu evaluate-world-model-smoke \
102
+ --output build/world-model-smoke \
103
+ --episodes 8
104
+ ```
105
+
106
+ The five-task manifest used by `validate-paper-tasks` is the current
107
+ paper-facing taxonomy. The seven JSON files in `configs/tasks/` retain an older
108
+ action-abstraction configuration surface for compatibility; they are not the
109
+ default paper identity. They can still be checked explicitly:
110
+
111
+ ```bash
112
+ ehrdyn-icu validate-config --config-dir configs/tasks
113
+ ```
114
+
115
+ Install the test extra before running the complete source-checkout suite. It
116
+ includes `pandas` for the synthetic five-task constructor tests and the fitted
117
+ stack required by the 21-method regression tests.
118
+
119
+ ```bash
120
+ python -m pip install '.[test]'
121
+ python -m unittest discover -s tests
122
+ ehrdyn-icu scan-release --root .
123
+ ehrdyn-icu verify-checksums --root .
124
+ git diff --check
125
+ ```
126
+
127
+ `ehrdyn-icu --version` and package metadata report `2.4.0`. The
128
+ manuscript-facing workflow is documented
129
+ in [PAPER_ARTIFACT.md](PAPER_ARTIFACT.md).
130
+
131
+ ## Quickstart
132
+
133
+ ```bash
134
+ python -m pip install 'ehrdyn-icu[gym]==2.4.0'
135
+ ehrdyn-icu export-offline-datasets --output offline-datasets --format npz \
136
+ --profiles sepsis --environment-seeds 171901
137
+ ```
138
+
139
+ ```python
140
+ import ehrdyn
141
+ import gymnasium as gym
142
+ import numpy as np
143
+
144
+ env = gym.make("ehrdyn/sepsis-v0", environment_seed=171901)
145
+ obs, info = env.reset(seed=0)
146
+ obs, reward, terminated, truncated, info = env.step(int(np.flatnonzero(info["action_mask"])[0]))
147
+ dataset = ehrdyn.load_dataset("sepsis", 171901, path="offline-datasets")
148
+ ```
149
+
150
+ The five IDs use `ehrdyn/<profile>-v0` for `sepsis`, `respiratory`, `shock`,
151
+ `aki`, and `heart_failure`. The public environment seeds are 171901–171908.
152
+ The default is 171901. The observation dict contains `observations`, `mask`,
153
+ `recency`, `previous_action`, and `step`. Observations and recency use
154
+ float32. Actions use the environment's discrete action space.
155
+ `info["action_mask"]` marks supported actions. Unsupported actions raise
156
+ `ValueError`. Early termination and the benchmark horizon both set
157
+ `terminated=True`. The final observation has zero values, an empty mask,
158
+ incremented recency, and the last action.
159
+
160
+ Export defaults to NPZ and all 40 environments. Each environment has a
161
+ 128-episode training log, a 64-episode validation log, and eight 256-episode
162
+ OPE logs. Use `--episodes` to cap each dataset for a smoke test. Changing the
163
+ episode count changes the shape of the generator's random streams. The NPZ
164
+ arrays retain padded rows and a `valid` mask. `load_dataset` defaults to
165
+ `role="train"`. Select other logs with `role="validation"` or `role="ope"`
166
+ and `dataset_index=0` through `7`.
167
+
168
+ For `--format minari`, install `ehrdyn-icu[datasets]`, which includes Minari
169
+ with HDF5 support and Pillow. The loader returns a `MinariDataset`. Minari episodes
170
+ store valid transitions and a final observation with an empty mask. The
171
+ generator's next-observation proxies and logging probabilities are in
172
+ `episode.infos` at index `t + 1` for action `t`.
173
+
174
+ The train and validation seeds come from
175
+ [`kdd267_controlled._build_groups`](src/kdd2027_benchmark/kdd267_controlled.py).
176
+ The OPE seeds come from
177
+ [`full_suite.dataset_seed`](src/kdd2027_benchmark/full_suite.py), as used by
178
+ `run_full_ope`. The [quickstart notebook](notebooks/quickstart.ipynb) uses
179
+ NumPy and Gymnasium. Notebook tooling is installed separately.
180
+
181
+ ## Credentialed MIMIC-IV construction
182
+
183
+ Authorized MIMIC-IV v3.1 users can reconstruct the five EHR task interfaces
184
+ locally from the official flat files. Keep the data path out of shell history
185
+ by setting it through the required environment variable.
186
+
187
+ ```bash
188
+ python -m pip install '.[credentialed]'
189
+ export AUTHORIZED_MIMICIV_3_1_ROOT='<authorized MIMIC-IV v3.1 directory>'
190
+ ehrdyn-icu construct-ehr --output '<new private output directory>'
191
+ ```
192
+
193
+ The command validates all 14 required input tables, reconstructs the five
194
+ cohorts and deterministic subject roles, applies train-only preprocessing, and
195
+ writes role-specific modeling arrays to a restricted local directory. Use
196
+ `--aggregate-only` to validate construction without writing the modeling
197
+ arrays. See [CREDENTIALED_CONSTRUCTOR.md](CREDENTIALED_CONSTRUCTOR.md) and
198
+ [MIMIC_ACCESS.md](MIMIC_ACCESS.md). The author-side reference run took about
199
+ 2 hours 8 minutes, peaked at 81.3 GiB resident memory, and used 32.3 GiB of
200
+ temporary disk.
201
+
202
+ ## EHR-format component scorer
203
+
204
+ The scorer accepts point, independent-Gaussian, and Gaussian-ensemble
205
+ submissions. It reports aggregate forecasting, calibration, interval,
206
+ termination, support, ESS, and evaluability diagnostics where defined.
207
+
208
+ ```bash
209
+ ehrdyn-icu score-ehr-components \
210
+ --output build/ehr-component-score.json
211
+ ```
212
+
213
+ The default submission is an installed synthetic example. An explicit
214
+ `--submission` path always overrides it.
215
+
216
+ See [EHR_COMPONENT_SCORER.md](EHR_COMPONENT_SCORER.md),
217
+ [SCHEMA_VALIDATION.md](SCHEMA_VALIDATION.md), and
218
+ [CANONICAL_SERIALIZATION.md](CANONICAL_SERIALIZATION.md).
219
+
220
+ ## Controlled-environment entrant
221
+
222
+ The public constructed workflow uses only released synthetic mechanisms and
223
+ fixtures. A bounded smoke is:
224
+
225
+ ```bash
226
+ ehrdyn-icu evaluate-world-model-smoke \
227
+ --output build/world-model-smoke \
228
+ --episodes 8
229
+ ```
230
+
231
+ Without `--entrant`, this command uses the three installed point, Gaussian, and
232
+ ensemble demonstration entrants. One or more explicit `--entrant` arguments
233
+ always override those examples.
234
+
235
+ The full 40-environment workflow is documented in
236
+ [RECURSIVE_WORLD_MODEL_ENTRANT.md](RECURSIVE_WORLD_MODEL_ENTRANT.md). The
237
+ demonstration entrant is an interface example and is not part of a scientific
238
+ leaderboard.
239
+
240
+ ## Shared 21-policy and six-estimator workflow
241
+
242
+ Install the fitted dependency group, then run the public bounded workflow:
243
+
244
+ ```bash
245
+ python -m pip install '.[fitted]'
246
+ ehrdyn-icu method-inventory
247
+ ehrdyn-icu fitted-synthetic-smoke \
248
+ --output build/ehrdyn-fitted-smoke.json
249
+ ehrdyn-icu controlled-21-method-smoke \
250
+ --profile aki \
251
+ --environment-seed 171901 \
252
+ --output build/ehrdyn-controlled-smoke.json
253
+ ```
254
+
255
+ Both smokes execute all 21 named methods in the frozen order and all six OPE
256
+ estimators. The controlled OPE inventory also contains exactly those 21
257
+ methods; there is no severity-rule exception. These are nonclinical capability
258
+ checks. They do not regenerate the paper's full numerical 21-method by
259
+ 40-environment return and OPE aggregates and do not provide return, rank, or
260
+ algorithm-family superiority evidence. `generate-full-suite` enumerates the
261
+ controlled contracts, while `evaluate-world-model-full` evaluates one external
262
+ entrant; neither command reconstructs the bundled paper result tables. See
263
+ [the 21-method quickstart](docs/21_method_quickstart.md).
264
+
265
+ Fitted sepsis, AKI, and heart-failure simulators default to `terminal_once`:
266
+ zero reward before the final valid transition, then one sampled -1 or +1
267
+ terminal proxy. Discounted returns lie in [-1, 1]. Respiratory support and
268
+ shock retain `per_step_head`: Gaussian reward samples from a learned head on
269
+ the current values, masks, recency, and conditioned action, rather than a
270
+ formula evaluated on the simulated next state. Release v2.1.1 and the submitted
271
+ paper used `per_step_head` for every fitted task. Pass
272
+ `--reward-emission-mode per_step_head` to `fitted-simulator --mode evaluate`
273
+ or `fitted-synthetic-smoke` to select that legacy behavior explicitly. See
274
+ [the fitted quickstart](docs/fitted_simulator_quickstart.md) and
275
+ [CHANGELOG.md](CHANGELOG.md).
276
+
277
+ ## Included interfaces
278
+
279
+ - `src/`: benchmark, constructor, scorer, schema, entrant, planner, and evaluator code.
280
+ - `configs/`: frozen task and constructed-environment contracts.
281
+ - `schemas/`: Draft 2020-12 input/output schemas.
282
+ - `fixtures/` and `invalid_entrant_fixtures/`: synthetic positive and negative
283
+ fixtures.
284
+ - `dictionaries/`, `task_cards/`, and `submission/`: public contract metadata.
285
+ - `tests/`: synthetic-only schema, scorer, entrant, privacy, and replay tests.
286
+
287
+ Transition, policy, and world-model entrants use isolated subprocess
288
+ interfaces. The six OPE estimators are built-in benchmark implementations, not
289
+ an open estimator-submission API.
290
+
291
+ ## Data and claim boundary
292
+
293
+ MIMIC-IV remains governed by PhysioNet credentialing and is not redistributed.
294
+ The constructor runs only inside an authorized local environment and publishes
295
+ no MIMIC-derived scientific results. See [MIMIC_ACCESS.md](MIMIC_ACCESS.md),
296
+ [KNOWN_LIMITATIONS.md](KNOWN_LIMITATIONS.md), and
297
+ [ETHICS_AND_MISUSE.md](ETHICS_AND_MISUSE.md).
298
+
299
+ Intended use includes nonclinical evaluation of forecasting, simulator-based
300
+ policy construction, direct simulator returns, and OPE recovery. Unsupported
301
+ uses include treatment recommendation, causal effect estimation,
302
+ counterfactual benefit claims, clinical deployment, and autonomous decisions.
303
+
304
+ Citation metadata are in [CITATION.cff](CITATION.cff). The repository is
305
+ <https://github.com/cys1102/ehrdyn>.
306
+
307
+ ## Known-effect simulators and diagnostics (2.3.0)
308
+
309
+ The known-effect variant removes action associations from the frozen transition model and reward/outcome head, including their action history inputs. It replaces those inputs with the calibrated action marginal and adds a specified, state-mediated effect to the standardized state update. The effect is synthetic. Results are scenario analyses at the stated effect strength, not estimates of clinical treatment effects.
310
+
311
+ Run the variant on credentialed fitted simulators with:
312
+
313
+ ```bash
314
+ ehrdyn-icu fitted-simulator \
315
+ --mode evaluate \
316
+ --constructor-root CONSTRUCTOR_ROOT \
317
+ --restricted-root RESTRICTED_ROOT \
318
+ --output OUTPUT_DIR \
319
+ --known-effect-gamma 0.3 \
320
+ --state-update-weights upper \
321
+ --ope-denominator exact_behavior \
322
+ --ope-episodes 1024
323
+ ```
324
+
325
+ Running on the real fitted simulators requires credentialed checkpoints. The public synthetic smoke uses synthetic fixtures:
326
+
327
+ ```bash
328
+ ehrdyn-icu fitted-synthetic-smoke \
329
+ --output OUTPUT_DIR \
330
+ --known-effect-gamma 0.3 \
331
+ --ope-denominator exact_behavior \
332
+ --ope-episodes 64
333
+ ```
334
+
335
+ Run a null check through the smoke with:
336
+
337
+ ```bash
338
+ ehrdyn-icu fitted-synthetic-smoke \
339
+ --output OUTPUT_DIR \
340
+ --known-effect-gamma 0
341
+ ```
342
+
343
+ `--known-effect-gamma` selects the variant and sets the effect strength. Without it, the paper's simulator is used unchanged. The delay defaults to 0. The variant defaults to `upper` weights, with persistence 0.85 and learned change 0.40, or 0.30 for AKI. The `default` weights use persistence 0.55 and learned change 0.20, matching the paper's reference. Both `terminal_once` and `per_step_head` are supported in the observed regime only.
344
+
345
+ For off-policy evaluation (OPE), `crossfit_stronger` uses re-estimated logging probabilities as in the paper. `exact_behavior` uses the simulator's known logging probabilities. `--ope-episodes` sets the logged dataset size. The paper uses 256. Receipts record the known-effect settings, denominator, and dataset size.
346
+
347
+ The Python interface is `known_effect_simulator(simulator, task_name, gamma=0.3, delay=0, weights="upper")` in `kdd2027_benchmark.fitted.known_effect`. Its `oracle_policy` and `anti_oracle_policy` select supported actions closest to and farthest from the state-dependent target intensity. They are privileged references. `mixture_policy` supports policy mixtures.
348
+
349
+ In `kdd2027_benchmark.fitted.known_effect_diagnostics`, `null_check` checks that gamma = 0 gives identical episodes for every policy under common random numbers. `designed_policy_test` evaluates behavior mixtures toward the oracle or anti-oracle using direct-rollout truth and fresh logged datasets under each OPE denominator. `summarize_designed_policy_test` reports the slope of signed error on the true value difference from behavior, a dataset-bootstrap interval, and errors at the two extreme mixtures.
350
+
351
+ Inspect controlled dynamics headroom from the released aggregate returns with:
352
+
353
+ ```bash
354
+ ehrdyn-icu controlled-dynamics-headroom
355
+ ```
356
+
357
+ The command reports, per profile, the history-only true-model planner minus the persistence planner and the best learned planner minus persistence, on the control-scaled return. The table covers the four controls, the true-model planner, and seven transition-model planners in the 40 public development environments. Recomputing planner returns requires the full controlled pipeline.