vc 实例方法 函数指针_迁移学习相关知识整理(一):背景及基于实例的迁移学习...

9ee2f4658202b0a23dfb1f61a2694a6c.png

写在前面: 由于我也是刚刚接触这个领域,所以不可避免在行文描述上存在谬误,望不吝指正,另偏重于整理,构建自己的认知体系,所以对于论文以及相关技术细节不做过多介绍(有时候感觉自己真的就是一个民科,太弱了),推荐结合:Transfer Adaptation Learning: A Decade Survey以及王晋东不在家:《迁移学习简明手册》发布啦!来看,g如果遇到相关的理论问题,可以去www.cs.cmu.edu/~ninamf/找找对应的教程

一. 迁移学习的背景

一般来说,测试数据(目标域T)与训练数据(源域S)从属于同一分布是目前各种机器学习算法的一个共同假设,但当这一假设不成立时,我们所训练出来的模型是不会有较好的结果的:

f22dbcef48ee57a09c48077efe164f8c.png

例如下图所示,不同数据集中的同一类物体都有着明显不同的风格,这种纹理上的差异也是造成Domain shift的原因,其他因素还包括有诸如光照变化、传感器性能差异等。

db12cfdcb9f05fb7835cef34f029b9f5.png

又例如邮件分类问题:For example, we might have a spam filter trained from a large email collection received by a group of current users (the source domain) and wish to adapt it for a new user (the target domain). Intuitively this should improve filtering performance for the new user, under the assumption that users generally agree on what is spam and what is not. The challenge is that each user receives a unique distribution of email。(A theory of learning from different domains,Shai Ben-David,2010

虽然可能在目标域上的效果会变差,但是以往学习到的知识仍然是又一定用处的,迁移学习要解决的问题:利用已有的知识(如Pre-trained model),通过解决域不匹配问题,提高算法在目标域上的性能。

--------------------------------------------------------------------------------------------

二. 理论表述

在论文A theory of learning from different domains,Shai Ben-David,2010

定义:The target error bound:

55209b7f9e2fa7e7208390c1d499ac8e.png

其中,第二项代表的是源域S与目标域T数据的H散度,即H-divergence:

48eeeeb5b93ea512b36afa8adf3d34b8.png

含义为:从H中找出一个最优分类器最大限度的区分两个域的数据,得到的最大的概率差值即为H散度。 该散度可以通过样本采样估计到的,并且估计值最终会随着样本数的增加收敛到真实值(VC维有限的情况下,具体公式可以参考论文[1])。

下式给出了具体的计算方法,其中I代表的是指示函数,当括号内的条件成立的时候,输出为1,h为分类函数,源域S标注为0,更加严格的证明请看论文[1],下述公式表达的是:当S与T的数据相差较小的时候,域分类器是不容易取得较好的分类效果的,反之则区分效果比较好。

7ebea8fafe4732b36922e40da5746514.png

原话:Label each unlabeled source instance with 0 and unlabeled target instance as 1.Then train a classifier to discriminate between source and target instances. The H-divergence is immediately computable from the error.

Ben-David给出的目标域误差界限公式有助于帮助我们理清思路,认清问题,进而提出针对性的改进方法,目前很多方法都可以归类到该公式下。同时迁移学习的相关理论也还在发展中,比如H∆H散度、MDD散度等都从理论上给出了算法的泛化误差边界,指导了相关算法的开发,相关文章罗列如下:

a.A theory of learning from different domains(H, H∆H)

b.EMPIRICALMARGIN DISTRIBUTIONS AND BOUNDING THE GENERALIZATION ERROR OF COMBINED CLASSIFIERS

c.New Analysis and Algorithm for Learning with Drifting Distributions

d.Rademacher Complexity

三. 迁移学习的分类

参考

A survey on transfer learning, Pan, S. J. and Yang, Q. 2010,

Transfer Adaptation Learning: A Decade Survey,2019

中的分类标准,以及我自己的理解及需要,将迁移学习整理归纳为以下几类( @王晋东不在家分享整理的简明手册有更加详细的介绍 王晋东不在家:《迁移学习简明手册》发布啦!),注意:!!!我没有将Relation-based整理进来,感兴趣的可以自己去调研

dc287fb21c67a13df81cd9b50f5201f2.png
Intuitive weighting, kernel mapping Based, Co-training Based

ebdfb4058dcd876f919a9ee3ac949376.png

08e730a9ab01188dfba983aa7ac1cfd4.png

四. 迁移学习的分类 之Instance-reweighting Based

(Intuitive weighting, kernel mapping Based, Co-training Based)

基本概念:在源域S和目标域T上,数据有着不同的分布,具体表述为P_S (x,y)≠P_T (x,y),而训练的目标函数是建立在源域的分布之上的,即:

10ff44fb9feaa673192e4e56cef65053.png

如果直接将S域数据训练的模型θ代入T域进行应用,则Risk为:

46b9493d110c59a51e8c3feb50d9296a.png

如果某一类的样本在T域出现的概率大,而在S域出现的概率小,那么其泛化风险就会很高,基于样本实例的迁移方法,就是要寻找一种对输入样本或者输入样本特征进行加权的方法,The objective is to re-weight the source samples so that the source data distribution can be more close to the target data distribution.(Transfer Adaptation Learning: A Decade Survey

(1)Intuitive weighting

正如名称所示,该方法就是直接对样本进行加权,基本原则是让S域中与T域分布相似的样本在Loss中获得较大的权重,反之则较小,至于怎么衡量这个相似性或者赋予权重,则是问题的关键,在[2]中,是通过T域上训练好的分类器来预测S域上样本的结果,如果结果对,说明S域上该样本与T域相似:

138b736c8ecbebbd8a290d2aa3bdb5df.png

在TrAdaboost[3]工作中,则是用预测误差来进行加权的,并通过迭代使得算法收敛,其核心观点可以用原文中的话来描述:

use boosting to filter out the diff-distribution training data that are very different from the same-distribution data by automatically adjusting the weights of training instances. The remaining diff-distribution data are treated as the additional training data which greatly boost the confidence of the learned model even when the same-distribution training data are scarce

文章最终给出了收敛边界的证明(这一点值得我们去学习,现在很多方法并没有理论支撑)

子空间对齐(Subspace alignment)也是一种思路,基本思想为:通过加权使得T域和S域的样本特征的协方差矩阵具有一致的特征向量(在论文[5]中是使用了一个距离度量来求权重的),其中当然使用了PCA来进行降维,Xs为经过加权之后得到的子空间,Xt就是目标域的子空间,然后求一个线性变换矩阵M,就可以将S的数据与T的数据在子空间上对齐,最后在对齐的子空间上进行训练。公式表述如下:

9a70db009187098f6140d9a89c8740ed.png

28a6adf440c1b787a779d89c7bd81ea9.png
算法流程

在论文[5]中对于SA的方法有一个更加简洁的描述:our method seeks a domain adaptation solution by learning a mapping function which aligns the source subspace with the target one,文中也给出了相应的理论证明。

(2)kernel mapping Based

The intuitive weighting based domain adaptation was implemented in the raw data space. In order to infer the sampling weights by distribution matching across source and target data in feature space in a non-parametric way, kernel mapping based weighting was proposed.[6]

总结:kernel mapping based是在特征空间进行的操作,充分利用了特征空间的信息。

Distribution matching

通过对样本在特征空间中进行加权重采样,使得S域与T域样本在特征空间中的统计特征相近,这个特征空间可以是RKHS(再生核希尔伯特空间),也可以是CNN提取的特征,常见的统计特征如均值等,而衡量标准则有最大化均值差异(maximum mean discrepancy ,MMD)、(kernel mean matching,KMM)等(疑问?KMM与MMD等价吗?)

例:KMM

acf1c8fad0f5f22ad1c4fe5d7c5e2579.png

例:WMMD

认为MMD没有考虑到不同类别对于Domain Adaptation的影响,因此对不同的类别进行了加权(Mind the Class Weight Bias: Weighted Maximum Mean Discrepancy for Unsupervised Domain Adaptation,2017,cvpr)

0a1ab399a1d3af5af20cc36ec5929486.png

最大化均值差异(maximum mean discrepancy ,MMD)在迁移学习中的应用是比较多的,经典的工作有TCA[7],JDA[8](可以自己提前去了解),它们分别对边缘分布自适应和联合分布自适应进行了探讨,并给出了MMD的求解方法。需要提前掌握的知识如下:

a.核方法

b.优化算法中的拉格朗日乘子法

c.矩阵的散度计算,中心矩阵,矩阵特征向量求解

Sample-selection

从我的理解角度来看,样本选择其实是Weighting-based的一个特例,其权重空间是稀疏的,实现方法也有很多种,比如[9]中使用了KDA(Kernel Discriminative analysis核判别分析)+K-means来选择核空间中分布相近的样本,还有[10]中的TJM(Transfer Joint Matching),关键公式如下,该方法是对TCA(迁移成分分析)的拓展。

3b18d9345a37c1aa94c051b5aa95db64.png

c056d04c7741de061eb6d73523f88e19.png

(3)Co-training Based

Co-training assumes that the dataset is characterized into two different views, in which two classifiers are then separately learned for each view. The inputs with high confidence of one of the two classifiers can be moved to the training set.

------------------------------------------分割线---------------------------------------------------------------------------------------------------------------------------------------------

以上归纳了Instance-reweighted的主要分支,下面介绍以下目前DeepTL中的应用,及最新的一些工作:

a. RAAN[11]:在对抗学习中对源域数据进行加权,这里面用到了Optimal Transport ,一个不错的理论工具,可以度量两个概率分布之间的距离(C. Villani. Optimal transport: old and new, volume 338.Springer Science & Business Media, 2008.),趁机可以将JS,KL散度,Wasserstein距离度量一起总结。损失函数及网络框架如下:

1ff8a120762ca78747f472ae9e27f647.png

608a16990c3105c2fb6ca266dc8b8627.png

b.TransNorm[12]

提出了一种新的Normalization的方法:TN。文章开头对BN进行了分析: the design that all channels in BN are equally important is unsuitable for domain adaptation. It is clear that some channels are easier to transfer than others since they constitute the sharing patterns of both domains.

This paper delves into the components of DNN architectures and reveals that BN is the constraint of network transferability. We thus propose Transferable Normalization (TransNorm) in place of existing normalization techniques.

这篇文章面向的是UDA问题(unsupervised Domain adaption)。文章的总体思路如下图所示,等价于在通道层面进行了加权,通过衡量特征的可迁移性(源域和目标域的相似性)给予每个通道不同的权重。

024d0d2115dc2baf3336269102a7ade4.png

c. Borrowing Treasures from the Wealthy: Deep Transfer Learning through Selective Joint Fine-Tuning,2017,cpvr

Our core idea is to identify and use a subset of training images from the original source learning task whose low-level characteristics are similar to those from the target learning task, and jointly fine-tune shared convolutional layers for both tasks.

1) 通过filter bank建立每个图像的描述子(类似于bag-of-words模型):Let C_i (m,n) denote the response map to the ith convolutional kernel or Gabor filter in our filter bank, and φ_i its histogram. We concatenate the histograms of all filter response maps to form a feature vector, φ^k=[φ_1, φ_2,…, φ_D] for image x^k.

2)通过KL散度来衡量不同样本之间的相似度,然后用于KNN(这里用了两个KL,是为了克服KL的不对称性,既然这样,为啥不用JS散度?)

38bea54dd5b205f9aa1a1475ed451e84.png
相似度计算公式

e552b349d506a9c2e994f038dc54d387.png

[1].A theory of learning from different domains,Shai Ben-David,2010

[2].Instance Weighting for Domain Adaptation in NLP,2007

[3]. Boosting for Transfer Learning,2007

[4]. Unsupervised Visual Domain Adaptation Using Subspace Alignment ,2013,ICCV

[5]. Visual Domain Adaptation using Weighted Subspace Alignment,2016

[6].(Transfer Adaptation Learning: A Decade Survey,2019)

[7].Domain Adaptation via Transfer Component Analysis,2011

[8].Transfer Feature Learning with Joint Distribution Adaptation,2013

[9].Cross Domain Distribution Adaptation via Kernel Mapping,2009

[10]. Transfer Joint Matching for Unsupervised Domain Adaptation,2014

[11].Re-weighted Adversarial Adaptation Network for Unsupervised Domain Adaptation,2018,cvpr

[12]. Transferable Normalization: Towards Improving Transferability of Deep Neural Networks,2019

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值