## 3 Mobility Support Scheme Based on Decision Tree-Based Pattern Classification and Regression
### Regression-Based Mobility Pattern Prediction  
In this section, we propose a scheme for predicting mobility patterns based on the classes determined by the decision tree. For relatively simple linear trajectories (classified as \"Linear\"), a simple approach is sufficient for prediction and does not require a complex scheme. Therefore, the focus is on explaining polynomial regression for non-linear mobility patterns. The trajectory corresponding to the Figure 2b could be observed as shown in Figure 4, where each coordinate could be matched with its respective device identification number. Each field device senses a device or environment according to a predetermined role and periodically transmits this data to the gateway. In the above training set, input X is the unit time when the mobile device transmits data through the neighbor device, and output Y is a label (device identification number) for the neighbor device that has received the data from the mobile device. Figure 4: An example of a simple topology with a mobile device and converted training data sets. Figure 3: An example of learned decision tree. Figure 5 is a schematic diagram of the training data for input X and output Y, which is trained using polynomial regression based on Gaussian basis functions. The prediction function to which \(m\) Gaussian basis functions are applied is expressed as Equation (1) below. \[y(x,\mathbf{w})=w_{0}\phi_{0}(x)+w_{1}\phi_{1}(x)+w_{2}\phi_{2}(x)+\ldots+w_{n} \phi_{n}(x) \tag{1}\]  
This prediction function should be optimized to yield a parameter \(w\) with the optimal mean square error. For this purpose, we first need to determine the number of basis functions \(m\). To determine the number of basis functions \(m\), we exploit the K-fold cross-validation scheme by increasing \(m\). K-fold cross-validation splits the training set into \(K\) parts and exploits one of them as the test set and the rest as the training set. We use the training set to optimize the parameters of the model and calculate the mean squared error on the test set, repeating this process for each number of basis functions \(m\) to evaluate the mean square error and determine the optimal number of basis functions. Figure 6 presents the graph of the fitting results for the number of basis functions, with \(m\) being 5, 7, 9, and 11, respectively, as determined by performing K-fold cross-validation. As the number of basis functions increases, the complexity of the function increases, and it might be observed that the prediction model fits closer to the training set. Accordingly, it might be confirmed that the error between the training and test sets gradually decreases. However, when the number of basis functions reaches a certain level, it can be seen that the error is no longer reduced. Therefore, we utilize nine basis functions as a heuristic approach based on a given training set. The location of the mobile device at each unit of time through the predictive model is as follows. Figure 7 shows the predicted locations of the mobile devices identified based on the prediction model trained on the data in Figure 4. By referring to Figures 4 and 7, it could be explained that at cycle 0, the mobile device transmitted data through either device 0 or 1. The prediction result of 0.97 indicates that data were mostly sent through device  
Figure 5: A schematized training data sets. Figure 6: The fitting results according to number of basis functions \(m\). 1. Similarly, on cycle 10, the mobile device transmitted data through either device 1 or 2. The prediction result of 1.86 indicates that data were mostly sent through device 2. To determine the device to perform the communication, we rounded the training results to identify the device. As a result, comparing the actual movements of the mobile devices with the predicted model indicates an accuracy of about 86%, reflecting a relatively high level of prediction for the actual movements of the mobile devices.