Stratified Transfer Learning for Cross-domain Activity Recognition
Jindong Wang Yiqiang Chen Lisha Hu Xiaohui Peng Philip S. Yu
cs.CV cs.LG

	
	
	

	

Stratified Transfer Learning for

		Cross-domain Activity Recognition
    
		Jindong Wang12,
		Yiqiang Chen12,
		Lisha Hu3,
		Xiaohui Peng12,
		Philip S. Yu4
	
	1Beijing Key Laboratory of Mobile Computing and Pervasive Device
Institute of Computing Technology, Chinese Academy of Sciences, Beijing, China
	2University of Chinese Academy of Sciences, Beijing, China
	3Institute of Information Technology, Hebei University of Economics and Business, Shijiazhuang, China
	4Department of Computer Science, University of Illinois at Chicago, IL, USA
	Email:{wangjindong,yqchen,pengxiaohui}@ict.ac.cn, hulisha@heuet.edu.cn, psyu@uic.edu
    December 30, 2023
================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================







In activity recognition, it is often expensive and time-consuming to acquire sufficient activity labels. To solve this problem, transfer learning leverages the labeled samples from the source domain to annotate the target domain which has few or none labels. Existing approaches typically consider learning a global domain shift while ignoring the intra-affinity between classes, which will hinder the performance of the algorithms. In this paper, we propose a novel and general cross-domain learning framework that can exploit the intra-affinity of classes to perform intra-class knowledge transfer. The proposed framework, referred to as Stratified Transfer Learning (STL), can dramatically improve the classification accuracy for cross-domain activity recognition. Specifically, STL first obtains pseudo labels for the target domain via majority voting technique. Then, it performs intra-class knowledge transfer iteratively to transform both domains into the same subspaces. Finally, the labels of target domain are obtained via the second annotation. To evaluate the performance of STL, we conduct comprehensive experiments on three large public activity recognition datasets (i.e. OPPORTUNITY, PAMAP2, and UCI DSADS), which demonstrates that STL significantly outperforms other state-of-the-art methods w.r.t. classification accuracy (improvement of 7.68%). Furthermore, we extensively investigate the performance of STL across different degrees of similarities and activity levels between domains. And we also discuss the potential of STL in other pervasive computing applications to provide empirical experience for future research.






§ INTRODUCTION

Human activity recognition (HAR) is a hot research topic in pervasive computing. HAR has been widely applied to many applications such as indoor localization <cit.>, sleep state detection <cit.>, and smart home sensing <cit.>. The key to successful HAR is to build accurate and robust models using sufficient labeled activity data. Unfortunately, it is often expensive and time-consuming to obtain enough labeled data. In this case, it is necessary to perform cross-domain activity recognition (CDAR) by exploiting the labeled activity data from one auxiliary domain to annotate the unlabeled activities in another domain.

An intuitive example of CDAR is given in Fig. <ref>, which shows two accelerometer readings on the chest (C) and the leg (L) from one person. Such scenarios happen very often: If we only have the activity data and labels on C but labels on L are missing or wrongly labeled, we can certainly use the data from C to recognize the activity on L. Because the signals of C and L can be related according to the body structure. Then the challenge arises: It can be seen that the two sensor readings are under two totally different distributions from Fig. <ref>. Therefore, it is challenging to design algorithms to tackle CDAR problem. 



Several dimensionality reduction methods have been proposed to resolve CDAR, such as principal component analysis (PCA), locally linear embedding (LLE), and kernel principal component analysis (KPCA) <cit.>. Dimensionality reduction does not require domain knowledge, but it ignores the divergence between domains. To this end, transfer learning <cit.> has made considerable progress for cross-domain tasks by leveraging the labeled samples from other auxiliary domains. The key to transfer learning is to utilize the similarity between those different but related domains. Existing transfer learning approaches disentangled the cross-domain learning problems either by exploiting the correlations between features <cit.>, or transforming both the source and target domains into a new shared feature space  <cit.>. 

Those approaches tend to learn a global domain shift by projecting all samples in both domains into a single subspace. However, they fail to consider the intra-affinity within classes <cit.>. According to Fig. <ref>, learning the global domain shift (Fig. <ref>) can only learn a general hyperplane between classes, and this hyperplane is loose; while by exploiting intra-class affinity (Fig. <ref>), classes can further be clustered more tightly. Therefore, it is necessary to exploit the intra-affinity of classes to overcome the limitation of global domain shift.



