## 4 Network Implementation and Learning Algorithm
### Hybrid DELM Model  
The hybrid DELM model combines the deep extreme learning machine model and the random forest model. It utilizes the DELM's ability to learn complex nonlinear relationships due to its deep behavior and flexibility in neuron configuration, with fast processes according to its feature of random weight initialization and the strength of the random forest technique to decrease overfitting by bagging and averaging multiple decision trees, making it strong with noisy data and effective for high-dimensional datasets. The random forest model efficiently obtains the underlying patterns in the data, providing a hard baseline for the proposed model. Simultaneously, the DELM was employed due to its rapid learning abilities, employing a two-hidden-layer structure, with neurons activated by the hyperbolic tangent activation function, which smoothed the modeling of complex relationships among the nonlinear features. The predictions that were achieved from both models were averaged to formulate a comprehensive output. The hybrid approach achieved a great reduction in the mean squared error (MSE) to 0.9, indicating its effectiveness in enhancing the accuracy of predictions for LoRa network performance in terms of power consumption, packet loss, and packet delay, depending on an accurate understanding of the complex relationships between the selected input features, such as the spreading factor, transmission power, coding rate, and bandwidth, which led to a perfect enhancement. Finally, the proposed model is integrated with a random search optimization technique, and they work together to select the best LoRa network node parameters, such as the spreading factor, bandwidth, coding rate, and transmission power, and the LoRa server is informed to reconfigure the LoRa node parameters. However, the hybrid DELM presents some limitations in different aspects, such as increasing the complexity by combining two models as one unit, which leads to more computational processing and tuning, and it may require intensive memory and more execution time to deploy. The hybrid DELM approach is absolutely valuable for systems with complex and nonlinear relationships, especially when the accuracy and processing time are critical, such as in wireless sensor networks or real-time monitoring applications. The integration of these advanced machine learning techniques not only improved the LoRaWAN resource utilization but also contributed to the improvement of the overall performance of the monitoring system. The pseudocode of the hybrid DELM model is provided in Algorithm 1. Figure 4 describes the workflow of the DELM model and how it can be integrated with LoRaWAN to enhance its performance. The mathematical equations that were employed to evaluate the predicted network performance are described in the following equations:  
\[PC=\sum_{i=0}^{N}P(i) \tag{17}\]where  
* PC is the total power consumption in the network;
* P(i) is the power consumption of node (i);
* N is the total number of nodes in the network. \[PD=\frac{\sum_{i=0}^{N}T(i)}{N} \tag{18}\]  
where  
* PD is the average packet delay;
* T(i) is the delay of the packet (i);
* N is the total number of nodes in the network. \[PL=\sum_{i=0}^{N}L(i) \tag{19}\]  
where  
* PL is the total packet loss;
* L(i) is the number of lost packets of node (i);
* N is the total number of nodes in the network. \[ER=\sum_{i=0}^{N}\left(\frac{AV(i)-PV(i)}{AV(i)}\right)\;*\;100 \tag{20}\]  
where  
* ER is the total percentage of the model enhancement ratio;
* AV(i) is the actual value of node i;
* PV(i) is the predicted value of node i.  
Figure 4: Workflow of the LoRa-network-based hybrid DELM model. ```
Input: Dataset with network parameters (SF, TP, BW, CR, PC, PD, PL, etc.) Output: Predicted power consumption, packet delay, packet loss
```  
**Algorithm 1**Pseudocode of the proposed hybrid DELM model  
```
1. Initialization
1.1 Import necessary libraries (pandas, NumPy, scikit-learn, random forest, hpelm, matplotlib). 1.2 Load the dataset.