# NetSel-RF: A Model for Network Selection Based on Multi-Criteria and Supervised Learning
## 3 NetSel-RF Model
### Data Interpretation  
This phase builds an initial dataset with the appropriate features (i.e., parameters) to select the best available AP in a WiFi network. This phase includes the following tasks: first, an experimental scenario is designed and implemented; second, the relevant parameters/attributes to optimize the AP selection are chosen; third, the target variable is defined; fourth, the dataset is filled by capturing the attributes when the devices are moving and have at least two APs in range. Figure 2 shows the scenario built to obtain the initial dataset. This scenario includes four APs (described in Table 2), together with 24 mobile devices (_devs_). In particular, _dev1_, _dev2_, _dev3_, and _dev4_ perform a circular movement, and _dev5_, _dev6_, _dev7_, and _dev8_, carry out a linear movement. In turn, _dev9_ to _dev24_ perform a random movement. All devices perform the movement in 500 steps at a speed of 1 m/s and communicate at 2462 GHz. The scenario described was deployed by using the Mininet-WiFi [30] emulator in a virtual machine with Ubuntu Server 16.04. \begin{table}
\begin{tabular}{c c c c c} \hline \hline
**AP** & **SSID** & **Position [x,y,z] (m)** & **Range (m)** & **Channel** & **Total\_Users\_Support** \\ \hline
**ap1** & ap1-ssid & [50.0,150.0,0] & 45 & 1 & 15 \\
**ap2** & ap2-ssid & [90.0,180.0,0] & 50 & 7 & 18 \\
**ap3** & ap3-ssid & [130.0,150.0,0] & 45 & 11 & 15 \\
**ap4** & ap4-ssid & [90.0,90.0,0] & 57 & 11 & 20 \\ \hline \hline \end{tabular}
\end{table} 
Table 2: Access Point (AP) setup. Figure 2: Dataset scenario set-up. In the second step, we investigated the most used parameters in the literature related to the network selection phase. Table 3 briefly describes the parameters chosen for our initial dataset and classifies them according to their type: network, device, application, and user. In the third task, we defined AP_target as the dependent parameter/attribute (also known as output variable) to predict; this variable is categorical because it allows the prediction of the AP to which the mobile device should connect taking into account the user preference. In the fourth task, we proceeded to fill up the dataset. It is relevant to mention that we gathered the data when mobile devices (_devs_) moved and had at least two candidate APs in-range. The result of this phase is the initial dataset with five input parameters/attributes and one output parameter. The input parameters are as follows: AP available, RSSI, AP occupation, battery consumption of devices, distance from the device to the AP, and power consumption of applications. The output parameter (dependent variable) is the selected AP. To create this dataset, we leveraged the global view of the network offered by Mininet-WiFi. This emulator provides a global view as it follows the Software-Defined Network concept [33]. With Mininet-WiFi, it is possible to collect parameters from end-devices and APs [34]. Listing 1 shows excerpts of code to illustrate how the aforementioned parameters were collected. ```
//APavailable dev.params[\"apsInRange\"] dev.params[\"associatedTo\"] //RSSI ap_dis=dev.get_distance_to(ap_name) dev_rssi=dev.get_rssi(ap_name,0,ap_dis) //APoccupation ap_num_dev=ap_name.params[\"associatedStations\"] ap_max_dis.params['maxDis'] ap_ocu=((ap_num_dev*100. )/ap_max_dis) //batteryconsumptionofdevices dev_app=dev.params.get(\"app\") ap_dis=dev.get_distance_to(ap_name) bat_temp=constant_battery_discharge*ap_dis*dev_app //distancefromthedevicetotheAP dev.get_distance_to(ap_temp) //powerconsumptionofapplications dev.params[\"pow\"]
```  
Listing 1: Parameter collection.