According to <cit.>, the data samples from the same class should lay on the same subspace, even if they belong to different domains. By using this assumption, in this paper, we propose a novel and general Stratified Transfer Learning (STL) framework. STL can simultaneously transform the same classes of the source and target domains into the same subspaces. Compared to existing methods, STL exploits the intra-affinity of classes to perform intra-class knowledge transfer. Thus, the global domain shift can be alleviated. Concretely speaking, STL first obtains pseudo labels for the target domain via a majority voting technique. Then, it performs intra-class knowledge transfer to transform the source and target domain into the same subspaces. Finally, the labels of target domain are obtained through a second annotation step. Comprehensive experiments on three large public activity recognition datasets (i.e. OPPORTUNITY, PAMAP2, and UCI DSADS) demonstrate that STL outperforms other five state-of-the-art methods with a significant improvement of 7.68% w.r.t. classification accuracy.

Contributions. Our contributions are mainly three-fold:

1) We propose a novel and general cross-domain learning framework STL. Different from existing methods that only obtain a global domain shift, STL is capable of exploiting the intra-affinity of classes to perform intra-class knowledge transfer. STL is a general framework and can be tailored according to specific applications.

2) We conduct comprehensive experiments for cross-domain activity recognition on three public datasets (i.e. OPPORTUNITY, PAMAP2, and UCI DSADS) to evaluate STL. Experiments demonstrate the superiority of STL over other state-of-the-art methods w.r.t. classification accuracy.

3) We extensively investigate the performance of STL on different degrees of task similarity and different levels of activities. And we additionally explore the potential of STL in other pervasive computing applications, providing experience for future research.

The rest of this paper is organized as follows. In Section <ref>, we review the related work. Section <ref> introduces the proposed STL framework. In Section <ref> we present experimental evaluation and analysis of STL and other comparison methods. In Section <ref>, we discuss the potential of STL in other real applications. Finally, the conclusion and future work are presented in Section <ref>.



§ RELATED WORK


Our work is mainly related to activity recognition and transfer learning. In this section, we will discuss those two areas and their intersections.



 §.§ Activity Recognition

Human Activity recognition has been a popular research topic in pervasive computing <cit.> for its competence in learning profound high-level knowledge about human activity from raw sensor inputs. Several survey articles have elaborated the recent advance of activity recognition using conventional machine learning <cit.> and deep learning <cit.> approaches.

Conventional machine learning approaches have made tremendous progress on HAR by adopting machine learning algorithms such as similarity-based approach <cit.>, active learning <cit.>, crowdsourcing <cit.>, and other semi-supervised methods <cit.>. Those methods typically treat HAR as a standard time series classification problem. And they tend to solve it by subsequently performing preprocessing procedures, feature extraction, model building, and activity inference. However, they all assume that the training and test data are with the same distribution. As for CDAR where the training (source) and the test (target) data are from different feature distributions, those conventional methods are prune to under-fitting since their generalization ability will be undermined <cit.>.

Deep learning based HAR <cit.> achieves the state-of-the-art performance than conventional machine learning approaches. The reason is that deep learning is capable of automatically extracting high-level features from the raw sensor readings <cit.>. Therefore, the features are likely to be more domain-invariant and tend to perform better for cross-domain tasks. A recent work evaluated deep models for cross-domain HAR <cit.>, which provides some experience for future research on this area. There are stll many open problems for deep learning based CDAR. In this paper, we mainly focus on the traditional approaches.



 §.§ Transfer Learning

Transfer learning has been successfully applied in many applications such as Wi-Fi localization <cit.>, natural language processing <cit.>, and visual object recognition <cit.>. According to the literature survey <cit.>, transfer learning can be categorized into 3 types: instance-based, parameter-based, and feature-based methods. 

Instance-based methods perform knowledge transfer mainly through instance re-weighting techniques <cit.>. Parameter-based methods <cit.> first train a model using the labeled source domain, then perform clustering on the target domain. 

Our framework belongs to the feature based category, which brings the features of source and target domain into the same subspace where the data distributions can be the same. A fruitful line of work has been done in this area <cit.>. The proposed STL  differs from existing feature-based methods in the following aspects:

Exploit the correlations between features. <cit.> proposed structural correspondence learning (SCL) to generatively learn the relation of features. <cit.> applied a feature-level transfer model to learn the dependence between domains, then trained a domain-adapted classifier. Instead of modeling the relationship of domain features, STL transforms the domain data into a new subspace, which does not depend on the domain knowledge in modeling features.

Transform domains into new feature space. <cit.> proposed maximum mean discrepancy embedding (MMDE) to learn latent features in the reproducing kernel Hilbert space (RKHS). MMDE requires solving a semidefinite programming (SDP) problem, which is computationally prohibitive. <cit.> extended MMDE by Transfer Component Analysis (TCA), which learns a kernel in RKHS. <cit.> adopted a similar idea. <cit.> learns target predictive function with a low variance. <cit.> sampled the domain features by viewing the data in a Grassmann manifold to obtain subspaces. <cit.> exploited the low-dimensional structure to integrate the domains according to geodesic flow kernel (GFK). Long et al. proposed joint distribution adaptation (JDA) based on minimizing joint distribution between domains, while STL focuses on the marginal distribution. <cit.> proposed transfer kernel learning (TKL), which learned a domain-invariant kernel in RKHS. <cit.> studied the conditional transfer components between domains. Methods in those literature tend to learn some common representations in the new feature space, then a global domain shift can be achieved. However, the difference between individual classes is ignored.



 §.§ Transfer Learning based Activity Recognition

