# The Use of Transfer Learning for Activity Recognition in Instances of Heterogeneous Sensing
## 6 Machine-Learning Modelling  
Two critical characteristics of TL-FmADLs are the capability to transfer knowledge across sensing technology, and the improvement of AR models derived from AL techniques. To this extent, we built three AR models, each trained under one sensing technology, i.e., AR inertial model, AR images model, and AR audio model.  
\begin{table}
\begin{tabular}{c c c c} \hline \hline
**Subject** & **Performed Runs** & **Excluded Runs** & **Total** \\ \hline S01 & 8 & 2 & 6 \\ S02 & 8 & 0 & 8 \\ S03 & 4 & 0 & 4 \\ S04 & 7 & 0 & 7 \\ S05 & 6 & 1 & 5 \\ S06 & 5 & 0 & 5 \\ S07 & 6 & 0 & 6 \\ S08 & 6 & 1 & 5 \\ S09 & 6 & 0 & 6 \\ S10 & 6 & 1 & 5 \\ \hline Total & 62 & 5 & 57 \\ \hline \hline \end{tabular}
\end{table}
Table 3: Relationship for the runs performed by each subject.  
Note that, for the three models, cross-entropy loss function was used to measure the error between the prediction and the true values. Adam [59], which is a stochastic optimisation algorithm, was selected as the optimiser, as it has shown to be effective in resolving classification problems [60; 61; 62; 63].  
_(i) AR Inertial model._  
Consisting of the sensing devices worn by the subject and embedded into smart-items, the feature-space embodies the root mean square (RMS) and the mean of each of the three axes from both acceleration and gyroscope data.  
This machine-learning model conceived a one-dimensional DNN with a learning rate of 0.001. Its first layer received a tensor of six features per smart-item; hence 60 features in total. It then structured three hidden layers assembled over the rectified linear unit (ReLU) and an output layer consisting of the softmax activation function (as it proved effective in the results in training DNN models [21; 64; 65]).  
_(ii) AR Images model._  
Consisting of the images captured by the TVS device, the feature-space embodies the thermal images in grey-scale rather than RGB images to reduce the computational cost [66], where features were extracted over a fully connected CNN for 32 \(\times\) 32 pixel images.  
This machine-learning model conceived a three-dimensional CNN with a learning rate of 0.0001. Its first layer received a tensor of 32 \(\times\) 32 \(\times\) 3 (width, height, depth). It then structured three hidden layers, assembled over max-pool and normalised convolutional layer, followed by three layers under ReLU activation function.  
_(iii) AR Audio model._  
Consisting of the acoustic data captured by the matrix voice ESP32, the feature-space embodies eight elements: energy entropy, short-time energy, spectral roll-off, spectral centroid, spectral flux, zero-crossing rate, relative spectral transform, and Mel-frequency spectral coefficients.  
This machine-learning model conceived a one-dimensional DNN with a learning rate of 0.001. Its first layer received a tensor of eight features. It then structured three hidden layers, assembled over the ReLU, and an output layer consisting of the softmax activation function. The DNN models were created utilising machine-learning libraries such as TensorFlow and Keras.  
It is important to highlight that AR systems are typically evaluated for their ability to generalise their AR models' capabilities after being trained. In this regard, a commonly investigated problem is the representation of AR models to generalise across subjects, which bring different challenges derived from the dependency on subjects' performance, i.e., population-based versus personal-based training [67]. Hence, in the interest of investigating the transfer learning capabilities across sensor, the AR models focused on personal-based training by evaluating the impact of TL-FmADLs per subject.  
The performance was evaluated under 10-fold cross-validation [68]. The initiation weight was randomly allocated and mini-batches with shuffling adopted as a strategy to counterbalance the problem of non-convexity [68].