Hacker News new | ask | show | jobs
by 0xdeadf1sh 19 days ago
I absolutely hate exercise. I mean as a machine-learning guy it is the hardest quantifiable feature and yet it causes large swings in blood sugar. I haven't added exercise as additional input yet because I'm still searching for a better way to quantify it.
2 comments

Is heartrate not a decent first approximation? I wouldn't have guessed it would be the best way, but I would have guessed it would be a decent first attempt and would increase model performance.
Unfortunately no, well at least not in my case. My heartrate gets higher before I wake up, and incidentally this is also the time when there is a higher likelihood of getting high blood sugar.

Regarding exercise, my blood sugar gets higher during anaerobic exercises but lower when doing aerobics.

At the moment I consider heartrate a confounding variable rather than a good predictor of BG. I think it could work for sedentary populations for whom higher heartrate correlates well with some kind of aerobic activity.

> My heartrate gets higher before I wake up, and incidentally this is also the time when there is a higher likelihood of getting high blood sugar.

> Regarding exercise, my blood sugar gets higher during anaerobic exercises but lower when doing aerobics.

Isn't all of that fine? You're OP, right? I thought you said your model figured out time of day from the data, right? So let it figure out that before-wakeup behavior too. And the anaerobic vs aerobic, can't it learn that too? Tbh that just sounds like good data. Or the models aren't strong enough to take it?

Along that same line of thinking, would respiratory rate be appropriate? I know some Garmins track it although I cannot speak for their accuracy.
For cycling a power meter might give useful data, and something similar might be possible off a treadmill.
Do you have a smart watch, or a Fitbit, or an Apple watch? You can get heart rate data, or steps per minute, which are pretty good proxies for metabolic activity. Garmin has a free personal API you can use, Fitbit routes through Google Health, and Apple Watch of course goes through Apple Health. Even beyond "exercise" in the traditional sense, my guess is that walking (steps per min), or even just lying/sitting/standing indicators (present in some watches), would improve prediction a lot.

I have done a lot of work on health wearables, and "predict the time series" does a lot better when you can cross-reference it against the biological drivers of the function you're looking at. The other obvious one here would be meals - hard to think of how to flag that properly, lots of options.

Hmm maybe I should build my own wearable using an ESP32 + heart rate sensor? I'm already pretty good at embedded stuff and it would be a nice weekend project.
I would highly recommend a Garmin Smartwatch with 1+ week of battery life. They have built-in models that are very good at measuring activity from heart rate + accelerometer data. I use it for calorie tracking among other things and it works very well.

You can directly export the timeseries over USB (though I just download from Garmin's portal which syncs via bluetooth/wifi.) It also shouldn't be hard to write your own bluetooth/wifi sync.

It can be a pain getting Apple data to merge with eg Garmin. Apps like Run Gap merge it quite well. Some AirPods do heart rate quite well.