Some existing work also focused on transfer learning based HAR. A detailed survey is provided in <cit.>. Among existing work, Zhao et al. proposed a transfer learning method called TransEMDT <cit.> using decision trees, but it ignored the intra-class similarity within classes. <cit.> proposed the TransAct framework, which is a boosting-based method and ignores the feature transformation procedure. Thus it is not feasible in most activity cases. Feuz et al. <cit.> proposed a heterogeneous transfer learning method for HAR, but it only learns a global domain shift.

To circumvent the global domain shift, <cit.> clustered the data points in a low-dimensional space using sparse subspace clustering.  <cit.> identified a compact joint subspace for each class, then measured the distance between classes using principal angle. The main difference between STL and <cit.> is that STL learns pseudo labels using majority voting technique on both domains, instead of performing metric clustering on the target domain alone. Thus, STL can obtain more reliable candidates by taking advantage of both domains.



§ STRATIFIED TRANSFER LEARNING



In this section, we introduce the proposed Stratified Transfer Learning (STL) framework. First, we present the problem definition of CDAR and the main idea of STL. Then, each step of STL is presented in detail.



 §.§ Problem Definition



CDAR is a typical cross-domain learning problem, which often consists of a labeled source domain 𝒟_s = {(𝐱_i,y_i)}^n_s_i=1, and an unlabeled target domain 𝒟_t = {𝐱_j}^n_t_j=1. 𝒟_s and 𝒟_t have the same dimensionality and label spaces, i.e. 𝐱_i, 𝐱_j∈ℝ^d where d is the dimensionality, and 𝒴_s = 𝒴_t. In cross-domain learning, they follow different feature distributions. Concretely speaking, we use P and Q to denote the marginal and conditional distributions, respectively. Then, P(𝐱_s) ≠ P(𝐱_t), and Q(y_s | 𝐱_s) ≠ Q(y_t|𝐱_t). The goal of cross-domain learning is to obtain the labels 𝐲_t for the target domain 𝒟_t using the labeled source domain 𝒟_s. Specifically in CDAR, the goal is to use the labeled activity information in one domain to learn the labels for another domain.

STL can simultaneously transform the individual classes of the source and target domains into the same subspaces by exploiting the intra-affinity of classes. Compared to existing approaches which only learn a global domain shift, we adopt the assumption that data samples from the same class should lay on an intrinsic subspace <cit.>. Fig. <ref> illustrates the main idea of STL. There are mainly three steps. Initially, STL generates pseudo labels for the target domain through majority voting technique. Then, it performs intra-class knowledge transfer between domains. Finally, a second annotation step is performed on the newly transformed subspaces. 

Now we elaborate each step in detail.





 §.§ Majority Voting

As a preprocessing step of STL, this step generates pseudo labels for the target domain based on several classifiers trained on source domain. Those samples with pseudo labels are called candidates. To this end, majority voting technique is developed to exploit the knowledge from the crowd <cit.>. Specifically, STL makes use of some base classifiers learned on 𝒟_s to collaboratively learn the labels for 𝒟_t.

Let A_j (j = 1,2,⋯,n_2) denote the final result of majority voting on 𝐱_t_j, and f_t(j) denotes the prediction of the j-th sample by the t-th classifier f_t(·), we have

    A_j = majority({f_t(j), t)    if majority holds
    
    -1    otherwise,

where t ∈{1,2,⋯} denotes the index of classifier.

Majority voting technique generally ensembles all the classifiers learned in the source domain. The condition “majority holds” refers to any potential scheme that helps to generate a better solution such as simple voting and weighted voting. Specifically, A_i could be defined as a) if most classifiers have same results on a sample, we take its label, else we label it `-1'; b) same as a) with voting weights to classifiers; c) the stacking of some base classifiers (similar to the deep forest proposed by Zhou and Feng <cit.>). In theory, the classifiers can be of any type in our framework.

Using majority voting, STL can generate pseudo labels for the target domain. Label `-1' means that there is no majority consensus for that sample. The samples with this label are called residuals, and they will be annotated later. In the sequel, we will use 𝐗_can and 𝐗_res to denote the candidates and residuals, respectively. And 𝐲_can denotes the pseudo labels for the candidates.



 §.§ Intra-class Transfer

