# Utilizing Ensemble Learning to Improve the Distance Information for UWB Positioning
## 3 Our Architecture and Algorithm  
The uncertain measurement in the real environment may introduce incorrect information. Generally speaking, the noise part is often assumed as a white Gaussian noise. However, the white Gaussian noise may not fit the uncertain measurement well in practice. Thus, we need some novel ideas for overall consideration instead of merely using a deterministic process to simulate the uncertainty. Now, we begin to detail our algorithm, which is shown in Algorithm 1. Foremost, \(anchor_{i}\) and \(tag\) represent the devices with UWB transceivers in the experiment (line 1). Then we have some data sets, which are set to \(\phi\) initially, i.e., \(DATA\), \(TRAINING\), and \(TESTING\) (lines 2-5). Moreover, we define several functions (lines 6-9):  
* **initialize**(\(x\)) is used to put device \(x\) at a specific location for the purpose of obtaining training and testing data;
* **sys_dis**(\(x,y\)) is utilized to return the distance information between device \(x\) and device \(y\) provided by the UWB system;
* **real_dis**(\(x,y\)) is utilized to return the actual distance information between device \(x\) and device \(y\);  
Figure 2: The refinement for UWB positioning in [5]. * **prefilter(\(a\))** is a method to discard unreasoned parts from data \(a\) and then return the residual part. ```
Variable: (01) anchor\(i_{1}\) and tag are devices with UWB transceivers; (02) DATA, TRAINING and TESTING are data sets; (03) DATA \(\leftarrow\)\(\emptyset\); (04) TRAINING \(\leftarrow\)\(\emptyset\); (05) TESTING \(\leftarrow\)\(\emptyset\); Function: (06) initialize(\(x\)): put device \(x\) at a specific location; (07) sys_dis(\(x\), \(y\)): the distance between device \(x\) and device \(y\) provided by the UWB system; (08) real_dis(\(x\), \(y\)): the actual distance between device \(x\) and device \(y\); (09) prefilter(\(a\)): a method to discard unreasoned parts from data \(a\); Collecting phase: (10) for all combinations of anchor\(i_{i}\) and tagdo (11) initialize(anchor\(i_{1}\)); (12) initialize(tag); (13) for \(1\leq x\leq n\)do (14) DATA \(\leftarrow\) DATA \(\cup\) (sys_dis(anchor\(i_{1}\), tag)); (15) separate DATA into TRAINING and TESTING; Learning phase: (16) TRAINING \(\leftarrow\) prefilter(TRAINING); (17) train the model via TRAINING; Evaluating phase: (18) TESTING \(\leftarrow\) prefilter(TESTING); (19) evaluate the trained model via TESTING;
```  
**Algorithm 1** The improved algorithm for \(tag\) in a specific scenario. In the collecting phase, for all combinations of anchor \(anchori_{i}\) and the tag tag, we initialized the locations of \(anchor_{i}\) and tag (lines 10-12). Then, the information about the distance between the \(anchor_{i}\) and the \(tag\) provided by the UWB system and the real distance between the \(anchor_{i}\) and the tag are stored, i.e., \(\textbf{sys\_dis}(x,y)\) and \(\textbf{real\_dis}(x,y)\). This means that we obtained the actual distance and its inaccurate version provided by the UWB system as the training/testing data. Here, for the reliability of entire procedure, each combination was gathered \(n\) times (lines 13-14). Particularly, if there are \(\ell\) anchors and \(m\) combinations in a scenario, we collected \(\ell\times m\times n\) pairs of distance information as the training/testing data. Finally, data set \(DATA\) was separated into data set \(TRAINING\) and \(TESTING\) for the training and testing procedure (line 15). Next, we applied the concept of ensemble learning to set the thresholds independently and automatically to remove the extreme unreasoned data. Namely, \(TRAINING\) was filtered via an independent machine learning model first (line 16); then, we trained the refinement model via \(TRAINING\) (line 17). Note that the former model was unsupervised learning, since we have no idea about the thresholds of unreasoned data in advance, and the latter one for the purpose of refinement was supervised learning.