# Short-Term Load Forecasting Based on the Analysis of User Electricity Behavior
## 3 Short-Term Load Forecasting Model Based on OS-ELM  
### OS-ELM Algorithm  
OS-ELM (Online Sequential Extreme Learning Machine) is a new type of learning algorithm that uses the single hidden layer feed-forward neural network, and this algorithm can be applied to problems of classification and regression [33]. In the traditional extreme learning machine algorithm, when new data are obtained, the historical data will be repeatedly trained together with new data, which requires a lot of time. OS-ELM effectively avoids the repeated training of data and greatly improves the learning efficiency by using a partitioned matrix method [34; 35; 36].  
An OS-ELM description is as follows:  
In any different size \(N\) training sample \(z=\{(x_{i},t_{i})|x_{i}\in R^{n},t_{i}\in R^{n},i=1,\ldots\ldots,N\}\), the number of nodes in the hidden layer is \(L\), and the activation function is \(g(a_{j},b_{j},x)\), where \(a_{j}\) is the input weight and \(b_{j}\) is the threshold of hidden layer nodes.  
Any given values of \(a_{j}\) and \(b_{j}\) can approximate any zero error of the different training samples. It can be expressed as Equation (2):  
\[O_{i}=\sum_{j=1}^{L}\beta_{j}g(a_{j},b_{j},x)=t_{i} \tag{2}\]  
where \(O_{i}\) is the output vector, and \(\beta_{j}\) are the output weights. Equation (2) can be simplified further as follows:  
\[H\beta=T\]  
Figure 4: The normalized load curve of a domestic user.  
where \(\beta_{L\times M}=\left[\beta_{1},\beta_{2},..,\beta_{L}\right]^{T},T_{N\times M}= \left[T_{1},T_{2},..,T_{N}\right]^{T}\), and \(H\) is the hidden layer output matrix which can by calculated by Equation (4):  
\[\begin{array}{c}H(a_{1},..,a_{L};b_{1},..,b_{L};x_{1},..,x_{L})=\\ \left[\begin{array}{ccc}g(a_{1},b_{1},x_{1})&...&g(a_{L},b_{L},x_{1})\\ \vdots&\ldots&\vdots\\ g(a_{1},b_{1},x_{N})&\cdots&g(a_{L},b_{L},x_{N})\end{array}\right]_{N\times L} \end{array} \tag{4}\]  
where the \(j\)-th column in matrix \(H\) shows the \(j\)-th hidden layer node's output given an input \(x_{1},x_{2},\ldots,x_{N}\).  
OS-ELM algorithm process:  
Step 1: Initialization phase: selecting the suitable data in data set \(z\) as a short period of a training set to initialize the network, the number of hidden layer nodes is \(L\).  
(1) The input weight \(a_{j}\) and threshold value \(b_{j}\) of the hidden layer node are randomly selected, \(j=1,2,\ldots\ldots,L\);  
(2) The hidden layer and output matrix calculation, as shown in Equation (5);  
and \(P_{k+1}\) can also be expressed as Equation (11) through further calculation.  
\[P_{K+1}=P_{k}-P_{K}H_{k+1}^{T}(I+H_{k+1}P_{k}H_{k+1}^{T})^{-1}H_{k+1}P_{k} \tag{11}\]  
(4) Set \(k=k+1\), return to Step 2, and update the output weights constantly until all the data have been processed.  
The OS-ELM algorithm only uses a small part of data for training and learning in the initial stage, and the training data is discarded after the training. Additionally, the parameters \(H\) and \(\beta\) which are obtained by training are stored in the network; in the continuous learning phase, inputting change data updates parameters in real time, which greatly enhances the network generalization ability.