In this step, STL exploits the intra-affinity of classes to further transform each class the candidates and source domain into the same subspace. Initially, 𝒟_s and 𝐗_can are divided to C groups according to their (pseudo) labels, where C is the total number of classes. Then, feature transformation is performed within each class of both domains. Finally, the results of distinct subspaces are merged.

The key to successful knowledge transfer is to utilize the similarity between the source and the target domain. Hence, how to measure the similarity (or divergence) is critical. We adopt maximum mean discrepancy (MMD) <cit.> as the measurement. MMD is a nonparametric method to measure the divergence between two distinct distributions and it has been widely applied to many transfer learning methods <cit.>. The MMD distance between two domains can be formally computed as

    D(𝒟_s,𝒟_t)=
    1/n_s∑_𝐱_i ∈𝒟_s^ϕ(𝐱_i) - 1/n_t∑ _𝐱_j ∈𝒟_t^ϕ(𝐱_j)
    ^2_ℋ

where ℋ denotes reproducing kernel Hilbert space (RKHS). Here ϕ(·) denotes some feature map to map the original samples to RKHS. The reason we do not use the original data is that the features are often distorted in the original feature space, and it can be more efficient to perform knowledge transfer in RKHS <cit.>. 

The above Eq. <ref> derives a global domain shift for the source and target domain just similar to many existing methods <cit.>. In order to achieve intra-class transfer, we need to calculate the MMD distance between each class. Since the target domain has no labels, we use the pseudo labels from majority voting. For the candidates and the source domain, we present their intra-class MMD distance as

    D(𝒟_s,𝐗_can)
       =∑_c=1^C‖1/n^(c)_s∑_𝐱_i∈𝒟^(c)_sϕ(𝐱_i) - 1/n^(c)_t∑_𝐱_j∈𝐗^(c)_canϕ(𝐱_j) ‖ ^2_ℋ

where c ∈{1, 2, ⋯, C} denote the class label. 𝒟^(c)_s and 𝐗^(c)_can denote the samples belonging to class c in the source and candidates, respectively. n^(c)_s=|𝒟^(c)_s|, and n^(c)_t=|𝐗^(c)_can|.

Unfortunately, it is non-trivial to solve Eq. (<ref>) directly since the mapping function ϕ(·) is to be determined. Thus, we turn to some kernel methods. We define a kernel matrix 𝐊∈ℝ^(n_1+n_2)×(n_1+n_2), which can be constructed by the inner product of the mapping

    𝐊_ij=⟨ϕ(𝐱_i),ϕ(𝐱_j)⟩ = ϕ(𝐱_i)^⊤ϕ(𝐱_j)

where 𝐱_i and 𝐱_j are samples from either 𝒟_s or 𝐗_can.

We further introduce a feature transformation matrix 𝐖∈ℝ^(n_1+n_2)× m to transform the samples of both domains from the original space to the RKHS. Here m ≪ d denotes the dimension after feature transformation. Then, by applying kernel tricks, Eq. <ref> can be eventually formulated as the following trace optimization problem:

    min_𝐖     ∑_c=1^Ctr (𝐖^⊤𝐊𝐋_c 𝐊𝐖) + λtr(𝐖^⊤𝐖)
    s.t.     𝐖^⊤𝐊𝐇𝐊𝐖 = 𝐈


There are two terms in the objective function of Eq. (<ref>). The first term (∑_c=1^Ctr (𝐖^⊤𝐊𝐋_c 𝐊𝐖)) denotes the MMD distance of each class between source and target domain, and the second one (λtr(𝐖^⊤𝐖)) denotes the regularization term to ensure the problem is well-defined with λ the trade-off parameter. The constraint in Eq. <ref> is used to guarantee that the transformed data (𝐖^⊤𝐊) will still preserve some structure property of the original data. 𝐈_n_1+n_2 is the identical matrix, and 𝐇 = 𝐈_n_1 + n_2 - 1/(n_1 + n_2)11^⊤ is the centering matrix. For notational brevity, we will drop the subscript for 𝐈_n_1+n_2 in the sequel. 𝐋_c is the intra-class MMD matrix, which can be constructed as:

    (𝐋_c)_ij=1/(n^(c)_1)^2   𝐱_i,𝐱_j ∈𝒟^(c)_s
    1/(n^(c)_2)^2   𝐱_i,𝐱_j ∈𝐗^(c)_can
     
    -1/n^(c)_1 n^(c)_2   𝐱_i ∈𝒟^(c)_s, 𝐱_j ∈𝐗^(c)_can
    𝐱_i ∈𝐗^(c)_can, 𝐱_j ∈𝒟^(c)_s
    
    
    0    otherwise


