## 5 Feasibility Study Through System Simulations
### Simulation Process
#### 5.6.3 Execution Flow of the Model Training Function  
For simplicity, the block diagram of the main execution flow of the simulator, depicted in Figure 14, does not show the individual calls to each pattern-matching method. It is assumed that step 8 in Figure 14 is executed independently for each pattern-matching method, calling the function \(FModelTraining()\) with the same input datasets for each method, as mentioned in the previous subsection. In our implementation, we created a tailored function \(FModelTraining()\) for each pattern-matching method. As mentioned, for simplicity, we present the simulation flow description at the general level by describing a function \(FModelTraining()\) that is common to all of the pattern-matching methods and thus suitable for use with any of the pattern-matching methods considered. A block diagram depicting the flow of the \(FModelTraining()\) function is shown in Figure 15. Each block implements the following steps:  
* In step 1, the four datasets FTT, FTV, MTV, and MTT are formatted into the input and output formats required by the NN structure implementing the selected pattern-matching method. These input and output formats are indicated in Table 6 and depicted in Figure 10, explained for each pattern-matching method in Section 4.4, and detailed in relation to the NN structures used in each pattern-matching method in Section 5.8. In the case of the pattern-matching method 4-MultFingIn-ClassOut, the output tile-classes are vectorized (e.g., using one-hot encoding). * In step 2, the mean and standard deviation of the fingerprints and reference positions are calculated from the FTT training dataset. Then, these are used in step 3 to normalize all the datasets, shifting the values of the RSSs and positions to the zero mean, and scaling these by the inverse of the respective standard deviation. Actually, there is no need to normalize the reference positions for the fourth pattern-matching method (4-MultFingIn-ClassOut). This method is based on classification of the tile-classes. Then, for this method, the tiles are vectorized into one-hot-encoded classes. * In step 4, the NN structure for the selected pattern-matching method is defined and introduced in the simulation process. However, the selection of the actual NN structure is decided beforehand. This is indicated by the label _Mechanism 1_, and shown inside a box with a dashed line, to indicate that the selection of the actual NN structure is not part of the simulation process. The selection of the NN structure is discussed in Section 5.7.1. * In step 5, the random initial weights are set. This step is part of an iterative process (introduced in Section 5.5) which has the purpose of generalizing the model for moving tiles. In our simulations, the weights for each layer in the NN are set to different random initial values by calling a function provided for this purpose, taking as input a seed value. In Keras, this is achieved by retrieving the layer weight initializers, \(kernel\_initializer\) and \(bias\_initializer\), and setting new weights through the method \(set\_weights()\) for every layer in the NN model with the retrieved initializers. In each iteration of the loop for the initial random weights, all of the pseudo-random number generators are initialized with a new and unique seed (which, for convenience, in our implementation is the iteration number plus a preselected seed offset). Step 5 is the beginning of a loop iterating among the random initial weights for \(N_{I}\) iterations, ending at step 11. * In step 6, the training of the NN model takes place using as training data the FTT dataset of fixed tiles. The first three pattern-matching methods considered are based on regression of the position coordinates. In these methods, the target training position varies with the method. For these methods, the reference center position coordinates of the sub-tiles, returned in the data structure \(vSubTilesCenterPosit\) by the function \(FFixedTiles()\) (Pseudocode 2), are used to set the target training position.