# Recurrent Neural Network Based Short-Term Load Forecast with Spline Bases and Real-Time Adaptation
## 2 Methodology
### Semi-Parametric Model  
A semi-parametric (SPM) model is adopted for STLF under the framework of additive models [22], by a suitable combination of the two aforementioned sets of spline basis functions, together with the nonlinear function of the temperature.  
Now let the sequence of daily load random vectors at time \(t\) be \(y_{t}=(y(t,1),\ldots,y(t,n))^{\prime}\), \(t=1,\ldots,T\), with \(y(t,s)\) denoting the load at time \(t\) and local time grid location (control point) \(s,\ s=1,\ldots,n\).  
The model for STLF is assumed to have the following form:  
\[\widetilde{y}(t,s)=\log(y(t,s))=\mu(t,s)+\epsilon(t,s) \tag{3}\]  
where \(\mu(t,s)\) represents the mean function of the logarithm of the daily load \(\widetilde{y}(t,s)\), and \(\epsilon(t,s)\) is the corresponding random error at time \(t=1,\cdots,T\) and period \(s=1,\ldots,n\), assuming that \(\epsilon_{t}=(\epsilon(t,1),\ldots,\epsilon(t,n))^{\prime}\ \sim N(0,\Sigma_{n}(t))\), with \(\Sigma_{n}(t)\) being the covariance matrix of the random error vector \(\epsilon_{t}\) at time \(t\). In the case of an independent error at time \(t\) and assuming \(\Sigma_{n}(t)=\sigma^{2}I_{n}\), the time series errors sequence \(\epsilon_{t},\ t=1,\ldots,\ T\), may yield a different covariance matrix estimate.  
Specific patterns of the response variable (i.e., the system net load) of the model for forecasts are described below, under the following explanatory variables.  
1. It is observed that there are patterns depicted by the intra-daily, intra-weekly, peak and off-peak effects to be modeled by the multi-resolution and cubic \(B\)-spline bases.
2. It is clear that the temperature significantly affects the load pattern. The weighted average of the temperature at different periods each day, and similarly the daily highest and lowest and the weighted average of temperatures in the different regions, are included as important predictors.
3. The interaction effects of the period with the day type within each week are also crucial.  
To accommodate these three effects, and also the temperature effect, let the mean function at time \(t\) and point s be given by:  
\[\mu(t,s)=W(t)+D(s)+DW(t,s)+T(t,s) \tag{4}\]  
with:  
1. intra-weekly effect \(W(t)\)
2. intra-daily effect \(D(s)\)
3. interaction effect among the intra-daily and intra-weekly \(DW(t,s)\)
4. apparent temperature effect \(T(t,s)\)  
To model the intra-daily effect, we use a combination of the first 24 multi-resolution bases \(\{f_{1},\ldots,f_{24}\}\) for 96 control points with \(s_{i}=i,\ i=1,\ldots,96\), and 96 cubic \(B\)-spline bases \(\left\{\ B_{j,A}^{d},\ j=1,\ldots,96\right\}\) with knots at \(s_{j},\ j=1,\ldots,\ 96\).  
Similarly, the intra-weekly effect is modeled by 7 cubic \(B\)-spline bases \(B_{k,}^{w}\) with knots at \(w_{k},\ k=1,\ldots,7\).  
The interaction effects among the intra-daily and intra-weekly are modeled by the products of the corresponding intra-daily and intra-weekly bases functions, namely: \(\left\{B_{k,A}^{w}\cdot f_{i},\ k=1,\ldots,\ 7,\ i=1,\ldots,24,\ \right\}\), \(\left\{B_{k,A}^{w}\cdot B_{j,A}^{d},\ k=1,\ldots,7,\ j=1,\ldots,96\right\}\).  
A detailed description of the spline bases functions is provided in Appendix A. The corresponding SPM is a linear combination of the above basis functions. The explicit expression of the model is given in Appendix B.