Learning algorithm: Acquiring the solution of Eq. <ref> is non-trivial. To this end, we adopt Lagrange method. We denote Φ the Lagrange multiplier, then the Lagrange function can be derived as

    L =     tr(𝐖^⊤𝐊∑_c=1^C𝐋_c 𝐊^⊤𝐖) + λtr(𝐖^⊤𝐖)
        + tr((𝐈-𝐖^⊤𝐊𝐇𝐊^⊤𝐖)Φ)


Setting the derivative ∂ L/∂𝐖=0, Eq. <ref> can be finally formalized as an generalized eigen-decomposition problem

    (𝐊∑_c=1^C𝐋_c 𝐊^⊤ + λ𝐈) 𝐖
    =𝐊𝐇𝐊^⊤𝐖Φ


Solving Eq. <ref> refers to solve this generalized eigen-decomposition problem and take the m smallest eigenvectors to construct 𝐖. 𝐖 can transform both domains into the same subspace with minimum domain distance while preserving their properties. Since the knowledge transfer pertains to each class, we call this step intra-class transfer, and that is where the name stratified originates from. After this step, the source and target domains belonging to the same class are simultaneously transformed into the same subspaces. 



 §.§ Second annotation

The objective of this step is to annotate the residual part using the transformed source domain and candidates. The majority voting provides pseudo labels (𝐲_can) for the candidates, which can be transformed into the same subspaces with the target domain after intra-class transfer. Under this circumstance, it is easy to get more reliable predictions (𝐲̂_can) of the candidates. Specifically, we train a standard classifier using {[𝐖^⊤𝐊]_1:n_1,:,𝐲_s} and apply prediction on [𝐖^⊤𝐊]_n_1+1:n_2,:. Finally, the labels of residuals can be obtained by training classifier on instances {𝐗_can,ŷ_can}.

Since this step requires annotating the candidates again with more concrete labels, we call it second annotation. The labels of candidates can be correspondingly close to the ground truth by annotating twice since the domains are now in the same subspace after intra-class transfer.



 §.§ Iterative refinement


It should be noted that STL could achieve a better prediction if we use the result of second annotation as the initial state and run intra-class transfer iteratively. This EM-like algorithm is empirically effective and will be validated in the following experiments. Additionally, we only use majority voting in the first round of the iteration, then the proposed STL could iteratively refine the labels for the target domain by only using its previous results.

The overall process of STL is described in Algorithm <ref>. 

Remark: STL is a general framework for transfer learning and it can be implemented in different ways according to the specific applications. We only provide one feasible implementation of STL in this section. Meanwhile, each step of STL can be tailored according to certain applications: 1) majority voting could have different classifiers and voting techniques; 2) intra-class transfer could use existing transfer learning approaches such as GFK <cit.> and TransACT <cit.>; 3) second annotation could use different classifiers. Therefore, by considering the characteristics of certain applications, STL can be more effective and efficient in solving these problems.





§ EXPERIMENTAL EVALUATION


In this section, we evaluate the performance of STL via extensive experiments on cross-domain activity recognition.





 §.§ Cross-domain activity recognition

Cross-domain activity recognition (CDAR) aims at labeling the activity of one domain using the labeled data from another related domain. There are several types of CDAR: cross-person, cross-device, cross-environment activity recognition, and so on. In our experiments, we choose cross-position activity recognition. Specifically, it refers to the situation where the activity labels of some body parts are missing, so it is necessary and feasible to leverage the labeled data from other similar body parts to get the labels of those body parts. 

Why cross-position activity recognition: We need to extensively investigate the performance of transfer learning at different degrees of similarities between the source and target domain. In cross-position tasks, there are different degrees of similarities, since body parts are different at certain degrees. For instance, there is more similarity between both arms than between arm and torso. Compared to other types of CDAR such as cross-person or cross-device, cross-position tasks can provide more detailed information about domain similarities, thus more experience about activity transfer can be revealed.

Why knowledge can be transferred between body parts: First of all, different body parts tend to share similar structure and functions. Then, the activity patterns of different body parts are often related. Thus, annotating the activity becomes a cross-domain learning problem because the data distribution is different on body parts.



 §.§ Datasets and Preprocessing

Three large public datasets are adopted in our experiments. TABLE <ref> provides a brief introduction to those three datasets. In the following, we briefly introduce those datasets, and more information can be found in their original papers. OPPORTUNITY dataset (OPP) <cit.> is composed of 4 subjects executing different levels of activities with sensors tied to more than 5 body parts. PAMAP2 dataset (PAMAP2) <cit.> is collected by 9 subjects performing 18 activities with sensors on 3 body parts. UCI daily and sports dataset (DSADS) <cit.> consists of 19 activities collected from 8 subjects wearing body-worn sensors on 5 body parts. Accelerometer, gyroscope, and magnetometer are all used in three datasets.

