You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Combines retrospective correction-only prediction generation and date retrieval.
213
+
214
+
-**Parameters**:
215
+
-`json_file`: The JSON data input. See python tests and test files for example inputs.
216
+
-**Returns**: A tuple containing a list of retrospective correction-only prediction values and a list of prediction dates.
217
+
218
+
-------------------------
219
+
72
220
### Get Glucose Effect Velocity
73
221
74
222
`get_glucose_effect_velocity(json_file, len=72)`
@@ -326,6 +474,92 @@ See linux_setup.sh
326
474
327
475
Run command `pytest`.
328
476
477
+
## Examples and Plotting
478
+
479
+
### Prediction Trajectories Visualization
480
+
481
+
The repository includes a comprehensive plotting script that demonstrates the different prediction trajectories generated by each algorithm effects option.
482
+
483
+
#### Running the Plotting Script
484
+
485
+
```bash
486
+
python examples/plot_predictions.py
487
+
```
488
+
489
+
This script will:
490
+
- Load test data from `python_tests/test_files/generate_prediction_input.json`
491
+
- Generate predictions using all 5 prediction methods:
492
+
- All effects combined (baseline)
493
+
- Insulin effects only
494
+
- Carbohydrate effects only
495
+
- Glucose momentum effects only
496
+
- Retrospective correction effects only
497
+
- Create comprehensive visualizations showing:
498
+
-**Main trajectory plot**: All prediction curves on one graph with historical glucose context
499
+
-**Individual effects comparison**: Side-by-side subplots comparing each effect type to the baseline
500
+
-**Event annotations**: Carbohydrate entries and insulin bolus doses marked on the timeline
501
+
- Calculate and display summary statistics for each prediction method
502
+
- Save high-quality PNG and PDF versions of the plots to `examples/plots/`
503
+
504
+
#### Requirements
505
+
506
+
Install plotting dependencies:
507
+
```bash
508
+
pip install matplotlib
509
+
```
510
+
511
+
Or install all requirements:
512
+
```bash
513
+
pip install -r requirements.txt
514
+
```
515
+
516
+
#### Output
517
+
518
+
The script generates:
519
+
-**Interactive plots**: Displayed during execution for immediate analysis
520
+
-**High-quality exports**:
521
+
-`examples/plots/glucose_prediction_trajectories.png/pdf` - Main comparison plot
0 commit comments