jxx123 / simglucose

A Type-1 Diabetes simulator implemented in Python for Reinforcement Learning purpose
MIT License
232 stars 109 forks source link

fix meal bolus formula #36

Closed jxx123 closed 2 years ago

jminlee97 commented 2 years ago

Hi, I have some questions about the changes to this formula.

From my understanding, and the test results provided, this effectively increases the amount of bolus given at each timestep by * env_sample_time. Why make this change? From my understanding, the meal information provided to the controller is the total amount of meal. Thus the total amount of bolus insulin to be administered seems to be correctly calculated using the old formula.

Were changes made to other parts of the code so that the controller no longer gets the total amount of meal?

jxx123 commented 2 years ago

Hi, I have some questions about the changes to this formula.

From my understanding, and the test results provided, this effectively increases the amount of bolus given at each timestep by * env_sample_time. Why make this change? From my understanding, the meal information provided to the controller is the total amount of meal. Thus the total amount of bolus insulin to be administered seems to be correctly calculated using the old formula.

Were changes made to other parts of the code so that the controller no longer gets the total amount of meal?

Hi, the meal info provided to the controller is the meal rate, i.e. meal (g) / env_sample_time, instead of the total amount of the meal, so I need to multiply it back. I confirmed this myself, but welcome a second eye to check this. If you think this is incorrect, can you show me some examples? We can debug from there.

jminlee97 commented 2 years ago

You're right, I checked the values as well and the modified version is correct. Could you include this in the release notes? I think it's a significant update for those who use the default basal bolus controller as a baseline. Thank you for the update!