Fig. <ref> illustrates the positions we investigated in three datasets. In our experiments, we use the data from all three sensors in each body part since most information can be retained in this way. For one sensor, we combine the data from 3 axes together using a=√(x^2+y^2+z^2). Then, we exploit the sliding window technique to extract features (window length is 5s). The feature extraction procedure is mainly executed according to existing work <cit.>. In total, 27 features from both time and frequency domains are extracted for a single sensor (see TABLE <ref>). Since there are three sensors (i.e. accelerometer, gyroscope, and magnetometer) on one body part, we extracted 81 features from one position.



In order to investigate more detailed information during activity knowledge transfer, we perform CDAR in the following three scenarios according to the different similarities between body parts. Those three scenarios represent three different degrees of similarities between domains. In the sequel, we use the notation A → B to denote labeling the activity of domain B using the labeled domain A.


	
  * a) similar body parts of the same person, which refers to highly similar body parts such as left and right arms on the same person. Specifically, we extracted the data from OPP and DSADS (PAMAP2 is not included since there are no similar parts), and constructed 8 tasks: RA → LA, RL → LL, RUA → LUA, RLA → LLA, and vice versa.
	
  * b) different body parts of the same person, which refers to different body parts like torso and arm of the same person. Specifically, we constructed 8 tasks from three datasets: RA → T, H → C, RLA → T, RUA → T, and vice versa.
	
  * c) similar body parts of different person, which refers to activity recognition on same body parts across different datasets. Specifically, we constructed 6 tasks for T → T across three datasets [In this paper, for brevity, we use “T” to denote the Torso / Back / Chest in three datasets, respectively.].


