## 3 Proposed Resilient Demand Forecasting Systems

Table 1: The Definitions of Terms used in Section 3. _Output 1_: TMS derives the aggregate demand time series \(\left(\overrightarrow{D(t)}\right)\) of individual DPVs by averaging the measurements. DFS uses \(\overrightarrow{D(t)}\) as inputs. If all DPVs were equally trustworthy, a simple average would be appropriate to aggregate the measurements of all DPVs. However, since the measurements of all DPVs are not always equally trustworthy due to adversarial attacks and mechanical issues, a weighted average is more appropriate than a simple average for the derivation of aggregate demand \((\boldsymbol{D(t)})\). TMS first determines the trustworthiness weights of the measurements based on the data similarity, provenance similarity, past measurements, and the predicted trustworthiness of the corresponding DPVs at a given time step using the ensembles of Convolutional Neural Networks (CNNs) [39] and Generalized Regression Neural Networks (GRNNs) [40], and then performs the weighted average. TMS sends the aggregate demand time series \(\left(\overrightarrow{D(t)}\right)\) to DFS. _Output 2:_ At the end of each time step, TMS assesses the trust scores \([\textit{trs}_{1}(t),\ldots,\textit{trs}_{N}(t)]\) for all DPVs based on the distances between their measurements and the most trustworthy aggregated measurement \((\textit{D}(t))\) at that time step. TMS updates \(\textit{TS}=\left[\textit{trs}_{1}(t-\overrightarrow{1}),\ldots,\textit{ trs}_{N}(t-\overrightarrow{1})\right]\) by adding \([\textit{trs}_{1}(t),\ldots,\textit{trs}_{N}(t)]\) to \(\textit{TS}\). The updated \(\textit{TS}\) is \(\textit{TS}=\left[\textit{trs}_{1}(t),\ldots,\textit{trs}_{N}(t)\right]\). _Output 3:_ At each time step, TMS produces the residuals \([\varepsilon_{1}(t),\ldots,\varepsilon_{N}(t)]\) of one-step ahead forecasts of the measurements of all DPVs at that time step. TMS then updates \(\textit{SE}=\left[\varepsilon_{1}(t-\overrightarrow{1}),\ldots,\varepsilon _{N}(t-\overrightarrow{1})\right]\) to \(\textit{SE}=\left[\varepsilon_{1}(t),\ldots,\varepsilon_{N}(t)\right]\) by adding \([\varepsilon_{1}(t),\ldots,\varepsilon_{N}(t)]\) to \(\textit{SE}\). _DFS:_ The flowchart for DFS is provided in Figure 3. DFS performs \(\textit{k}\)-step ahead out-of-sample forecasting of demand based on \(\overrightarrow{D(t)}\) derived by TMS. It uses wavelet decomposition [41] to split \(\overrightarrow{D(t)}\) into component series of various frequencies. It then uses a pair of hierarchical ensembles of CNNs to estimate the distribution of demand forecasts based on the values of the component time series at non-seasonal lags. The member CNNs are trained sequentially such that the first member CNN is trained on the component time series of \(\overrightarrow{D(t)}\) and each of the other member CNNs is trained on the component time series of the residuals of the member CNN trained just before it. DFS keeps increasing the number of member CNNs in the ensemble until the residual series of the last member CNN becomes white noise. We call this ensemble of CNNs '_Ensemble_\". _Ensemble_\" forecasts the conditional mean demand \(\left(\overrightarrow{D(t+k)}\right)\). DFS also trains another ensemble of CNNs called '_Ensemble_\" in the same way it trained _Ensemble_\". The only difference is that the first member CNN of _Ensemble_\" is trained on the component time series of the squared residuals of _Ensemble_\" and each of the remaining member CNNs is trained on the component time series derived from the time series of the absolute values of residuals obtained from the above member CNN. _Ensemble_\" forecasts the conditional variance \((V(t+k))\) of \(\left(\overrightarrow{D(t+k)}\right)\). During forecasting, each ensemble member in _Ensemble_\" and _Ensemble_\" forecasts values separately. The overall forecast \(\left(\overrightarrow{D(t+k)}\right)\) of _Ensemble_\" is the summation of the forecasts of its all members. The overall forecast \((V(t+k))\) of _Ensemble_\" is the summation of the absolute values of the forecasts of all its member CNNs.