How nedamhs/diabetesrl works
DiabetesRL is a research project for PPO-based automated insulin control in the SimGlucose diabetes simulator. The main workflow trains vanilla or stacked-observation policies, then evaluates trained policies through simulated patient episodes and reports survival and glucose-range metrics; the README also describes cross-patient evaluation. The source excerpts show environment construction, observation/action wrappers, reward logic, and evaluation helpers. Notebook internals were not sampled, so notebook-to-code wiring is documented at a high level rather than inferred in detail.
Main entry points: train.ipynb PPO training · project.ipynb Evaluation notebook · make_environment.py Environment builders · utils.py Evaluation helpers
Components 14
Simulation setup
- SimGlucose
- Environment builders
src/make_environment.py - Action clipping
src/wrappers.py - Feature engineering
src/wrappers.py - Observation stacking
src/wrappers.py
Policy learning
- Reward shaping
src/reward_function.py - PPO training
train.ipynb - Vanilla policy
trained_policies/vanilla_policy_state_dict.pt - Stacked policy
trained_policies/stacked_policy_state_dict.pt - Recurrent policy
trained_policies/recurrent_policy_state_dict.pt
Evaluation
- Evaluation notebook
project.ipynb - Evaluation helpers
src/utils.py - Episode metrics
src/utils.py
Other components
- Researcher
Connections 16
- Researcher → PPO training: trains
README.md - Researcher → Evaluation notebook: evaluates
README.md - PPO training → Vanilla policy: saves weights
README.md - PPO training → Stacked policy: saves weights
README.md - PPO training → Recurrent policy: saves weights
README.md - Environment builders → SimGlucose: creates environment
src/make_environment.py - Environment builders → Action clipping: wraps actions
src/make_environment.py - Environment builders → Feature engineering: wraps observations
src/make_environment.py - Environment builders → Observation stacking: adds stacking
src/make_environment.py - Evaluation notebook → Evaluation helpers: uses evaluation
README.md - Evaluation notebook → Vanilla policy: evaluates policy
README.md - Evaluation notebook → Stacked policy: evaluates policy
README.md - Evaluation notebook → Recurrent policy: evaluates policy
README.md - Evaluation helpers → Episode metrics: computes metrics
src/utils.py - Evaluation helpers → Environment builders: runs rollouts
- PPO training → Reward shaping: uses reward