In total, we constructed 22 tasks. Note that there are different activities in three datasets. For scenario a) and b), we simply use all the classes in each dataset; for scenario c) which is cross-dataset, we extract 4 common classes for each dataset (i.e. Walking, Sitting, Lying, and Standing). In addition, we did not include the scenario `different body parts of different person' since 1) all the methods perform poorly in that scenario, and 2) that scenario does not have reasonable feasibility in real applications.









 §.§ Comparison Methods and Implementation Details

We adopt five state-of-the-art comparison methods:

	
  * PCA: Principal component analysis <cit.>.
	
  * KPCA: Kernel principal component analysis <cit.>.
	
  * TCA: Transfer component analysis <cit.>.
	
  * GFK: Geodesic flow kernel <cit.>.
	
  * TKL: Transfer kernel learning <cit.>.


PCA and KPCA are classic dimensionality reduction methods, while TCA, GFK, and TKL are representative transfer learning approaches. The codes of PCA and KPCA are provided in Matlab. The codes of TCA, GFK, and TKL can be obtained online [<https://tinyurl.com/y79j6twy>]. The constructed datasets and STL code are released online [<https://tinyurl.com/y7en6owt>].

We construct the tasks according to each scenario and use the labels for target domain only for testing. Then we perform CDAR using STL and all comparison methods. Other than TKL, all other methods require dimensionality reduction. therefore, they were tested using the same dimension. After that, a classifier with the same parameter is learned using the source domain and then the target domain can be labeled. To be more specific, we use the random forest classifier (#Tree=30) as the final classifier for all the 6 methods. For majority voting in STL, we simply use SVM (C=100), kNN (k=3), and random forest (#Tree=30) as the base classifiers. Other parameters are searched to achieve their optimal performance. The #iteration is set to be T=10 for STL. It is noticeable that we randomly shuffle the experimental data for 5 times in order to gain robust results.

Classification accuracy on the target domain is adopted as the evaluation metric, which is widely used in existing transfer learning methods <cit.>

    Accuracy = |𝐱: 𝐱∈𝒟_t ∧ŷ(𝐱)=y(𝐱)|/𝐱:𝐱∈𝒟_t

where y(𝐱) and ŷ(𝐱) are the truth and predicted labels, respectively.



 §.§ Classification Accuracy of STL



We run STL and other methods on all CDAR tasks and report the classification accuracy in TABLE <ref>. For brevity, we only report the results of A → B  since its result is close to B → A. It is obvious that STL significantly outperforms other methods in most cases (with a remarkable improvement of 7.68% over the best baseline GFK). Compared to traditional dimensionality reduction methods (PCA and KPCA), STL improves the accuracy by 10%∼ 20%, which implies that STL is better than typical dimensionality reduction methods. Compared to transfer learning methods (TCA, GFK, and TKL), STL still shows an improvement of 5%∼ 15%. Therefore, STL is more effective than all the comparison methods in most cases.

The performance of TKL is the worst, because of the instability of the transfer kernel. TCA only learns a global domain shift, thus the similarity within classes is not fully exploited. The performance of GFK is second to STL, even if GFK also learns a global domain shift. Because the geodesic distance in high-dimensional space is capable of preserving the intra properties of domains.

The differences between STL and GFK are: 1) STL outperforms GFK in most cases with significant improvement; 2) STL strongly outperforms GFK in less similar scenarios (scenarios a) and b)), indicating that STL is more robust in recognizing different levels of activities. For STL, it performs intra-class knowledge transfer after generating pseudo labels for candidates. Thus, better performance can be achieved by exploiting the intra-affinity of classes.





 §.§ Performance on Different Degrees of Similarities


We explore the performance of the transfer learning methods under different degrees of similarities between the source and target domain. The average classification accuracy of each method is shown in Fig. <ref>. For all the methods, the accuracy drops as the domain similarity becomes less. Additionally, the performance of STL is the best in all scenarios.

More elaborate observations can be given combining TABLE <ref> and Fig. <ref>. In different scenarios, the change of classification accuracy of each method follows the same tendency. Specifically, the performance of all the methods is the best between similar body parts for the same person (e.g. RA → LA). The performance becomes worse for different body parts (e.g. RA → T). This is because Right Arm (RA) is more similar to Left Arm (LA) than to Torso (T). For a different person, all methods produce the worst results because different people have exactly different body structure and moving patterns (e.g. T → T across datasets).

At the same degree of similarity, the results are also different. For example, the performance of RUA → T is better than RLA → T in the same dataset. Because there is more similarity between Right Upper Arm (RUA) and Torso (T) than between Right Lower Arm (RLA) and Torso (T). Other positions also share the similar discovery.

All the experimental results indicate that the similarity between the source and target domain is important for cross-domain learning. It is critical to find the right auxiliary domain to perform successful knowledge transfer. In our CDAR experiments, the body structure and moving patterns contribute to the similarity. In real life, other factors such as age and hobby also help define the similarity of activities. For other cross-domain tasks (image classification etc.), finding the relevant domain is also important. For example, the most similar image set for a dog is probably a cat, since those two kinds of animals have similar body structures, moving patterns, and living environments.



 §.§ Performance on Different Levels of Activities


Different levels of activities imply the different depths of activity granularities. In this section, we extensively investigate the performance of our proposed STL on CDAR tasks at different activity levels. By taking advantage of the diverse activity classes in OPP dataset <cit.>, we analyze the transfer learning performance on low-level (OPP-LL), middle-level (OPP-ML), and high-level (OPP-HL) activities. The results are presented in Fig. <ref>. It indicates the best performance is achieved at middle-level activities, while it suffers from low-level and even worse at high-level activities.

Low-level activities such as Walking and middle-level activities such as Closing are mostly contributed by the atomic movements of body parts and they are likely to achieve better transfer results than the high-levels. On the other hand, high-level activities such as Coffee Time not only involve basic body movements, but also contain contextual information like ambient or objects, which is difficult to capture only by the body parts. Since the bridge of successful cross-position transfer learning is the similarity of body parts, it is not ideal to achieve good transfer performance by only using body parts. The reason why results on OPP-ML are better than OPP-LL is that activities of OPP-ML are more fine-grained than OPP-LL, making it more capable of capturing the similarities between the body parts.





 §.§ Effectiveness verification of STL

In this section, we verify the effectiveness of STL in several aspects. The core idea of STL is intra-class transfer, where the pseudo labels of the candidates are acting as the evidence of transfer learning. It is intuitive to ask the following three questions. Firstly, Can the confidence of the pseudo labels have an influence on the algorithm? It seems that STL will not achieve good performance if there is not enough reliable candidates available. Secondly, Can the choice of majority voting classifiers affect the framework? If we use different classifiers, the performance is likely to vary. Thirdly, Can intra-class transfer be implemented in parallel? Since in real applications, there are often several classes, which would require a large amount of training time if not in parallel. In this part, we answer those questions through the following experiments. 

1) The confidence of the candidates: We control the percentage of the candidates from 10% to 100% in every trial and make the rest belong to the residual part. Then we test the performance of STL. We test on the task LA → RA on DSADS and compare with other 2 methods (PCA and TCA). The result is shown in Fig. <ref>. For simplicity, we only compare STL with PCA and TCA, since they are both classic dimensionality reduction methods. From the results, we can observe that the performance of STL is increasing along with the increment of candidates percentage. More importantly, STL outperforms the other two methods with less than 40% of candidates. It reveals that STL does not largely rely on the confidence of the candidates and can achieve good performance even with fewer candidates.

2) Majority voting classifiers and iteration: To test the effectiveness of majority voting classifiers, we choose 1 nearest neighbor (1NN) as the base classifier of majority voting. Then we run STL iteratively. The results are shown in Fig. <ref>, where `1NN-STL' and `STL' denotes the result of STL using 1NN and random forest as the base majority voting classifier, respectively. From those results, we can observe: 1) STL can iteratively improve the classification accuracy even with some weak majority voting classifier. 1NN-STL achieves slightly worse than STL, indicating that STL is rather robust to the base classifiers. Since more powerful classifiers would lead to better performance, we strongly suggest using more reliable classifiers for majority voting in real problems. 2) STL can reach a quick convergence within fewer than 10 iterations. This indicates that STL can be efficiently trained.

