mariusae / tune Goto Github PK
View Code? Open in Web Editor NEWParameter tuning models for Loop
Parameter tuning models for Loop
Hi,
I wrote a quick nightscout-to-tune input converter (https://github.com/trixing/tune). It produces json files like attached, which seems to conform to the specified format (for 1, 3, 7 days respectively in this case).
Unfortunately the produced basal schedule is rather meaningless: a factor of ~10x too high, and also the same result if I run on 3 or 7 days.
3-day data
{"version": 1, "timezone": "Europe/Berlin", "insulin_sensitivity_schedule": {"index": [0, 390], "values": [170.0000000000016, 169.99999999999957]}, "carb_ratio_schedule": {"index": [0, 360, 660, 1050], "values": [9.000000000000052, 9.000000000000027, 9.000000000000002, 9.000000000000005]}, "basal_rate_schedule": {"index": [0, 60, 120, 180, 240, 300, 360, 420, 480, 540, 600, 660, 720, 780, 840, 900, 960, 1020, 1080, 1140, 1200, 1260, 1320, 1380], "values": [6.060164554997598, 5.789143251467735, 6.669406893763722, 7.100211844444492, 7.206123554462863, 7.198766166916485, 7.2001180743763005, 7.200090756536767, 7.1998197971922835, 7.200449445844885, 7.198854832952293, 7.202448204774257, 7.1960631269896504, 7.202852101333228, 7.2101639269212, 7.1397788680270615, 7.410869150932365, 6.530692446003393, 6.099377983276996, 5.995011592147588, 5.998777410458621, 6.0038361020430315, 5.997054760167179, 5.98992515397004]}, "training_loss": NaN}
7-day-data
{"version": 1, "timezone": "Europe/Berlin", "insulin_sensitivity_schedule": {"index": [0, 390], "values": [170.0000000000016, 169.99999999999957]}, "carb_ratio_schedule": {"index": [0, 360, 660, 1050], "values": [9.000000000000052, 9.000000000000027, 9.000000000000002, 9.000000000000005]}, "basal_rate_schedule": {"index": [0, 60, 120, 180, 240, 300, 360, 420, 480, 540, 600, 660, 720, 780, 840, 900, 960, 1020, 1080, 1140, 1200, 1260, 1320, 1380], "values": [6.060164554997598, 5.789143251467735, 6.669406893763722, 7.100211844444492, 7.206123554462863, 7.198766166916485, 7.2001180743763005, 7.200090756536767, 7.1998197971922835, 7.200449445844885, 7.198854832952293, 7.202448204774257, 7.1960631269896504, 7.202852101333228, 7.2101639269212, 7.1397788680270615, 7.410869150932365, 6.530692446003393, 6.099377983276996, 5.995011592147588, 5.998777410458621, 6.0038361020430315, 5.997054760167179, 5.98992515397004]}, "training_loss": NaN}
I'm uncertain though if I'm inputing everything correctly. My understanding is that "tune" expects a delta amount from the scheduled basal rate for example? The delta modeling is also easy to get wrong, but it looks correct.
I'd be interested to get the model to work, just as a reference point to autotune and manual tuning.
There is also code in model.py which does a cumsum ("undelta") on the basal durations. I'm not sure how that is useful but uncommenting the line doesn't change the result, which is a bit surprising. In general the algorithm seems a bit too stable?
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.