## 4 RFR-Based LP-IoT Channel Estimation Models
### RFR(S) Model  
In the Sequence-based strategy, we select a specific subset of data from a prepared dataset that contains RSSI values. The prepared dataset is structured with three primary features: distance, condition, and category, as explained in Section 4.1. A combination of these features, such as \([3,0,0]\), is used to select the corresponding RSSI series. Specifically, this combination selects RSSI values where the distance is 3 m, the condition LoS has a value of 0, and the fixed location of the receiver has a category value of 0, as shown in Figure 4. The selected subset of RSSI values, extracted from the dataset's fourth column, is then transformed into a time series. Then, we feed the selected RSSI series into the RFR(S) model for training and estimation. The high-level expression of the RFR(S) model is as follows:  
\[X^{\gamma}_{(s,c,g)}\xrightarrow[]{\text{selected sequence}}\mathcal{S}_{ \gamma_{t}}\xrightarrow[]{\text{output}}\mathcal{R}^{SQ}_{\hat{\gamma}}, \tag{4}\]  
where \(X^{\gamma}_{(s,c,g)}\) denotes feature combinations used to select an RSSI series, \(\mathcal{S}_{\gamma_{t}}\) indicates the selected sequence of RSSI against the selected feature combination of \(s\), \(c\), and \(g\), and \(\mathcal{R}^{SQ}_{\hat{\gamma}}\) represents the estimated output of RFR(S) model. Considering the selected RSSI sequence \(\mathcal{S}_{\gamma_{t}}\) as a time series, we transform this series into a supervised learning problem called 'Sliding Window'. In this method, we use the RSSI (selected using the combination of different features) at previous time steps \((t-1,t-2,...)\) as features and estimate the RSSI at the next time step using the previous values with a lag of 3, such that \(n=3\). This method is implemented in time series forecasting using the RFR algorithm to create a regression problem from the time series data effectively. To represent the function of single tree model in a generalised manner, let us consider the selected series of RSSI values denoted as \(\gamma_{t}\), where \(t\) represents a specific time stamp. If we assume \(n\) lagged values as features, the predicted RSSI, denoted as \(\hat{\gamma}_{(t+1)}\), can be estimated as a function of the previous \(\gamma_{t}\) as follows:  
\[\mathcal{P}=\hat{\gamma}_{(t+1)}\leftarrow\gamma_{(t-i)i=0}^{n-1},\text{such that }n<t, \tag{5}\]  
where \(\hat{\gamma}_{(t+1)}\) is the estimated RSSI at timestamp \((t+1)\), \(n\) represents the number of the lagged RSSI values used as features, and \(\mathcal{P}\) denotes the estimation from a single tree. The RFR(S) model can be mathematically expanded as follows:  
\[\mathcal{R}^{SQ}_{\hat{\gamma}}=\frac{1}{T}\sum_{j=1}^{T}\mathcal{P}_{j}, \tag{6}\]  
where \(\mathcal{R}^{SQ}_{\hat{\gamma}}\) represents the final estimation through the RFR(S) algorithm with two estimators, such that \(T=2\), trained through bootstrapping on historical data to map the lagged RSSI values to future values; \(T\) represents the number of trees in the RFR model and \(\mathcal{P}_{j}\) is the estimation from the \(j^{th}\) tree in the forest. These representations model the RFR(S)'s operation for time series forecasting by utilising the dependency of future RSSI values on past observations through an ensemble learning approach, as shown in Figure 5.  
Training and Evaluation  
To prepare the data for training the Random Forest Regressor RFR(S), the selected time series is divided into sequences. A sliding window approach is applied, where each sequence is of length input size, determined as 3 for this study. This window moves through the time series, creating sequences and corresponding target values. The sequences consist of consecutive RSSI values, and the target is the RSSI value immediately following each sequence. The generated sequences and their corresponding targets are then split into training and testing datasets. The training set comprises 80% of the sequences, with the remaining 20% reserved for testing.