3) Potential of parallel deployment: STL has another significant advantage: it can easily be implemented in parallel, which is rather important in real applications. Two steps of STL intuitively have that excellence: 1) majority voting involves more than one classifier, where each classifier can be trained and used individually; 2) the intra-class transfer can be performed within each class separately. Those two properties demonstrate that STL could be more powerful and efficient if deployed in parallel in real applications. We will continue to explore that advantage in the future.



 §.§ Parameter Sensitivity


STL involves two parameters: the dimension m, and trade-off parameter λ. In this experiment, we empirically evaluate the sensitivity of m. The evaluation of λ is omitted due to page limit and our experiments have verified its robustness.

We set m ∈{10, 20, 30, 40} and test the performance of STL and other dimensionality reduction methods. As shown in Fig. <ref>, STL achieves the best accuracy under different dimensions. Meanwhile, the accuracy of STL almost does not change with the decrement of m. The results reveal that STL is much more effective and robust than other methods under different dimensions. Therefore, STL can be easily applied to many cross-domain tasks which require robust performance w.r.t. different dimensions.



§ DISCUSSION


We studied cross-domain activity recognition via the STL framework and evaluated its performance on cross-position HAR tasks. There are more applications in pervasive computing that STL could be applied to. In this section, we discuss the potential of STL in other applications and give some empirical suggestions.

1) Activity recognition. The results of activity recognition can be different according to different devices, users, and wearing positions. STL makes it possible to perform cross-device/user/position activity recognition with high accuracy. In case cross-domain learning is needed, finding and measuring the similarity between the device/user/position is critical.

2) Localization. In WiFi localization, the WiFi signal changes with the time, sensor, and environment, causing the distributions different. So it is necessary to perform cross-domain localization. When applying STL to this situation, it is also important to capture the similarity of signals according to time/sensor/environment.

3) Gesture recognition. For gesture recognition, due to differences in hand structure and moving patterns, the model cannot generalize well. In this case, STL can also be a good option. Meanwhile, special attention needs to be paid to the divergence between the different characteristic of the subjects. 

4) Other context-related applications. Other applications include smart home sensing, intelligent city planning, healthcare, and human-computer interaction. They are also context-related applications. Most of the models built for pervasive computing are only specific to certain contexts. Transfer learning makes it possible to transfer the knowledge between related contexts, of which STL can achieve the best performance. But when recognizing high-level contexts such as Coffee Time, it is rather important to consider the relationship between different contexts in order to utilize their similarities. The research on this area is still on the go.

5) Suggestions for using STL. Firstly, before using STL and other transfer learning approaches, it is critical to investigate the similarity between the source and target domain in advance. Secondly, it is better to use rather strong classifiers for majority voting since it makes the convergence quick. Thirdly, STL can be more efficient if deployed in parallel. Additionally, each step of STL can be tailored according to specific applications.



§ CONCLUSION AND FUTURE WORK


The label scarcity problem is very common in pervasive computing. Transfer learning addresses this issue by leveraging labeled data from auxiliary domains to annotate the target domain. In this paper, we propose a novel and general Stratified Transfer Learning (STL) framework for cross-domain learning in pervasive computing. Compared to existing approaches which only obtain a global domain shift, STL can exploit the intra-affinity of each class between different domains. We also provide a solution to implement STL. Experiments on three large public datasets demonstrate the significant superiority of STL over existing five state-of-the-art methods. In addition, we extensively analyze the performance of transfer learning under different degrees of similarities and different levels of activities. We also extensively discuss the potential of STL in other pervasive computing applications. In addition, STL is a general framework where each step can be tailored according to specific applications, making STL more effective and efficient in solving other problems.

In the future, we plan to extend STL using deep learning, as well as evaluating STL through more cross-domain learning problems in pervasive computing.



§ ACKNOWLEDGMENTS

J. Wang would like to thank Dr. Shuji Hao from A*star, Singapore, and Dr. Mingsheng Long from THU, China, for their valuable comments. This work is supported in part by National Key R & D Plan of China (No.2016YFB1001200), NSFC (No.61572471), and Science and Technology Planning Project of Guangdong Province (No.2015B010105001). 


IEEEtran



