## 2 Material and Methods
### Glucose Predictors Validation  
As described in Section 2.1, the training dataset comprised sixteen-weeks in silico data for a ten patient cohort. For each patient \(p\), training data was partitioned (following the descriptions in Section 2.2 for partition, and Section 2.3 for regularization) in \(\Pi_{\mathcal{M}}^{p}\), \(\Pi_{\mathcal{N}}^{p}\), and \(\Pi_{\mathcal{H}}^{p}\) sets. Clustering (see Section 2.4) and local model training and integration (Sections 2.6 and 2.7) was then applied to each partition, yielding a set of individual glucose predictors (one per patient \(p\) and event group \(\mathcal{M}\), \(\mathcal{N}\), and \(\mathcal{H}\)): \(\hat{G}_{\mathcal{M}}^{p}(i)\), \(\hat{G}_{\mathcal{N}}^{p}(i)\), and \(\hat{G}_{\mathcal{H}}^{p}(i)\). The same procedure has been applied to the population data in the partitions \(\Pi_{\mathcal{M}}\), \(\Pi_{\mathcal{N}}\), and \(\Pi_{\mathcal{H}}\), then resulting in a single population glucose predictor per event (\(\mathcal{M}\), \(\mathcal{N}\), and \(\mathcal{H}\)), but valid for all patients: \(\hat{G}_{\mathcal{M}}(i)\), \(\hat{G}_{\mathcal{N}}(i)\), and \(\hat{G}_{\mathcal{H}}(i)\).  
It must be recalled that in both cases, individual and population training, 80% of the available data for each cluster was used for local models identification and the remaining 20% was kept for validation time series following the procedure described in Section 2.5. These partial results on local modeling are kept internal and not shown in this work, since it is not deemed relevant for the conclusions.  
Individual (patient-personalized) glucose predictors performed very well in previous works [18], and this performance will be compared to the population predictor in this work. Additionally, the population predictor performance degradation will be studied as the number of data is reduced (the number of weeks of available data per patient is reduced sequentially from 16 to 2 weeks) for prediction horizons in the set \(PH\in\{15,30,60,120,180,240\}\) min.  
Both glucose predictors (individual and population) performance have been evaluated using an independent 2-month validation dataset (see Section 2.1). Each glucose predictor has been matched, at each event, according to its type (meal, night, hypoglycemia treatment). For all time series in the validation data, predictions have been computed as described in Section 2.7. In order to facilitate results comparison with previous studies in glucose prediction in the literature, the standard metric RMSE (mg/dL) has been used here to measure forecasting accuracy:  
\[RMSE:=\sqrt{\frac{1}{n}\sum_{i=1}^{n}e^{2}(i)} \tag{15}\]  
where \(n\) is the number of observations, \(e(i)=G(i)-\hat{G}(i)\) is the forecasting error (residual), \(G(i)\) denote the \(i\)th glucose observation, and \(\hat{G}(i)\) is the forecast of \(G(i)\). The residuals of the glucose trajectory are built from predictions at time \(t_{p}\) for a prediction horizon \(PH\), i.e. \(G(t_{p}+PH\mid t_{p})\). It evaluates how successfully the actual glucose trajectory can be predicted \(PH\) time samples ahead. In this case, for each time series in the validationdata, and denoting \(l_{i}\) as the length of the time series, \(l_{i}-PH\) observations are available for the computation of residuals. Metrics were averaged for all those time series in the validation data.