{'fraction_non_alphanumeric': 0.02998766330307152, 'fraction_numerical': 0.008920380855976972, 'mean_word_length': 4.826391448580907, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 1, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 3, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
Towards more Reliable Transfer Learning

Multi-source transfer learning has been proven effective when within-target labeled data is scarce. Previous work focuses primarily on exploiting domain similarities and assumes that source domains are richly or at least comparably labeled. While this strong assumption is never true in practice, this paper relaxes it and addresses challenges related to sources with diverse labeling volume and diverse reliability. The first challenge is combining domain similarity and source reliability by proposing a new transfer learning method that utilizes both source-target similarities and inter-source relationships. The second challenge involves pool-based active learning where the oracle is only available in source domains, resulting in an integrated active transfer learning framework that incorporates distribution matching and uncertainty sampling. Extensive experiments on synthetic and two real-world datasets clearly demonstrate the superiority of our proposed methods over several baselines including state-of-the-art transfer learning methods.


Introduction
Traditional supervised machine learning methods share the common assumption that training data and test data are drawn from the same underlying distribution. Typically, they also require sufficient labeled training instances to construct accurate models. In practice, however, one often can only obtain limited labeled training instances. Inspired by human beings' ability to transfer previously learned knowledge to a related task, transfer learning [23] addresses the challenge of data scarcity in the target domain by utilizing labeled data from other related source domain(s). Plenty of research has been done on the single-source setting [25,22,35], and it has been shown that transfer learning has a wide range of applications in areas such as sentiment analysis [3,21], computer vision [15], cross-lingual natural language processing [17], and urban computing [32].
In recent years, new studies are contributing to a more realistic transfer learning setting with multiple source domains, both for classification problems [33,16,7,28] and regression problems [24,31]. These approaches try to capture the diverse source-target similarities, either by measuring the distribution differences between each source and the target or by re-weighting source instances, so that only the source knowledge likely to be relevant to the target domain is transferred. However, these works assume that all sources are equally reliable; in other words, arXiv:1807.02235v1 [cs.LG] 6 Jul 2018 all sources have labeled data of the same or comparable quantity and quality. Nonetheless, in real-world applications, no such assumption holds. For instance, recent sources typically contain less labeled data than long-established ones, and narrower sources contain less data than broader ones. Also some sources may contain more labeling noise than others. Therefore, it is common for source tasks to exhibit diverse reliabilities. However, to the best of our knowledge, not much work has been reported in the literature to compensate for source reliability divergences. Ideally, we thrive to find sources that are relevant and reliable at the same time, as a compromise in either aspect can hurt the performance. When this is infeasible, one has to include some less reliable sources and carefully weigh the trade-off. There are two reasons why including a source that is not richly labeled is desired. First, such a source may be very informative since it is closely related to the target domain. For example, in low-resource language processing, a language that is very similar to the target language is usually also relatively low-resource but it would still be used as an important source due to its proximity. In addition, while labeled data may be scarce, unlabeled data is often easier to obtain and one can acquire labels for unlabeled data from domain experts, assuming a budget is available via active learning [26].
Active learning addresses the problem of data scarcity differently than transfer learning by querying new labels from an oracle for the most informative unlabeled data. A fruitful line of prior work has developed various active learning strategies [20,14,18]. Recently, the idea of combining transfer learning and active learning has attracted increasing attention [6,30,13]. Most of existing work assumes that there is plenty of labeled data in source domain(s) and one can query labels for the target domain from an oracle. However, this assumption is not always true. Since transfer learning is mainly applied in target domains with restrictions on access to data, such as sensitive private domains or novel domains that lack human knowledge to generate sufficient labeled data, often there is little or no readily-available oracle in the target domain. For instance, in the influenza diagnosis task, transfer learning can be applied to assist diagnosing a new flu strain (target domain) by exploiting historical data of related flu strains (source domains), but there may be little expertise regarding the new strain. It is, however, often possible to query labels for a selected set of unlabeled data in source domains, as these may represent previous better-studied flu strains. Task similarity, corresponding to flu-strain diagnosis or treatment in this instance, may be established via commonalities in symptoms exhibited by patients with the new or old flu strains, or via analysis of the various influenza genomes. To the best of our knowledge, active learning for multi-source transfer learning has not been deeply studied.
In this paper, we focus on a novel research problem of transfer learning with multiple sources exhibiting diverse reliabilities and different relations to the target task. We study two related tasks. The first one is how to construct a robust model to effectively transfer knowledge from unevenly reliable sources, including those with less labeled data. The second task is how to apply active learning on multiple sources to stimulate better transfer, especially in such a scenario that sources have diverse quantities and qualities. Notice that these two tasks are related but can also be independent. For instance, in the low-resource language problem mentioned above, the first task is applicable but not the second one. This is because we may have an oracle for neither the source nor the target as they may both be of extremely limited resources. On the other hand, both tasks are relevant to the influenza example.
For the first task, inspired by [18], we propose a peer-weighted multi-source transfer learning method (PW-MSTL) that jointly measures source proximity and reliability. The algorithm utilizes inter-source relationships, which have been less studied previously, in two ways: (i) it associates the proximity coefficients based on distribution difference with the reliability coefficients measured using peers 1 to learn their target model relevance, and (ii) when a source is not confident in the prediction for a testing instance, it is allowed to query its peers. By doing so, the proposed method allows knowledge transfer among sources and effectively utilizes label-scarce sources. For the second task, we propose an active learning framework, called adaptive multi-source active transfer (AMSAT ), that builds on the idea of Kernel Mean Matching (KMM) [11,8] and uncertainty sampling [29] to select unlabeled instances that are the most representative and avoid information redundancy. Experimental results, shown later, demonstrate that the combination of PW-MSTL and AMSAT significantly outperforms other competing methods. The proposed methods are generic and thus can be generalized to other learning tasks.

Related Work
Transfer learning : Transfer learning aims at utilizing source domain knowledge to construct a model with low generalization error in the target domain. Transfer learning with multiple sources is challenging because of distribution discrepancies and complex inter-source dependencies. Most existing work focuses on how to capture the diverse domain similarities. Due to stability and capability of measuring fine-grained similarities explicitly, ensemble approaches are widely used. In [33], adaptive SVM (A-SVM) is proposed to adapt several trained source SVMs and learn model importance from meta-level features based on distributions. In contrast, [7] used Maximum Mean Discrepancy (MMD) [8] as source weights, while adding an additional manifold regularization based on a smoothness assumption of the target classifier. A more sophisticated twostage weighting methodology based on distribution matching and conditional probability differences is presented in [28]. However, the valuable unlabeled data is not utilized in their method. Moreover, these methods assume that all sources are equally reliable and they have the limitation that inter-source relationships are ignored.
Multi-task learning: Unlike multi-source transfer learning which focuses on finding a single hypothesis for the target task, multi-task learning [36] tries to improve performance on all tasks and finds a hypothesis for each task by adaptively leveraging related tasks. It is crucial to learn task relationships in multi-task learning problems, either used as priors [5] or learned adaptively [19]. While this is similar to the inter-source relationships we utilized in this paper, multi-task learning does not involve measuring the proximity between a source and the target nor the trade-off between proximity and reliability.
Active learning: At the other end of the spectrum, active learning has been proven to be effective both empirically and theoretically. A new definition of sample complexity is proposed in [1] to show that active learning is strictly better than passive learning asymptotically. In recent years, there has been increasing interests in combining transfer learning and active learning to jointly solve the issue of insufficient labeled data. A popular representative of this family is the work by Chattopadhyay et al. [6] where the JO-TAL method is proposed. It is a unified framework that jointly performs active learning and transfer learning by matching Hilbert space embeddings of distributions. A key benefit of these methods is to address the cold start problem of active learning by introducing a version space prior learned from transfer learning [34]. However, unlike our approach, these methods all assume that source data are richly labeled and only perform active learning in the target domain.

Problem Formulation
For simplicity, we consider a binary classification problem for each domain, but the methods generalize to multi-class problems and are also applicable to regression tasks. We consider the following multi-source transfer learning setting that is common in real world when one tries to study a novel target domain with extremely limited resources. We denote by [N] consecutive integers ranging from 1 to N. Suppose we are given K auxiliary source domains, each contains both labeled and unlabeled data. Moreover, these sources typically have varying amount of labeled data (and thus with diverse reliabilities). Specifically, we denote by S k = S L k ∪ S U k the dataset associated with the k th source domain.
is the set of unlabeled data of size n U k . For the target domain, we assume that there is no labeled data available but we have sufficient unlabeled data, denoted as where instances are in the same feature space as sources. Furthermore, for the purpose of active learning, we assume that there is a uniform-cost oracle available only in the source domains, and the conditional probabilities P (Y |X) are at least somewhat similar among both source and target domains.

Motivation
We first present the theoretical motivation for our methods. We analyze the expected target domain risk in the multi-source setting, making use of the theory of domain adaptation proved in [2,4].
Definition 1 For a hypothesis space H for instance space X , the symmetric difference hypothesis space H∆H is the set of hypotheses defined as where ⊕ is the XOR function. Then the H∆H-divergence between any two distributions D and D is defined as where A H∆H is the measurable set of subsets of X that are the support of some hypothesis in H∆H. Now if we assume that all domains have the same amount of unlabeled data (which is a reasonable assumption since unlabeled data are usually cheap to obtain), i.e. n U k = n T = m , then we can show the following risk bound on the target domain.
Theorem 1 Let H be a hypothesis space of VC-dimension d andd H∆H (S U i , T ) be the empirical distributional distance between the i th source and the target domain, induced by the symmetric difference hypothesis space. Then, for any µ ∈ (0, 1) and anyĥ = i α iĥi whereĥ i ∈ H and α i = 1, the following holds with probability at least 1 − δ, where * (h) is the expected risk of h in the corresponding domain, m = K i n L i is the sum of labeled sizes in all sources, β i = n L i /m is the ratio of labeled data in the i th source, and λ α,µ is the risk of the ideal multi-source hypothesis weighted by α and µ.
The proof can be found in the supplementary material. By introducing a concentration factor µ, we replace the size of labeled data for each source n L i with the total size m in the third line in Eq. (3), resulting in a tighter bound. Suppose that the hypothesisĥ i is learned using data in the i th source, then the bound suggests to use peers to evaluate the reliability ofĥ i while the optimal weights should consider both proximity and reliability of the i th source. This inspired us to propose the following method.

18: end for
In this paper, we propose the idea of formulating all source domains jointly in a framework similar to the multi-task learning. Similar to the task relationships in multi-task learning, we learn the inter-source relationships for the multi-source transfer learning problem by training a source relationship matrix R ∈ R K×K as follows: whereĥ j is the classifier trained on the j th source,ˆ Si (ĥ j ) is the empirical error ofĥ j measured on the i th source and β 1 is a parameter to control the spread of the error. In other words, R is a matrix such that all entries on the diagonal are 0 and the k th row, namely R k ∈ ∆ K−1 , is a distribution over all sources where ∆ K−1 denotes the probability simplex. Note that we do not require R to be symmetric due to the asymmetric nature of information transferability. While classifiers trained on a more reliable source can be well transferred to a less reliable source, the reverse is not guaranteed to be true.
A key benefit of the matrix R is that it measures source reliabilities directly. The bound in Eq. (3) suggests that this direct measurement of reliability gives the algorithm extra confidence in lower generalization error. Intuitively, if a classifier h i trained on the i th source has a low empirical error on the j th source and the distributional divergence (such as the H∆H-divergence) between the j th source and the target is small, thenĥ i should have a low error on the target domain as well. This is shown by the second line in Eq. (3).
We therefore parametrize the source importance weights, considering both source proximity and reliability, as follows: where I K ∈ R K×K is the identity matrix, δ ∈ R K is a vector measuring pairwise source-target proximities, µ ∈ [0, 1] is a scalar and R is the source relationship matrix. The concentration factor µ introduces an additional degree of freedom in quantifying the trade-off between proximity and reliability. Setting µ = 1 amounts to weight sources based on proximity only. In the next section, we obtain the effective heuristic of specifying µ = 1 K in our experiments. The proximity vector δ may be manually specified according to domain knowledge or estimated from data. In this paper, we adapt the Maximum Mean Discrepancy (MMD) statistic [11,8] to estimate the distribution discrepancy. It measures the difference between the means of two distributions after mapping onto a Reproducing Kernel Hilbert Space (RKHS), avoiding the complex density estimation. Specifically, for the k th source, its re-weighted MMD can be written as: where α k i ≥ 0 are the weights of the k th source aggregate data and Φ(x) is a feature map onto the RKHS H. By applying the kernel trick, the optimization in (6) can be solved efficiently as a quadratic programming problem using interior point methods.
For label-scarce sources, the ensemble approach often fails to utilize their information effectively. This unsatisfactory performance leads us to propose using confidence and source relationships to transfer knowledge. For many standard classification methods such as SVMs and perceptrons, we can use the distance to the boundary |ĥ k (x)| to measure the confidence of the k th classifier on the example x, as in previous works [18]. If the confidence is low, we allow the classifier to query its peers on this specific example, exploiting the source relationship matrix R. Algorithm 1 summarizes our proposed method. Compute α k by solving (6).

Adaptive Multi-source Active Learning
When an oracle is available in the source domain, we can acquire more labels for source data, especially for less reliable but target-relevant sources. This is different from traditional active learning, which tries to improve the accuracy within the target domain. The TLAS algorithm proposed in [12] performs the active learning on the source domain in the single-source transfer learning, by solving a biconvex optimization problem. However, their solution requires solving two quadratic programming problems alternatively at each iteration and is therefore computationally expensive, especially for multi-source problems of large scale. In this paper, we propose an efficient two-stage active learning framework. The pseudo-code is in Algorithm 2.
In the first stage, the algorithm selects the source domain for query in an adaptive manner. The idea is that while we want to explore label-scarce sources for high marginal gain in performance, we also want to exploit label-rich sources for reliable queries. Eq.(3) suggests that the learner should prefer a uniform source labeled ratio. Therefore, we draw a Bernoulli random variable P (t) with probability D KL (β||unif orm), i.e. the Kullback-Leibler (KL) divergence between the current ratio of source labeled data and the uniform distribution. If P (t) = 1, then the algorithm explores sources that contain less labeled data. If P (t) = 0, the algorithm exploits sources as demonstrated in line 12 of Algorithm 2. Notice that the combined weights proposed in Eq.(5) play a crucial role here by providing a measurement of sources with unequal reliabilities.
In the second stage, the algorithm queries the most informative instance within the selected source domain. Nguyen and Smeulders [20] propose a Density Weighted Uncertainty Sampling criterion as: which picks the instance that is close to the boundary and relies in a denser neighborhood. In our setting, we propose to combine the distribution matching weights α in Eq.(6) and the uncertainty sampling to form the following selection criterion: This criterion selects instances that are representative in both source and target domains while it also takes uncertainty into consideration. Notice that we solve Eq.(6) once only and store the value of α. As shown in [27], such approach is as efficient as the base informativeness measure, i.e. uncertainty sampling. Therefore, the proposed method achieves efficiency, representativeness and minimum information overlap.

Empirical Evaluation
In the following experimental study we aim at two goals: (i) to evaluate the performance of PW-MSTL with sources with diverse reliabilities, and (ii) to evaluate the effectiveness of AMSAT in constructing more reliable classifiers via active learning. Due to space limitation, not all results are presented, but they show similar patterns. Unless otherwise specified, all model parameters are chosen via 5-fold cross validation and all results are averaged over experiments repeated randomly 30 times.

Datasets
Synthetic dataset. We generate a synthetic data for 5 source domains and 1 target domain. The samples x ∈ R 10 are drawn from Gaussian distributions N (µ T + p∆µ, σ), where µ T is the mean of the target domain, ∆µ is a random fluctuation vector and p is the variable controlling the proximity between each source and the target (higher p indicates lower proximity). We then consider a labeling function f (x) = sign((w T 0 + δ∆w)x + ), where w 0 is a fixed base vector, ∆w is a random fluctuation vector and is a zero-mean Gaussian noise term. We set δ to small values as we assume labeling functions are similar. Using different p values, We generate 50 positive points and 50 negative points as training data for each source domain and additional 100 balanced testing samples for the target domain.
Spam Detection. 2 [10]. Since some spam types are shared among users while others are not, these domains form a multi-source transfer learning problem if we try to utilize data from other users to build a personalized spam filter for a target user. Sentiment Analysis. 3 The dataset contains product reviews from 24 domains on Amazon. We consider each domain as a binary classification task by setting reviews with rating > 3 as positive (+) and reviews with rating < 3 as negative (−), while reviews with rating = 3 were discarded as they are ambiguous. We pick the 10 domains that each contains more than 2000 samples and for each round of experiment, we randomly draw 1000 positive reviews and 1000 negative reviews for each domain. Similar to the previous dataset, each review contains of approximately 350K features and we reduce the dimension to 200 using the same method.
For each set of experiments, we have 600 examples (100 examples per domain) for synthetic, 6000 emails (400 emails per user) for spam and 20000 reviews (2000 reviews per domain) for sentiment. We set one domain as the target and the rest as sources. For each source domain, we randomly divide the data into the labeled set and the unlabeled set, using a labeled-data fraction. For the target domain, we randomly divide it into two parts: 40% for testing and 60% as unlabeled training data (with the exception of synthetic as we have generated extra testing data). Note that we can set different labeled-data fractions for source domains to model diverse reliabilities.

Reliable Multi-source Transfer Learning
Competing Methods. To evaluate the performance of our approach, we compare the proposed PW-MSTL with five different methods: one single-source method, one aggregate method, and three ensemble methods. Specifically, Kernel Mean Matching (KMM) [11] is a conventional single-source method by distribution matching. We perform KMM for each single source and report the best performance (note that this is impractical in general as it requires an oracle to know which classifier is the best). Kernel Mean Matching-Aggregate (KMM-A) is the aggregate method which performs KMM on all sources' training data combined. For the ensemble approach, Adaptive SVM (A-SVM) [33] and Domain Adaptation Machine (DAM) [7] are two widely-adopted multi-source methods. Finally, we also compare with our own baseline PW-MSTL b , which is similar to DAM but directly uses Eq.(5) as model weights. We also compared with Transfer Component Analysis (TCA) [22] but the result is omitted due to its similar performance to KMM.
Setup. For all methods, we use SVM as the base model and fix b 1 = 1. For competing methods, we mainly follow the standard procedures for model selection as explained in their respective papers. For fair comparisons, we use the same Gaussion kernel k(x i , x j ) = e − xi−xj 2 /γ with the bandwidth γ set to the median pairwise distance of training data according to the median heuristic [9]. Using other kernels yields similar results. For ensemble methods, we set the proximity weight as δ k = exp(−β2M M D ρ (S k ,T )) k exp(−β2M M D ρ (S k ,T )) , where β 2 and ρ are tuned for each dataset to control the spread of MMD as described in Section 4.2. For both PW-MSTL and PW-MSTL b , we set µ = 0.2 for all experiments and use the 0-1 loss to compute the relation matrix R (See Figure 1 for results on varying µ).
Results and Discussion. Table 1 4 shows the classification accuracy of different methods on various datasets when sources contain different labeled fractions randomly chosen from the set {1%, 5%, 15%, 30%}, while Table 2 shows the results when sources have the same amount of labeled data. The method that outperforms all other methods within the column with p < 0.001 significance is highlighted and underlined (and thus we omit standard deviation due to space). We can observe that our proposed PW-MSTL method outperforms other methods in most cases. When source reliabilities are uneven, we get a significant improvement in the test set accuracy. By comparing results across the two tables, we can also observe that gap between our methods and other methods diminishes as source domains acquire more labeled data (more reliable). Note that we have built two scenarios for the Synthetic dataset in Table 1. We control the proximity variable p and the labeled fraction such that similar sources also contain more labeled data in case 1 while this is reversed in case 2. As a result, we observe that prior methods focusing on proximity measure obtain an accuracy boost under case 2 compared to case 1 while our methods are consistent. We also note that A-SVM and DAM perform poorly on dvd and video even when sources are balanced. This is because the distribution divergence between these two domains are very small, causing prior methods failure to utilize other less related sources effectively. We plot an incremental performance comparison on dvd in Figure 1(a), showing that DAM slowly catches up with the single-source method as labeled fractions increase.
Finally, we study the sensitivity of µ. Figure 1(b) and 1(c) show the variation in accuracy for some cases in Table 1 and 2 with varying µ over [0,1]. We can observe that similar patterns that accuracy values first increase and then decrease as µ increases in both cases, only that the drop in the performance is smoother in Figure 1(c). This confirms the motivation of combining proximity and reliability and the theoretical result established in this paper. Results on other datasets are similar but we omit them in the graph due to different scales.

Multi-source Active Learning
Baselines. To the best of our knowledge, there is no existing study that can be directly applied to our setting. Therefore, to evaluate the performance of our proposed AMSAT algorithm, we compare to the following standard baselines: (1)Random: Selects the examples to query randomly from all source domains. This is equivalent to passive learning. Setup. Unlike traditional active learning where domains for active selection are label-scarce, we initialize our source domains with various amount of labeled data such that some sources are more richly labeled. For each set of experiments, we initialize each source domain with a labeled fraction randomly chosen from a fixed set. This same data partition is used for all comparing methods. After each query, we perform a multi-source transfer learning algorithm and record the accuracy on the test target data. The data partition is repeated randomly for 30 times and the average results are reported. For all of our experiments, we set the query budget to 10% of the total number of source examples in the dataset. For fair comparison, the selected examples are evaluated using the same transfer learning method.
Results and Discussion. The performance curve evaluated using PW-MSTL with increasing queries are plotted in Figure 2. Due to space limitation, only a small fraction of results are presented and we only show results on Sentiment here because other datasets are less interesting due to diminishing gains. However, it should be noted that our proposed AMSAT method outperforms other methods with p < 0.0001 significance in a two-tailed test in all datasets. Figure 2 shows results with initial source labeled fractions randomly chosen from {1%, 5%, 15%, 30%}, same as experiments in Table 1. We can observe that AMSAT consistently outperforms baselines at almost all stages. The only exception is that Proximity sampling performs better at the early stage when there exists a source domain that is particularly close to the target domain, as in the case of dvd in Figure 2(b). Figure 3(a) and 3(b) show examples of method performance using a different data initialization on the kitchen domain. While they show similar patterns compared to Figure 2(d) (AMSAT consistently outperforming other baselines), we observe that AMSAT has comparable ending points in two plots due to diminishing gains. This suggests that performing active learning when sources have very uneven reliabilities is hard.
For the baselines, we observe that they are quite unstable when evaluated using PW-MSTL. For example, in some domains Uncertainty sampling performs better than Random sampling as in Figure 2(d) while it is not the case in other domains such as in Figure 2(a). When evaluated using other transfer learning methods such as DAM, often other baselines outperform Random sampling as expected. To show that combining PW-MSTL and AMSAT is superior, we compare several combinations of transfer learning and active learning methods. A typical example is shown in Figure 3(c). Notice that the curves with the same active learning method are evaluated using different transfer learning methods on the same queried data. We observe that while AMSAT still performs better than baselines when evaluated using DAM, the performance gap is larger when evaluated using PW-MSTL. The combination of PW-MSTL and AMSAT significantly outperforms the rest, showing a synergy between the proposed methods.
Finally, we evaluate the effectiveness of both picking the source as line 14 in Algorithm 2 and picking the example according to Eq.(8). We add a baseline AMSAT-US which performs exactly the same as Algorithm 2 except that it picks the example according to uncertainty sampling in line 15. Therefore, the added baseline utilizes the proposed source picking strategy but not the example picking strategy. Figure 3(d) showcases the comparison among the four methods. We can observe that: (i) AMSAT-US performs better than Uncertainty, indicating the effectiveness of source picking strategy proposed; (ii) AMSAT outperforms AMSAT-US, showing the effectiveness of example picking strategy.

Conclusion
We study a new research problem of transfer learning with multiple sources exhibiting reliability divergences, and explore two related tasks. The contributions of this paper are: (1) we propose a novel peer-weighted multi-source transfer learning (PW-MSTL) method that makes robust predictions in the described scenario, (2) we study the problem of active learning on source domains and propose an adaptive multi-source active transfer (AMSAT) framework to improve source reliability and performance in the target domain, and (3) we demonstrate the efficacy of utilizing inter-source relationships in the multi-source transfer learning problem. Experiments on both synthetic and real world datasets demonstrated the effectiveness of our methods.