# The Use of Transfer Learning for Activity Recognition in Instances of Heterogeneous Sensing
## 3 Transfer Learning Framework for Recognising Activities of Daily Living across Sensing Technology
### Active Learning Phase  
This Section further detail on the functionality of the different components corresponding to the AL phase along with their respective dependencies and functions. Formalisation and Pseudo-Code  
As previously mentioned, the AL phase of TL-FmRADLs will activate under two conditions, when (i) there is no legacy AR model to refer to and (ii) when none of the available AR models reaches the threshold \(Q\) assigned at the function \(getValidationUponRuleSchema(unseenActRate)\). In these cases, the \(MB\) will interactively request (6) the oracle to annotate unlabelled data \(X\) under function \(requestAnnotationFromOracle(X)\) in Algorithm 6; so that the \(MB\) can perform respective prediction of activities (7). ```
1:\(X=\) A pool of unlabelled instances. 2:\([data,label]=\) A tuple of unlabelled instance and label give by the oracle. 3:for\((k=0;k<=len(X),k++)\)do
4: Display interface for the oracle to capture a label for the unlabelled instance \(X_{k}\). 5: Assign to \([data,label]\) the oracle's annotation. 6: return \([data,label]\)
7:ends for
```  
**Algorithm 6** Request for annotating unlabelled data to the oracle. As the classification performance of data-driven machine-learning models intrinsically depends on the quantity and quality of the labelled data, TL-FmRADLs does not restrict to a particular amount of data to initiate the AL phase. However, one could adapt TL-FmRADLs to embrace heuristics, for example, labelled data could consist of a factor relative to the number of classes, or consist of a factor relative to the number of input features [39]. On the contrary, when there is a pool of AR models available (\(D_{S[\cdot]}\)), the AL phase of TL-FmRADLs will aim to leverage the AR models over complementary AR models (\(D^{\prime}_{Sk}\)), where \(D^{\prime}_{S}\in D_{S[\cdot]}\) and \(D^{\prime}_{S}\
eq D_{Sk}\). Note that \(D^{\prime}_{Sk}\) will consist of a complementary AR model to the extent of sensing data in technology given by the function \(FD.getComplementaryModel(\cdot)\) (8). Having at least one complementary AR model within \(D_{S[\cdot]}\), the feedback selector (\(FS\)) will sample the unlabelled data over function \(FS.getPortionData(\cdot)\) and test all \(D^{\prime}_{S}\) by utilising the function \(FS.setTrainingModel(\cdot)\) to find the most suitable AR model to become a teacher. The function \(FS.getValidationUponRuleSchema(\cdot)\) will determine the best \(D^{\prime}_{S}\) by identifying the \(D_{Sk}\) with the highest ratio of activities identified, as presented in Algorithm 7, where \(X\): unlabelled dataset, \(D_{S[\cdot]}\): current model to be enforced, \(D^{\prime}_{S}\): complementary model, \(output\): n-dimensional tensor consisting of a tandem of features and predicted labels for \(X\) and \(D_{Sk}\): most informative learner model. The remaining of this Section presents some of the main dependencies contributing to structure Algorithm 7, namely, (i) _getComplementaryModel_ and (ii) _getPortionData_. ```
1:\([data,label]=\) A tuple of unlabelled instance and label give by the oracle. 2:for\((k=0;k<=len(X),k++)\)do
3: Display interface for the oracle to capture a label for the unlabelled instance \(X_{k}\). 4: Assign to \([data,label]\) the oracle's annotation. 5: return \([data,label]\)
6:endfor
```  
**Algorithm 7** Request for annotating unlabelled data to the oracle. Algorithm 8 shows \(FD.getComplementaryModel(\cdot)\), which consists of a search to retrieve a list of AR models built over different sensing technology than \(D_{S[\cdot]}\) but aims to classify the same task. _(ii) getPortionData_. Function \(FS.getPortionData(\cdot)\) consists of taking a random sample of data to test. As described in Algorithm 9, this is a simple procedure that makes use of structured data that is utilised to simplify this operation. Given a list of data (\(portion[\cdot]\)), this function takes a sample from \(X\) given a ratio \(O\) define at _a-priori_.