# Recurrent Neural Network Based Short-Term Load Forecast with Spline Bases and Real-Time Adaptation
## 2 Methodology
### Temperature Forecast Adjustment  
Currently, TCWB provides three-hour temperature forecasts for the present day (\(D\)-day), the next day (\(D+1\)), and the maximum and minimum temperature forecasts for the days (\(D+2\)) to (\(D+7\)).  
1. Calibration of temperature forecasts  
To calibrate the day-ahead temperature forecasts at the eight time points \(s_{1},\ldots,s_{8}\) provided by TCWB before \(D\)-day (the first day that the temperature forecasts are to be calibrated), the errors between the historical apparent temperatures \(T_{a}(t,s)\), and the recorded day-ahead temperature forecasts of the 28 days before \(D\)-day, \(\widehat{T}_{a}(t,s)\), \(t=D-1,\ldots,D-28\), \(s=s_{1},\ldots,s_{8}\), are used for the calibration. Define both the historical and the forecasted mean temperatures of the 28 days before \(D\)-day as \(\overline{T}(D,s)\) and \(\widehat{\overline{T}}(D,s)\) respectively, where \(s=s_{1},\ldots,s_{8}\):  
\[\overline{T}_{a}(D,s)=\frac{1}{28}\sum_{t=D-28}^{D-1}T_{a}(t,s) \tag{5}\]  
\[\widehat{\overline{T}}_{a}(D,s)=\frac{1}{28}\sum_{t=D-28}^{D-1}\widehat{T}_{a }(t,s) \tag{6}\]  
For \(D\)-day, let the error between the mean temperatures and the calibrated temperature forecasts be, respectively:  
\[T_{e}(D,s)=\overline{T}_{a}(D,s)-\widehat{\overline{T}}_{a}(D,s) \tag{7}\]  
\[T_{c}(D,s)=\widehat{T}_{a}(D,s)+T_{c}(D,s) \tag{8}\]  
The calibrations and (\(D+1\))-day's eight temperature forecast time points can be found similarly. Note that samples from historical days with unusual temperature pattern are treated as outliers and thus deleted beforehand.  
2. Refined temperature forecasts  
As we need to make load forecasts at 15-min intervals, we first interpolate the provided three-hour forecast data into a 15-min resolution, which will lead to smaller biases versus the real 15-min interval temperatures. We use the well-established Cubic Hermite interpolation method [20] and present that interpolation formula below.  
Let the sequence \(\left\{u_{i}\right\}_{i=1}^{k}\) be a partition \(u_{1}<u_{2}<\cdots<u_{k}\) of the interval \([u_{1},u_{k}]\), and let \(\left\{T_{i}\right\},T_{i}=h(u_{i})\), be the corresponding data points. The local grid spacing is \(\Delta u_{(i+0.5)}=u_{(i+1)}-u_{i}\), and the slope of the piecewise linear interpolant between the data points is \(S_{i+0.5}=\frac{\Delta h_{i}\oplus 0.5}{\Delta u_{i+0.5}}\).  
The cubic Hermite interpolant polynomial defined for \(u_{i}<x<u_{i+1}\) is:  
\[H(u)=c_{3}(u-u_{i})^{3}+c_{2}(u-u_{i})^{2}+c_{1}(u-u_{i})+c_{0} \tag{9}\]  
where  
\[c_{0}=T_{i},\ \ c_{1}=\dot{h}_{i},\]\[c_{2}=\frac{3S_{i+0.5}-\dot{h}_{i+1}-2\dot{h}_{i}}{\Delta u_{(i+0.5)}},\ \ c_{3}=-\frac{2S_{i+0.5}-\dot{h}_{i+1}-\dot{h}_{i}}{\Delta h_{i+0.5}^{2}},\]  
\[\dot{h}_{i}=-\frac{\Delta u_{(i-0.5)}S_{i+0.5}+\Delta u_{(i+0.5)}S_{i-0.5}}{ \Delta u_{(i+0.5)}-\Delta u_{(i-0.5)}},\]  
Then the interpolant method produces as its output a sequence of temperature forecasts at 15-min intervals.  
3. Transformed temperature forecasts  
It is noted that the effect of temperature to the load is nonlinear as shown in Figure 2 and upon examination it is observed that the load is approximately linearly related to the logistic sigmoid transformation of the temperature through  
\[g(T)=\frac{1}{1+e^{-c_{1}(T-c_{0})}} \tag{10}\]  
where \(c_{0}=30\) represents the location of the reflection from concave upward to concave downward, \(c_{1}=0.85\) represents the scale parameter controlling slope changes.