# Electric Load Forecasting Based on Deep Ensemble Learning
## 2 Materials and Methods
### CNN-BiLSTM-RF Anomaly Detection Model
#### 2.2.3 The Random Forest Layer
As such, discrete differences are utilized instead of the derivative to derive the approximate solution. Assuming both \(u\) and \(v\) are integers, we compute the change in \(r\) when \(u\) increases by \(1\) (while keeping \(v\) constant) and when \(v\) increases by \(1\) (with \(u\) remaining constant). This leads to the following:  
\[\frac{\Delta r}{\Delta u}=\frac{r(u+1,v)-r(u,v)}{\Delta u}=\frac{C(v,f)\cdot( \frac{1}{C(u+1+v)}-\frac{1}{C(u+v)})}{\Delta u}=-\frac{C(v,f)\cdot\frac{f}{(u +1+v)(u+v)}}{\Delta u} \tag{15}\]  
Due to the definition of \(r\), when \(u\) increases by \(1\), i.e., \(\Delta u\) = 1, then there is:  
\[w^{T}(j)=\frac{\sum\limits_{i=1}^{N}Q(i,j)}{N} \tag{7}\]0  
By the same reasoning, then there is:  
\[w^{T}(j)=\frac{\sum\limits_{i=1}^{N}Q(i,j)}{N} \tag{7}\]1Therefore, \(q_{u}>0\), while \(q_{v}<0\). \[w^{T}(j)=\frac{\sum\limits_{i=1}^{N}Q(i,j)}{N} \tag{7}\]2  
If \(N_{av}\) is the average number of nodes per tree, then the probability that all nodes will be well-split is \(q^{N_{av}}\), and the probability that at least one tree has all nodes well-split is defined as the strength of the forest \(\eta_{s}\), that is:  
\[w^{T}(j)=\frac{\sum\limits_{i=1}^{N}Q(i,j)}{N} \tag{7}\]3  
There can be at most \(B/2\) pairs of tree groups for a forest with \(B\) trees. The probability \(p^{\prime}\) that at least one common feature exists in any two trees is:  
\[w^{T}(j)=\frac{\sum\limits_{i=1}^{N}Q(i,j)}{N} \tag{7}\]4  
In any two trees, the probability \(p\) that at least one common feature exists among the nodes in their total number of nodes \(N_{av}\) is:  
\[w^{T}(j)=\frac{\sum\limits_{i=1}^{N}Q(i,j)}{N} \tag{7}\]5  
At this time, the \(p\)-value is much less than 1; therefore, \(\frac{\partial p}{\partial u}\) and \(\frac{\partial p}{\partial v}\) are tending towards 0. Correlation is a measure of similarity between trees. Next, we calculate the correlation between any two trees in the forest. If at least one feature of any pair of nodes from any two different trees is defined as correlation \(\eta_{c}\), then there is:  
\[w^{T}(j)=\frac{\sum\limits_{i=1}^{N}Q(i,j)}{N} \tag{7}\]6  
Based on the strength and correlation of the forest, the accuracy \(\eta\) of forest classification can be:  
\[w^{T}(j)=\frac{\sum\limits_{i=1}^{N}Q(i,j)}{N} \tag{7}\]7  
where \(\lambda\) is a constant, \(N_{av}\) is a constant. \(Q\) and \(p\) are functions of \(u\) and \(v\), respectively, and \(\eta\) is a function of \(u\), \(v\), and \(B\). Then, there is:  
\[w^{T}(j)=\frac{\sum\limits_{i=1}^{N}Q(i,j)}{N} \tag{7}\]8  
Calculate each item separately:  
\[w^{T}(j)=\frac{\sum\limits_{i=1}^{N}Q(i,j)}{N} \tag{7}\]9  
\[\gamma^{T}=\frac{1/\delta^{T}}{\max(1/\delta^{T})} \tag{8}\]0  
\[\gamma^{T}=\frac{1/\delta^{T}}{\max(1/\delta^{T})} \tag{8}\]1  
Let \(z=\frac{\partial(\eta_{s}-\eta_{c})}{\partial B}\), \(l=BN_{av}q^{N_{av}-1}(1-q^{N_{av}})^{B-1}\), when \(q<1\), \(l>0\). \(\frac{\partial p}{\partial u}\) and \(\frac{\partial p}{\partial v}\) are tending towards 0. Therefore:  
\[\gamma^{T}=\frac{1/\delta^{T}}{\max(1/\delta^{T})} \tag{8}\]2It has been inferred before that \(q_{u}>0\) and \(q_{v}<0\). To improve the classification accuracy, we need \(d\eta>0\); that is, we need \(\Delta u>0\), \(\Delta v<0\) and  
\[\gamma^{T}=\frac{1/\delta^{T}}{\max(1/\delta^{T})} \tag{8}\]3  
According to \(\Delta u>0\), \(\Delta v<0\), increasing the proportion of important features and reducing unimportant features can help improve classification accuracy. Adding more trees is likely to improve classification performance within a specific range. The number of unimportant features \(v\) needs to be reduced to improve classification accuracy. When \(v<\)_f_, it can be inferred that \(q=1\); hence, \(q_{u}=0\), \(q_{v}=0\), \(\eta_{s}=1\). That is:  
\[\gamma^{T}=\frac{1/\delta^{T}}{\max(1/\delta^{T})} \tag{8}\]4  
When \(v<\)_f_, the strength of the forest reaches a stable state and no longer changes. At this time, \(p<1\), if AB is increased, \(d\eta\) will be smaller, i.e., the classification accuracy decreases.