KLIEP
KLIEP
∗
This is an extended version of an earlier conference paper (Sugiyama et al., 2008). A
MATLAB implementation of the proposed importance estimation method is available from
‘http://sugiyama-www.cs.titech.ac.jp/~sugi/software/KLIEP’.
Direct Importance Estimation for Covariate Shift Adaptation 2
Abstract
A situation where training and test samples follow different input distributions is
called covariate shift. Under covariate shift, standard learning methods such as max-
imum likelihood estimation are no longer consistent—weighted variants according
to the ratio of test and training input densities are consistent. Therefore, accurately
estimating the density ratio, called the importance, is one of the key issues in covari-
ate shift adaptation. A naive approach to this task is to first estimate training and
test input densities separately and then estimate the importance by taking the ratio
of the estimated densities. However, this naive approach tends to perform poorly
since density estimation is a hard task particularly in high dimensional cases. In
this paper, we propose a direct importance estimation method that does not in-
volve density estimation. Our method is equipped with a natural cross validation
procedure and hence tuning parameters such as the kernel width can be objectively
optimized. Furthermore, we give rigorous mathematical proofs for the convergence
of the proposed algorithm. Simulations illustrate the usefulness of our approach.
Keywords
1 Introduction
A common assumption in supervised learning is that training and test samples follow the
same distribution. However, this basic assumption is often violated in practice and then
standard machine learning methods do not work as desired. A situation where the input
distribution P (x) is different in the training and test phases but the conditional distribu-
tion of output values, P (y|x), remains unchanged is called covariate shift (Shimodaira,
2000). In many real-world applications such as robot control (Sutton and Barto, 1998;
Shelton, 2001; Hachiya et al., 2008), bioinformatics (Baldi and Brunak, 1998; Borgwardt
et al., 2006), spam filtering (Bickel and Scheffer, 2007), brain-computer interfacing (Wol-
paw et al., 2002; Sugiyama et al., 2007), or econometrics (Heckman, 1979), covariate shift
is conceivable and thus learning under covariate shift is gathering a lot of attention these
days.
The influence of covariate shift could be alleviated by weighting the log likelihood
terms according to the importance (Shimodaira, 2000):
pte (x)
w(x) := ,
ptr (x)
where pte (x) and ptr (x) are test and training input densities. Since the importance is
usually unknown, the key issue of covariate shift adaptation is how to accurately estimate
Direct Importance Estimation for Covariate Shift Adaptation 3
the importance1 .
A naive approach to importance estimation would be to first estimate the training
and test densities separately from training and test input samples, and then estimate the
importance by taking the ratio of the estimated densities. However, density estimation is
known to be a hard problem particularly in high-dimensional cases (Härdle et al., 2004).
Therefore, this naive approach may not be effective—directly estimating the importance
without estimating the densities would be more promising.
Following this spirit, the kernel mean matching (KMM) method has been proposed
recently (Huang et al., 2007), which directly gives importance estimates without going
through density estimation. KMM is shown to work well, given that tuning parameters
such as the kernel width are chosen appropriately. Intuitively, model selection of impor-
tance estimation algorithms (such as KMM) is straightforward by cross validation (CV)
over the performance of subsequent learning algorithms. However, this is highly unreliable
since the ordinary CV score is heavily biased under covariate shift—for unbiased estima-
tion of the prediction performance of subsequent learning algorithms, the CV procedure
itself needs to be importance-weighted (Sugiyama et al., 2007). Since the importance
weight has to have been fixed when model selection is carried out by importance weighted
CV, it can not be used for model selection of importance estimation algorithms2 .
The above fact implies that model selection of importance estimation algorithms
should be performed within the importance estimation step in an unsupervised manner.
However, since KMM can only estimate the values of the importance at training input
points, it can not be directly applied in the CV framework; an out-of-sample extension is
needed, but this seems to be an open research issue currently.
In this paper, we propose a new importance estimation method which can overcome
the above problems, i.e., the proposed method directly estimates the importance without
density estimation and is equipped with a natural model selection procedure. Our basic
idea is to find an importance estimate w(x) b such that the Kullback-Leibler divergence
from the true test input density pte (x) to its estimate pbte (x) = w(x)p
b tr (x) is minimized.
We propose an algorithm that can carry out this minimization without explicitly mod-
eling ptr (x) and pte (x). We call the proposed method the Kullback-Leibler Importance
Estimation Procedure (KLIEP). The optimization problem involved in KLIEP is convex,
1
Covariate shift matters in parameter learning only when the model used for function learning is
misspecified (i.e., the model is so simple that the true learning target function can not be expressed)
(Shimodaira, 2000)—when the model is correctly (or overly) specified, ordinary maximum likelihood
estimation is still consistent. Following this fact, there is a criticism that importance weighting is not
needed; just the use of a complex enough model can settle the problem. However, too complex models
result in huge variance and thus we practically need to choose a complex enough but not too complex
model. For choosing such an appropriate model, we usually use a model selection technique such as cross
validation (CV). However, the ordinary CV score is heavily biased due to covariate shift and we also need
to importance-weight the CV score (or any other model selection criteria) for unbiasedness (Shimodaira,
2000; Sugiyama and Müller, 2005; Sugiyama et al., 2007). For this reason, estimating the importance is
indispensable when covariate shift occurs.
2
Once the importance weight has been fixed, importance weighted CV can be used for model selection
of subsequent learning algorithms.
Direct Importance Estimation for Covariate Shift Adaptation 4
so the unique global solution can be obtained. Furthermore, the solution tends to be
sparse, which contributes to reducing the computational cost in the test phase.
Since KLIEP is based on the minimization of the Kullback-Leibler divergence, its
model selection can be naturally carried out through a variant of likelihood CV, which is
a standard model selection technique in density estimation (Härdle et al., 2004). A key
advantage of our CV procedure is that, not the training samples, but the test input samples
are cross-validated. This highly contributes to improving the model selection accuracy
when the number of training samples is limited but test input samples are abundantly
available.
The simulation studies show that KLIEP tends to outperform existing approaches in
importance estimation including the logistic regression based method (Bickel et al., 2007),
and it contributes to improving the prediction performance in covariate shift scenarios.
{xte
j }j=1 from a test input distribution with density pte (x). We assume that ptr (x) > 0
nte
for all x ∈ D. The goal of this paper is to develop a method of estimating the importance
w(x) from {xtr i }i=1 and {xj }j=1 :
ntr te nte 3
pte (x)
w(x) := .
ptr (x)
Our key restriction is that we avoid estimating densities pte (x) and ptr (x) when estimating
the importance w(x).
∑
b
b
w(x) = αℓ φℓ (x), (1)
ℓ=1
3
Importance estimation is a pre-processing step of supervised learning tasks where training output
samples {yitr }ni=1
tr
at the training input points {xtr
i }i=1 are also available (Shimodaira, 2000; Sugiyama
ntr
and Müller, 2005; Huang et al., 2007; Sugiyama et al., 2007). However, we do not use {yitr }ni=1tr
in the
importance estimation step since they are irrelevant to the importance.
Direct Importance Estimation for Covariate Shift Adaptation 5
where {αℓ }bℓ=1 are parameters to be learned from data samples and {φℓ (x)}bℓ=1 are basis
functions such that
Note that b and {φℓ (x)}bℓ=1 could be dependent on the samples {xtr i }i=1 and {xj }j=1 ,
ntr te nte
i.e., kernel models are also allowed—we explain how the basis functions {φℓ (x)}bℓ=1 are
chosen in Section 2.3.
b
Using the model w(x), we can estimate the test input density pte (x) by
We determine the parameters {αℓ }bℓ=1 in the model (1) so that the Kullback-Leibler di-
vergence from pte (x) to pbte (x) is minimized4 :
∫
pte (x)
KL[pte (x)∥bpte (x)] = pte (x) log dx
D b
w(x)p tr (x)
∫ ∫
pte (x)
= pte (x) log dx − b
pte (x) log w(x)dx. (2)
D ptr (x) D
Since the first term in Eq.(2) is independent of {αℓ }bℓ=1 , we ignore it and focus on the
second term. We denote it by J:
∫
J := b
pte (x) log w(x)dx (3)
D
( b )
1 ∑ ∑ ∑
nte nte
1
≈ b te
log w(x j ) = log αℓ φℓ (xte
j ) ,
nte j=1 nte j=1 ℓ=1
where the empirical approximation based on the test input samples {xte j }j=1 is used from
nte
the first line to the second line above. This is our objective function to be maximized
with respect to the parameters {αℓ }bℓ=1 , which is concave (Boyd and Vandenberghe, 2004).
Note that the above objective function only involves the test input samples {xte j }j=1 , i.e.,
nte
we did not use the training input samples {xtr i }i=1 yet. As shown below, {xi }i=1 will be
ntr tr ntr
αℓ ≥ 0 for ℓ = 1, 2, . . . , b.
4
One may also consider an alternative scenario where the inverse importance w−1 (x) is parame-
terized and the parameters are learned so that the Kullback-Leibler divergence from ptr (x) to pbtr (x)
(= wb−1 (x)pte (x)) is minimized. We may also consider using KL[bpte (x)∥pte (x)]—however, this involves
b
the model w(x) in a more complex manner and does not seem to result in a simple optimization problem.
Direct Importance Estimation for Covariate Shift Adaptation 6
In addition to the non-negativity, w(x) b should be properly normalized since pbte (x) (=
b
w(x)p tr (x)) is a probability density function:
∫ ∫
1= pbte (x)dx = b
w(x)p tr (x)dx (4)
D D
1 ∑
ntr
1 ∑
ntr ∑b
≈ b tr
w(x i ) = αℓ φℓ (xtr
i ),
ntr i=1
ntr i=1 ℓ=1
where the empirical approximation based on the training input samples {xtr
i }i=1 is used
ntr
∑
ntr ∑
b
subject to i ) = ntr and α1 , α2 , . . . , αb ≥ 0.
αℓ φℓ (xtr
i=1 ℓ=1
This is a convex optimization problem and the global solution can be obtained, e.g., by
simply performing gradient ascent and feasibility satisfaction iteratively5 . A pseudo code
is described in Figure 1(a). Note that the solution {b αℓ }bℓ=1 tends to be sparse (Boyd
and Vandenberghe, 2004), which contributes to reducing the computational cost in the
test phase. We refer to the above method as Kullback-Leibler Importance Estimation
Procedure (KLIEP).
obtain an importance estimate w br (x) from {Xj }j̸=r and approximate the score J using
te
Xr as
te
1 ∑
Jbr := br (x).
log w
|Xrte | te x∈Xr
5
∑b
If necessary, we may regularize the solution, e.g., by adding a penalty term (say, ℓ=1 αℓ2 ) to the
objective function or by imposing an upper bound on the solution. The normalization constraint (4) may
also be weakened by allowing a small deviation. These modification is possible without sacrificing the
convexity.
Direct Importance Estimation for Covariate Shift Adaptation 7
b
Output: w(x)
Aj,ℓ ←− φ∑ te
ℓ (xj ) for j = 1, 2, . . . , nte and ℓ = 1, 2, . . . , b;
bℓ ←− ntr i=1 φℓ (xtr
1 ntr
i ) for j = 1, 2, . . . , nte ;
Initialize α (> 0) and ε (0 < ε ≪ 1);
Repeat until convergence
α ←− α + εA⊤ (1./Aα); % Gradient ascent
α ←− α + (1 − b⊤ α)b/(b⊤ b); % Constraint satisfaction
α ←− max(0, α); % Constraint satisfaction
α ←− α/(b⊤ α); % Constraint satisfaction
end
∑
b
w(x) ←− bℓ=1 αℓ φℓ (x);
(a) KLIEP main code
(k)
Input: M = {mk | mk = {φℓ (x)}bℓ=1 }, {xtr
i }i=1 , and {xj }j=1
(k)
ntr te nte
b
Output: w(x)
Split {xte
j }j=1 into R disjoint subsets {Xr }r=1 ;
nte te R
Figure 1: The KLIEP algorithm in pseudo code. ‘./’ indicates the element-wise division
and ⊤ denotes the transpose. Inequalities and the ‘max’ operation for vectors are applied
element-wise. A MATLAB implementation of the KLIEP algorithm is available from
‘http://sugiyama-www.cs.titech.ac.jp/~sugi/software/KLIEP’.
We repeat this procedure for r = 1, 2, . . . , R, compute the average of Jbr over all r, and
use the average Jb as an estimate of J:
1∑b
R
Jb := Jr . (5)
R r=1
For model selection, we compute Jb for all model candidates (the basis functions
b A pseudo code
{φℓ (x)}bℓ=1 in the current setting) and choose the one that minimizes J.
of the LCV procedure is summarized in Figure 1(b).
Direct Importance Estimation for Covariate Shift Adaptation 8
One of the potential limitations of CV in general is that it is not reliable in small sample
cases since data splitting by CV further reduces the sample size. On the other hand, in
our CV procedure, the data splitting is performed only over the test input samples, not
over the training samples. Therefore, even when the number of training samples is small,
our CV procedure does not suffer from the small sample problem as long as a large number
of test input samples are available.
A good model may be chosen by the above CV procedure, given that a set of promising
model candidates is prepared. As model candidates, we propose using a Gaussian kernel
model centered at the test input points {xte j }j=1 , i.e.,
nte
∑
nte
b
w(x) = αℓ Kσ (x, xte
ℓ ),
ℓ=1
′
where Kσ (x, x ) is the Gaussian kernel with kernel width σ:
( )
′ ∥x − x′ ∥2
Kσ (x, x ) := exp − . (6)
2σ 2
The reason why we chose the test input points {xte j }j=1 as the Gaussian centers, not
nte
the training input points {xtri }i=1 , is as follows. By definition, the importance w(x) tends
ntr
to take large values if the training input density ptr (x) is small and the test input density
pte (x) is large; conversely, w(x) tends to be small (i.e., close to zero) if ptr (x) is large
and pte (x) is small. When a function is approximated by a Gaussian kernel model, many
kernels may be needed in the region where the output of the target function is large;
on the other hand, only a small number of kernels would be enough in the region where
the output of the target function is close to zero. Following this heuristic, we decided to
allocate many kernels at high test input density regions, which can be achieved by setting
the Gaussian centers at the test input points {xte j }j=1 .
nte
Alternatively, we may locate (ntr +nte ) Gaussian kernels at both {xtr i }i=1 and {xj }j=1 .
ntr te nte
However, in our preliminary experiments, this did not further improve the performance,
but slightly increased the computational cost. When nte is very large, just using all the test
input points {xte j }j=1 as Gaussian centers is already computationally rather demanding.
nte
To ease this problem, we practically propose using a subset of {xte j }j=1 as Gaussian centers
nte
number.
3 Theoretical Analyses
In this section, we investigate the convergence properties of the KLIEP algorithm. The
theoretical statements we prove in this section are roughly summarized as follows.
Direct Importance Estimation for Covariate Shift Adaptation 9
• When a non-parametric model (e.g., kernel basis functions centered at test samples)
is used for importance estimation, KLIEP converges to the optimal solution with
convergence rate slightly slower than Op (n− 2 ) under n = ntr = nte (Theorem 1 and
1
Theorem 2).
• When a fixed set of basis functions is used for importance estimation, KLIEP con-
verges to the optimal solution with convergence rate Op (n− 2 ). Furthermore, KLIEP
1
has asymptotic normality around the optimal solution (Theorem 3 and Theorem 4).
n = nte = ntr .
We note that this assumption is just for simplicity; without this assumption, the conver-
gence rate is solely determined by the sample size with the slower rate.
For arbitrary measure P̃ and P̃ -integrable function f , we express its “expectation” as
∫
P̃ f := f dP̃ .
Let P and Q be the probability measures which generate test and training samples,
respectively. In a similar fashion, we define the empirical distributions of test and training
samples by Pn and Qn , i.e.,
1∑ 1∑
n n
Pn f = f (xte
j ), Qn f = f (xtr
i ).
n j=1 n i=1
F := {φθ | θ ∈ Θ},
where Θ is some parameter or index set. The set of basis functions at n samples are
denoted using Θn ⊆ Θ by
Fn := {φθ | θ ∈ Θn } ⊂ F,
which can behave stochastically. The set of finite linear combinations of F with positive
coefficients and its bounded subset are denoted by
{ }
∑
G := αl φθl αl ≥ 0, φθl ∈ F ,
l
G M
:= {g ∈ G | ∥g∥∞ ≤ M } ,
Direct Importance Estimation for Covariate Shift Adaptation 10
Ĝn := {g ∈ Gn | Qn g = 1}.
Under the notations described above, the solution ĝn of (generalized) KLIEP is given as
follows:
ĝn := arg max Pn log (g) .
g∈Ĝn
For simplicity, we assume the optimal solution is uniquely determined. In order to derive
the convergence rates of KLIEP, we make the following assumptions.
Assumption 1
1. P and Q are mutually absolutely continuous and have the following property:
dP
0 < η0 ≤ ≤ η1
dQ
on the support of P and Q. Let g0 denote
dP
g0 := .
dQ
where the supremum is taken over all finitely discrete probability measures Q̃, or
( )γ
M
log N[] (ϵ, G , L2 (Q)) ≤ K
M
. (9)
ϵ
N (ϵ, F, d) and N[] (ϵ, F, d) are the ϵ-covering number and the ϵ-bracketing number
of F with norm d, respectively (van der Vaart and Wellner, 1996).
Direct Importance Estimation for Covariate Shift Adaptation 11
where g and g ′ are non-negative measurable functions (not necessarily probability den-
sities). The lower bound of g0 appeared in Assumption 1.1 will be used to ensure the
existence of a Lipschitz continuous function that bounds the Hellinger distance from the
true. The bound of g0 is needed only on the support of P and Q. Assumption 1.3 con-
trols the complexity of the model. By this complexity assumption, we can bound the tail
probability of the difference between the empirical risk and the true risk uniformly over
the function class G M .
Theorem 1 Let
Then
√
hQ (an0 g0 , ĝn ) = Op (n− 2+γ +
1
γn ).
The technical advantage of using the Hellinger distance instead of the KL-divergence is
that the Hellinger distance is bounded from above by a Lipschitz continuous function
while the KL-divergence is not Lipschitz continuous because log(x) diverges to −∞ as
x → 0. This allows us to utilize uniform convergence results of empirical processes. See
the proof for more details.
Thus,
√
hQ (ĝn , g0 ) ≤ hQ (ĝn , an0 g0 ) + hQ (an0 g0 , g0 ) = Op (n− 2+γ +
1
γn ).
Theorem 2 In addition to Assumption 1, if there is gn∗ ∈ Ĝn such that for some constant
c0 , on the support of P and Q
g0
∗
≤ c20 ,
gn
then
hQ (g0 , ĝn ) = Op (n− 2+γ + hQ (gn∗ , g0 )).
1
Vaart (2001), for every 0 < ϵn < 1/2, there exits a discrete positive finite measure F ′ on
[0, 1] such that
∥g0 − gF ′ ∥∞ ≤ ϵn , F ′ ([0, 1]) = F ([0, 1]).
Now divide [0, 1] into bins with width ϵn , then the number of sample points xte
j that fall
in a bin is a binomial random variable. If exp(−η2 nϵn /4)/ϵn → 0, then by the Chernoff
bound6 , the probability of the event
converges to 1 (supp(F ′ ) means the support of F ′ ) because the density p(x) is bounded
√
from below across the support. One can show that |K1 (x, x1 )−K1 (x, x2 )| ≤ |x1 −x2 |/ e+
|x1 − x2 |2 /2 (∀x) because
g̃n∗
gn∗ := .
Qn g̃n∗
This indicates √
hQ (gn∗ , g0 ) = Op (1/ n),
and that g0 /gn∗ ≤ c20 is satisfied with high probability.
For the bias term of Theorem 1, set ϵn = C log(n)/n for sufficiently large C > 0 and
replace g0 with an0 g0 . Then we obtain γn = Op (log(n)/n).
6
Here we refer to the Chernoff
∑n bound as follows:
∑n let {Xi }ni=1 be independent
∑n random variables taking
values on 0 or 1, then P ( i=1 Xi < (1 − δ) i=1 E[Xi ]) < exp(−δ 2 i=1 E[Xi ]/2) for any δ > 0.
Direct Importance Estimation for Covariate Shift Adaptation 14
As for the complexity of the model, a similar argument to Theorem 3.1 of Ghosal and
van der Vaart (2001) gives
( )2
M
log N (ϵ, G , ∥ · ∥∞ ) ≤ K log
M
ϵ
for 0 < ϵ < M/2. This gives both conditions (8) and (9) of Assumption 1.3 for arbitrary
small γ > 0 (but the constant K depends on γ). Thus the convergence rate is evaluated
as hQ (g0 , ĝn ) = Op (n−1/(2+γ) ) for arbitrary small γ > 0.
Let
ψ(α)(x) = ψ(α) := log(αT φ(x)).
Note that if Q(φφT ) ≻ O is satisfied, then we obtain the following inequality:
φT φφT
∀β ̸= 0, β T ∇∇T P ψ(α∗ )β = β T ∇P β = −β T
P β
αT φ α=α∗ (α∗T φ)2
( )
T g0
= −β Q φφ 2 β ≤ −β T Q(φφT )βη0 ϵ20 /ξ02 < 0.
T
g∗
Direct Importance Estimation for Covariate Shift Adaptation 15
We set
α̂n
α̌n := ,
an∗
−1
√
where an∗ := (Qn g∗ )√ and α̂nT φ = ĝn . We first show the n-consistency of α̂n /an∗ (i.e.,
∥α̌n − α∗ ∥ = Op (1/ n)). From now on, let ∥ · ∥0 denote a norm defined as
∥α∥20 := αT I0 α.
S := {α | QαT φ = 1, α ≥ 0},
Sn := {α | Qn αT φ = 1/an∗ , α ≥ 0}.
Now S and Sn are convex polytopes, so that the approximating cones at α∗ are also
convex polytopes and
C = {λ(α − α∗ ) | α ∈ S, λ ≥ 0, λ ∈ R},
Cn = {λ(α − α∗ ) | α ∈ Sn , λ ≥ 0, λ ∈ R},
for a sufficiently small ϵ. Without loss of generality, we assume for some j, α∗,i = 0 (i =
1, . . . , j) and α∗,i > 0 (i = j + 1, . . . , b). Let νi := Qφi . Then the approximating cone C
is spanned by µi (i = 1, . . . , b − 1) defined as
[ ]T [ ]T
ν1 νb−1
µ1 := 1, 0, . . . , 0, − , . . . , µb−1 := 0, . . . , 0, 1, − .
νb νb
That is, { b−1 }
∑
C= βi µi | βi ≥ 0 (i ≤ j), βi ∈ R .
i=1
Let N (µ, Σ) be a multivariate normal distribution with mean µ and covariance Σ; we use
the same notation for a degenerate normal distribution (i.e., the Gaussian distribution
confined to the range
√ of a rank deficient covariance matrix Σ). Then we obtain the
asymptotic law of n(α̌n − α∗ ).
The proof is provided in Appendix B. If α∗ > 0 (α∗ is an inner point of the feasible
set), asymptotic normality can be proven in a simpler way. Set Rn and R as follows:
Qn φQn φT QφQφT
Rn := I − , R := I − .
∥Qn φ∥2 ∥Qφ∥2
where † means the Moore-Penrose pseudo-inverse and in the third equality we used the
relation ∇P ψ(α∗ ) − Qφ = 0 according to the KKT condition. On the other hand, since
δ = Rδ for δ ∈ C, we have
∥Z − δ∥20 =(Z − δ)T I0 (Z − δ) = (Z − Rδ)T I0 (Z − Rδ)
=(δ − (RI0 R)† RI0 Z)T RI0 R(δ − (RI0 R)† RI0 Z)
+ (the terms independent of δ).
The minimizer of the right-hand side of the above equality in C is δ = (RI0 R)† RI0 Z. This
and the result of Theorem 3 coincide with (13). √
In addition to Theorem 3 we can show the asymptotic law of n(α̂n − α∗ ). The proof
is also given in Appendix B.
The second term of the right-hand side is expressed by (Z T I0 α∗ )α∗ = (Z2T α∗ )α∗ .
Remark 3 By the KKT condition and the definition of I0 , it can be easily checked that
α∗T I0 δ = 0 (∀δ ∈ C ∩ {δ ′ | λT ′
∗ δ = 0}), ∥α∗ ∥0 = α∗T I0 α∗ = 1.
√
Thus Theorem 4 gives an orthogonal decomposition of the asymptotic law of n(α̂n − α∗ )
to a parallel part and an orthogonal part to C ∩ {δ ′ | λT ′
∗ δ = 0}. Hence in particular, if
α∗ > 0, then λ∗ = 0 and C is a linear subspace so that
√
n(α̂n − α∗ ) Z.
4 Illustrative Examples
We have shown that the KLIEP algorithm has preferable convergence properties. In this
section, we illustrate the behavior of the proposed KLIEP method and how it can be
applied in covariate shift adaptation.
4.1 Setting
Let us consider a one-dimensional toy regression problem of learning
f (x) = sinc(x).
Let the training and test input densities be
ptr (x) = N (x; 1, (1/2)2 ),
pte (x) = N (x; 2, (1/4)2 ),
Direct Importance Estimation for Covariate Shift Adaptation 18
1.6 ptr(x)
f(x)
pte(x) 1.5
1.4 Training
Test
1.2
1
1
0.8 0.5
0.6
0
0.4
0.2
−0.5
0
−0.5 0 0.5 1 1.5 2 2.5 3 −0.5 0 0.5 1 1.5 2 2.5 3
x x
(a) Training input density ptr (x) and test input (b) Target function f (x), training sam-
density pte (x) ples {(xtr tr ntr
i , yi )}i=1 , and test samples
{(xte te n
j , yj )}j=1 .
te
where N (x; µ, σ 2 ) denotes the Gaussian density with mean µ and variance σ 2 . We create
training output value {yitr }ni=1
tr
by
yitr = f (xtr tr
i ) + ϵi ,
generated in the same way. Let the number of training samples be ntr = 200 and the
number of test samples be nte = 1000. The goal is to obtain a function fb(x) such that
the following generalization error G (or the mean test error) is minimized:
nte ( )2
1 ∑
G := fb(xte
j ) − y te
j . (14)
nte j=1
This setting implies that we are considering a (weak) extrapolation problem (see Fig-
ure 2, where only 100 test samples are plotted for clear visibility).
Figure 3 depicts the true importance and its estimates by KLIEP; the Gaussian kernel
model (7) with b = 100 is used and three different Gaussian widths are tested. The
graphs show that the performance of KLIEP is highly dependent on the Gaussian width;
b
the estimated importance function w(x) is highly fluctuated when σ is small, while it is
overly smoothed when σ is large. When σ is chosen appropriately, KLIEP seems to work
reasonably well for this example.
Direct Importance Estimation for Covariate Shift Adaptation 19
w(x) w(x)
^ 25 ^ (x)
50 w (x) w
^ tr ^ (x tr)
w
w (x i ) i
40 20
30 15
20 10
10 5
0 0
−0.5 0 0.5 1 1.5 2 2.5 3 −0.5 0 0.5 1 1.5 2 2.5 3
x x
w(x)
25 ^ (x)
w
^ (xtr )
w i
20
15
10
0
−0.5 0 0.5 1 1.5 2 2.5 3
x
Figure 3: Results of importance estimation by KLIEP. w(x) is the true importance func-
b
tion and w(x) is its estimation obtained by KLIEP.
Figure 4 depicts the values of the true J (see Eq.(3)) and its estimate by 5-fold LCV
(see Eq.(5)); the means, the 25 percentiles, and the 75 percentiles over 100 trials are
plotted as functions of the Gaussian width σ. This shows that LCV gives a very good
estimate of J, which results in an appropriate choice of σ.
2.6
J
2.4 ^
J LCV
2.2
1.8
1.6
1.4
1.2
0.8
0.02 0.2 0.5 0.8
σ (Gaussian Width)
Figure 4: Model selection curve for KLIEP. J is the true score of an estimated importance
(see Eq.(3)) and JbLCV is its estimate by 5-fold LCV (see Eq.(5)).
∑
t
fb(x; θ) := θi xℓ , (15)
ℓ=0
It is known that IWLS is consistent when the true importance w(xtr i ) is used as weights—
ordinary LS is not consistent due to covariate shift, given that the model fb(x; θ) is not
correctly specified8 (Shimodaira, 2000). For the linear regression model (15), the above
minimizer θbIWLS is given analytically by
bIWLS = (X ⊤ W
θ c X)−1 X ⊤ W
c y,
where
[X]i,ℓ = (xtr
i )
ℓ−1
,
( )
c = diag w(x
W b tr b tr b tr
1 ), w(x 2 ), . . . , w(x ntr ) ,
y = (y1tr , y2tr , . . . , yntrtr )⊤ . (16)
8
A model fb(x; θ) is said to be correctly specified if there exists a parameter θ ∗ such that fb(x; θ ∗ ) =
f (x).
Direct Importance Estimation for Covariate Shift Adaptation 21
{Zjtr }j̸=r by IWLS and compute its mean test error for the remaining samples Zrtr :
1 ∑ ( )2
br :=
G b
w(x) fbr (x) − y .
|Zrtr |
(x,y)∈Zrtr
∑ R
b := 1
G br .
G (17)
R r=1
For model selection, we compute G b for all model candidates (the order t of polynomials
in the current setting) and choose the one that minimizes G. b We set the number of folds
in IWCV at R = 5. IWCV is shown to be unbiased, while ordinary CV with misspecified
models is biased due to covariate shift (Sugiyama et al., 2007).
Figure 5 depicts the functions learned by IWLS with different orders of polynomials.
The results show that for all cases, the learned functions reasonably go through the test
samples (note that the test output points are not used for obtaining the learned functions).
Figure 6(a) depicts the true generalization error of IWLS and its estimate by IWCV; the
means, the 25 percentiles, and the 75 percentiles over 100 runs are plotted as functions
of the order of polynomials. This shows that IWCV roughly grasps the trend of the true
generalization error. For comparison purposes, we also include the results by ordinary LS
and ordinary CV in Figure 5 and Figure 6. Figure 5 shows that the functions obtained by
ordinary LS go through the training samples, but not through the test samples. Figure 6
shows that the scores of ordinary CV tend to be biased, implying that model selection by
ordinary CV is not reliable.
Finally, we compare the generalization error obtained by IWLS/LS and IWCV/CV,
which is summarized in Figure 7 as box plots. This shows that IWLS+IWCV tends
to outperform other methods, illustrating the usefulness of the proposed approach in
covariate shift adaptation.
5 Discussion
In this section, we discuss the relation between KLIEP and existing approaches.
Direct Importance Estimation for Covariate Shift Adaptation 22
f(x) f(x)
1.5 ^
1.5
^
f (x) fIWLS (x)
IWLS
^ ^
f (x) f (x)
LS LS
1 Training 1 Training
Test Test
0.5 0.5
0 0
−0.5 −0.5
1.5 f(x)
^
f (x)
IWLS
^
f (x)
LS
1 Training
Test
0.5
−0.5
Figure 5: Learned functions obtained by IWLS and LS, which are denoted by fbIWLS (x)
and fbLS (x), respectively.
1 ∑n
pb(x) = Kσ (x, xk ), (18)
n(2πσ 2 )d/2 k=1
0.18 0.4
G G
^ ^
G IWCV 0.35 G IWCV
0.16
^ ^
G CV G CV
0.3
0.14
0.25
0.12
0.2
0.1
0.15
0.08 0.1
0.06 0.05
1 2 3 1 2 3
t (Order of Polynomials) t (Order of Polynomial)
Figure 6: Model selection curves for IWLS/LS and IWCV/CV. G denotes the true gen-
bIWCV and G
eralization error of a learned function (see Eq.(14)), while G bCV denote its
estimate by 5-fold IWCV and 5-fold CV, respectively (see Eq.(17)).
0.35
95%
0.3
0.25
0.2
75%
0.15
50%
0.1 25%
5%
0.05
IWLS+IWCV IWLS+CV LS+IWCV LS+CV
that model selection based on LCV corresponds to choosing σ such that the Kullback-
Leibler divergence from p(x) to pb(x) is minimized.
KDE can be used for importance estimation by first estimating pbtr (x) and pbte (x)
separately from {xtr i }i=1 and {xj }j=1 , and then estimating the importance by w(x)
ntr te nte
b =
pbte (x)/b
ptr (x). A potential limitation of this approach is that KDE suffers from the curse
of dimensionality (Härdle et al., 2004), i.e., the number of samples needed to maintain
the same approximation quality grows exponentially as the dimension of the input space
increases. Furthermore, model selection by LCV is unreliable in small sample cases since
data splitting in the CV procedure further reduces the sample size. Therefore, the KDE-
based approach may not be reliable in high-dimensional cases.
Direct Importance Estimation for Covariate Shift Adaptation 24
where ∥ · ∥H denotes the norm in the Gaussian reproducing kernel Hilbert space and
Kσ (x, x′ ) is the Gaussian kernel (6) with width σ.
An empirical version of the above problem is reduced to the following quadratic pro-
gram:
[ n ]
1 ∑ ∑
tr ntr
i , xi′ ) −
wi wi′ Kσ (xtr tr
min wi κi
{wi }i=1 2 ′
ntr
i,i =1 i=1
∑
ntr
subject to wi − ntr ≤ ntr ϵ and 0 ≤ w1 , w2 , . . . , wntr ≤ B,
i=1
where
ntr ∑
nte
κi := Kσ (xtr te
i , xj ).
nte j=1
B (≥ 0) and ϵ (≥ 0) are tuning parameters which control the regularization effects. The
solution {wbi }ni=1
tr
is an estimate of the importance at the training input points {xtr
i }i=1 .
ntr
Since KMM does not involve density estimation, it is expected to work well even in
high-dimensional cases. However, the performance is dependent on the tuning parame-
ters B, ϵ, and σ, and they can not be simply optimized, e.g., by CV since estimates of
the importance are available only at the training input points. Thus, an out-of-sample
extension is needed to apply KMM in the CV framework, but this seems to be an open
research issue currently.
A relation between KMM and a variant of KLIEP has been studied in Tsuboi et al.
(2008).
samples, i.e., the training and test input densities are written as
An application of the Bayes theorem immediately yields that the importance can be
expressed in terms of δ as follows (Bickel et al., 2007):
The probability ratio of test and training samples may be simply estimated by the ratio
of the numbers of samples:
p(δ = −1) ntr
≈ .
p(δ = 1) nte
The conditional probability p(δ|x) could be approximated by discriminating test samples
from training samples using a logistic regression (LogReg) classifier, where δ plays the
role of a class variable. Below, we briefly explain the LogReg method.
The LogReg classifier employs a parametric model of the following form for expressing
the conditional probability p(δ|x):
1
pb(δ|x) := ∑u ,
1 + exp (−δ ℓ=1 βℓ ϕℓ (x))
where u is the number of basis functions and {ϕℓ (x)}uℓ=1 are fixed basis functions. The
parameter β is learned so that the negative log-likelihood is minimized:
[ n ( ( u ))
∑ tr ∑
b := argmin
β log 1 + exp tr
βℓ ϕℓ (x ) i
β i=1
( (
ℓ=1
)) ]
∑nte ∑
u
+ log 1 + exp − βℓ ϕℓ (xtr
j ) .
j=1 ℓ=1
Since the above objective function is convex, the global optimal solution can be ob-
tained by standard nonlinear optimization methods such as Newton’s method, conjugate
gradient, or the BFGS method (Minka, 2007). Then the importance estimate is given by
( u )
ntr ∑
b
w(x) = exp βbℓ ϕℓ (x) .
nte ℓ=1
An advantage of the LogReg method is that model selection (i.e., the choice of basis
functions {ϕℓ (x)}uℓ=1 ) is possible by standard CV, since the learning problem involved
above is a standard supervised classification problem.
Direct Importance Estimation for Covariate Shift Adaptation 26
6 Experiments
In this section, we compare the experimental performance of KLIEP and existing ap-
proaches.
pte (xtr
i )
wi := w(xtr
i ) = tr
for i = 1, 2, . . . , ntr .
ptr (xi )
KLIEP(CV): The kernel width σ in KLIEP is chosen based on 5-fold LCV (see Sec-
tion 2.3).
LogReg(σ): Gaussian kernels (7) are used as basis functions, where kernels are put at all
training and test input points9 . Since the performance of LogReg is dependent on
the kernel width σ, we test several different values of σ. We used the LIBLINEAR
implementation of logistic regression for the experiments (Lin et al., 2007).
We fixed the number of test input points at nte = 1000 and consider the following two
settings for the number ntr of training samples and the input dimension d:
NMSEs averaged over 100 trials are plotted in log scale in Figure 8. Figure 8(a)
shows that the error of KDE(CV) sharply increases as the input dimension grows, while
KLIEP, KMM, and LogReg with appropriate kernel widths tend to give smaller errors
than KDE(CV). This would be the fruit of directly estimating the importance without
going through density estimation. The graph also shows that the performance of KLIEP,
KMM, and LogReg is dependent on the kernel width σ—the results of KLIEP(CV) and
LogReg(CV) show that model selection is carried out reasonably well. Figure 9(a) sum-
marizes the results of KLIEP(CV), KDE(CV), and LogReg(CV), where, for each input
dimension, the best method in terms of the mean error and comparable ones based on
the t-test at the significance level 5% are indicated by ‘◦’; the methods with significant
difference from the best method are indicated by ‘×’. This shows that KLIEP(CV) works
significantly better than KDE(CV) and LogReg(CV).
Figure 8(b) shows that the errors of all methods tend to decrease as the number
of training samples grows. Again, KLIEP, KMM, and LogReg with appropriate kernel
widths tend to give smaller errors than KDE(CV), and model selection in KLIEP(CV)
and LogReg(CV) is shown work reasonably well. Figure 9(b) shows that KLIEP(CV)
tends to give significantly smaller errors than KDE(CV) and LogReg(CV).
Overall, KLIEP(CV) is shown to be a useful method in importance estimation.
regressors or classifiers; the test output values {yj }j=1 are used only for evaluating the
te nte
generalization performance.
Direct Importance Estimation for Covariate Shift Adaptation 28
KLIEP(0.5)
KLIEP(2)
KLIEP(7)
Average NMSE over 100 Trials (in Log Scale)
KLIEP(CV)
−3 KDE(CV)
10
KMM(0.1)
KMM(1)
KMM(10)
LogReg(0.5)
LogReg(2)
−4
10 LogReg(7)
LogReg(CV)
−5
10
−6
10
2 4 6 8 10 12 14 16 18 20
d (Input Dimension)
KLIEP(0.5)
KLIEP(2)
−3 KLIEP(7)
10
Average NMSE over 100 Trials (in Log Scale)
KLIEP(CV)
KDE(CV)
KMM(0.1)
KMM(1)
KMM(10)
−4 LogReg(0.5)
10
LogReg(2)
LogReg(7)
LogReg(CV)
−5
10
−6
10
50 100 150
ntr (Number of Training Samples)
−3
10
KLIEP(CV)
KDE(CV)
LogReg(CV)
Average NMSE over 100 Trials (in Log Scale)
−4
10
−5
10
−6
10
2 4 6 8 10 12 14 16 18 20
d (Input Dimension)
−4
10
−5
10
−6
10
50 100 150
ntr (Number of Training Samples)
Figure 9: NMSEs averaged over 100 trials in log scale. For each dimension/number of
training samples, the best method in terms of the mean error and comparable ones based
on the t-test at the significance level 5% are indicated by ‘◦’; the methods with significant
difference from the best method are indicated by ‘×’.
Direct Importance Estimation for Covariate Shift Adaptation 30
∑
t
fb(x; θ) := θℓ Kh (x, mℓ ),
ℓ=1
where Kh (x, x′ ) is the Gaussian kernel (6) with width h and mℓ is a template point
randomly chosen from {xte j }j=1 . We set the number of kernels
nte 10
at t = 50. We learn the
parameter θ by importance-weighted regularized least-squares (IWRLS) (Sugiyama et al.,
2007): [n ]
∑tr ( )2
bIWRLS := argmin b tr b tr
i ) f (xi ; θ) − yi
tr
θ w(x + λ∥θ∥2 . (19)
θ
i=1
[K]i,ℓ := Kh (xtr
i , mℓ ),
c := diag (w
W b1 , w
b2 , . . . , w
bntr ) .
The kernel width h and the regularization parameter λ in IWRLS (19) are chosen by
5-fold IWCV. We compute the IWCV score by
1∑ 1
5 ∑ ( )
b
w(x)L fbr (x), y ,
5 r=1 |Zrtr |
(x,y)∈Zrtr
where Zrtr is the r-th held-out sample set (see Section 4.3) and
{
(by − y)2 (Regression),
L (b
y , y) := 1
2
(1 − sign{b
y y}) (Classification).
We run the experiments 100 times for each dataset and evaluate the mean test error :
1 ∑
nte ( )
L fb(xte
j ), y te
j .
nte j=1
The results are summarized in Table 1, where ‘Uniform’ denotes uniform weights, i.e., no
importance weight is used. The table shows that KLIEP(CV) compares favorably with
Uniform, implying that the importance weighting techniques combined with KLIEP(CV)
10
We fixed the number of kernels at a rather small number since we are interested in investigating the
prediction performance under model misspecification; for over-specified models, importance-weighting
methods have no advantage over the no importance method.
Direct Importance Estimation for Covariate Shift Adaptation 31
Table 1: Mean test error averaged over 100 trials. The numbers in the brackets are
the standard deviation. All the error values are normalized so that the mean error by
‘Uniform’ (uniform weighting, or equivalently no importance weighting) is one. For each
dataset, the best method and comparable ones based on the Wilcoxon signed rank test at
the significance level 5% are described in bold face. The upper half are regression datasets
taken from DELVE (Rasmussen et al., 1996) and the lower half are classification datasets
taken from IDA (Rätsch et al., 2001). ‘KMM(σ)’ denotes KMM with kernel width σ.
KLIEP KDE KMM KMM KMM LogReg
Data Dim Uniform
(CV) (CV) (0.01) (0.3) (1) (CV)
kin-8fh 8 1.00(0.34) 0.95(0.31) 1.22(0.52) 1.00(0.34) 1.12(0.37) 1.59(0.53) 1.38(0.40)
kin-8fm 8 1.00(0.39) 0.86(0.35) 1.12(0.57) 1.00(0.39) 0.98(0.46) 1.95(1.24) 1.38(0.61)
kin-8nh 8 1.00(0.26) 0.99(0.22) 1.09(0.20) 1.00(0.27) 1.04(0.17) 1.16(0.25) 1.05(0.17)
kin-8nm 8 1.00(0.30) 0.97(0.25) 1.14(0.26) 1.00(0.30) 1.09(0.23) 1.20(0.22) 1.14(0.24)
abalone 7 1.00(0.50) 0.97(0.69) 1.02(0.41) 1.01(0.51) 0.96(0.70) 0.93(0.39) 0.90(0.40)
image 18 1.00(0.51) 0.94(0.44) 0.98(0.45) 0.97(0.50) 0.97(0.45) 1.09(0.54) 0.99(0.47)
ringnorm 20 1.00(0.04) 0.99(0.06) 0.87(0.04) 1.00(0.04) 0.87(0.05) 0.87(0.05) 0.93(0.08)
twonorm 20 1.00(0.58) 0.91(0.52) 1.16(0.71) 0.99(0.50) 0.86(0.55) 0.99(0.70) 0.92(0.56)
waveform 21 1.00(0.45) 0.93(0.34) 1.05(0.47) 1.00(0.44) 0.93(0.32) 0.98(0.31) 0.94(0.33)
Average 1.00(0.38) 0.95(0.35) 1.07(0.40) 1.00(0.36) 0.98(0.37) 1.20(0.47) 1.07(0.36)
are useful for improving the prediction performance under covariate shift. KLIEP(CV)
works much better than KDE(CV); actually KDE(CV) tends to be worse than Uniform,
which may be due to high dimensionality. We tested 10 different values of the kernel
width σ for KMM and described three representative results in the table. KLIEP(CV)
is slightly better than KMM with the best kernel width. Finally, LogReg(CV) is overall
shown to work reasonably well, but it performs very poorly for some datasets. As a result,
the average performance is not good.
Overall, we conclude that the proposed KLIEP(CV) is a promising method for covari-
ate shift adaptation.
7 Conclusions
In this paper, we addressed the problem of estimating the importance for covariate shift
adaptation. The proposed method, called KLIEP, does not involve density estimation so it
is more advantageous than a naive KDE-based approach particularly in high-dimensional
problems. Compared with KMM which also directly gives importance estimates, KLIEP
is practically more useful since it is equipped with a model selection procedure. Our
experiments highlighted these advantages and therefore KLIEP is shown to be a promising
method for covariate shift adaptation.
In KLIEP, we modeled the importance function by a linear (or kernel) model, which
resulted in a convex optimization problem with a sparse solution. However, our framework
allows the use of any models. An interesting future direction to pursue would be to search
for a class of models which has additional advantages, e.g., faster optimization (Tsuboi
Direct Importance Estimation for Covariate Shift Adaptation 32
et al., 2008).
LCV is a popular model selection technique in density estimation and we used a vari-
ant of LCV for optimizing the Gaussian kernel width in KLIEP. In density estimation,
however, it is known that LCV is not consistent under some condition (Schuster and Gre-
gory, 1982; Hall, 1987). Thus it is important to investigate whether a similar inconsistency
phenomenon is observed also in the context of importance estimation.
We used IWCV for model selection of regressors or classifiers under covariate shift.
IWCV has smaller bias than ordinary CV and the model selection performance was shown
to be improved by IWCV. However, the variance of IWCV tends to be larger than ordinary
CV (Sugiyama et al., 2007) and therefore model selection by IWCV could be rather
unstable. In practice, slightly regularizing the importance weight involved in IWCV can
ease the problem, but this introduces an additional tuning parameter. Our important
future work in this context is to develop a method to optimally regularize IWCV, e.g.,
following the line of Sugiyama et al. (2004).
Finally, the range of application of importance weights is not limited to covariate shift
adaptation. For example, the density ratio could be used for anomaly detection, feature
selection, independent component analysis, and conditional density estimation. Exploring
possible application areas will be important future directions.
an
We set g ′ := Since Qn g ′ = Qn g0 = 1/an0 ,
0 g0 +ĝn
2an
.
0
( )
ĝn + an0 g0 γn
− Pn log n
− ≤0
2a0 g0 2
( ′)
′ g γn
⇒ (Qn − Q)(g − g0 ) − (Pn − P ) log −
g0 2
( ′)
g
≤ −Q(g ′ − g0 ) + P log
g0
(√ )
g′ ( √ )
≤ 2P − 1 − Q(g ′ − g0 ) = Q 2 g ′ g0 − 2g0 − Q(g ′ − g0 )
g0
( √ )
′ ′
= Q 2 g g0 − g − g0 = −hQ (g ′ , g0 )2 . (20)
The Hellinger distance between ĝn /an0 and g0 has the following bound (see Lemma 4.2 in
van de Geer, 2000):
1
hQ (ĝn /an0 , g0 ) ≤ hQ (g ′ , g0 ).
16
( ′)
Thus it is sufficient to bound |(Qn − Q)(g ′ − g0 )| and |(Pn − P ) log gg0 | from above.
From now on, we consider the case where the inequality (8) in Assumption 1.3 is
satisfied. The proof for the setting of the inequality (9) can be carried out along the line
′
of Nguyen et al. (2007). ) will utilize the Bousquet bound (10) to bound |(Qn − Q)(g −
( ′ We
g0 )| and |(Pn −P ) log gg0 |. In the following, we prove the assertion in 4 steps. In the first
( ′)
′
and second steps, we derive upper bounds of |(Qn − Q)(g − g0 )| and |(Pn − P ) log gg0 |,
respectively. In the third step, we bound the ∞-norm of ĝn which is needed to prove the
convergence. Finally, we combine the results of Steps 1 to 3 and obtain the assertion.
The following statements heavily rely on Koltchinskii (2006).
√
where ∥f ∥Q,2 := Qf 2 .
Next, we define the “diameter” of a set {g − g0 | g ∈ GnM (δ)} as
√
D̃M (δ) := sup Q(g − g0 )2 = sup ∥g − g0 ∥Q,2 .
M (δ)
g∈Gn M (δ)
g∈Gn
It is obvious that
√
D̃M (δ) ≥ sup Q(g − g0 )2 − (Q(g − g0 ))2 .
M (δ)
g∈Gn
which implies √
D̃M (δ) ≤ (M + 3η1 )δ =: DM (δ).
So, by the inequality (21), we obtain
[ ]
EQ sup |(Qn − Q)(g − g0 )| ≤ CϕM M
n (D (δ))
M (δ)
g∈Gn
( )
δ (1−γ/2)/2 δ 1/2
≤ CM √ ∨ n−2/(2+γ) ∨ √ ,
n n
Then, by Lemma 3, there exists KM for all M > 1 such that for
[ √ ]
M t t
Un,t (δ) := KM ϕM M
n (D (δ)) + DM (δ) + ,
n n
δ ≥δ
δj g0
j
i.e., there exists a constant K̃M that depends on K, M , γ, η1 , and η0 such that
P (ẼδM ) ≥ 1 − e−t ,
where ẼδM is an event defined by
{ }
M
Ẽn,δ := sup |(Pn − P )f | ≤ Ũn,t
M
(δ) ,
f ∈H̃δM
and [ √ ]
M t M t
Ũn,t (δ) := K̃M ϕM M
n (D (δ)) + D (δ) + .
n n
Then by Lemma 4, we can take a sufficiently large M̄ such that g/an0 ∈ GnM̄ (∀g ∈ Ĝn ) on
the event Sn and Q(Sn ) → 1.
g δj M̄
sup (Pn − P ) log ≤ Ũn,t (δ) ≤ δj Ṽn,t
M̄
(δ). (23)
M̄ (δ )
g∈Gn j
g0 δ
Let
GnM̄ (a, b) := GnM̄ (b)\GnM̄ (a) (a < b).
Here, we assume ι(ĝn /an0 ) ∈ GnM̄ (δj−1 , δj ). Then we will derive a contradiction. In these
settings, for g ′ := ι(ĝn /an0 ),
g′ g′ γn
δj−1 ≤ |Q(g ′ − g0 ) + P log | ≤ |(Qn − Q)(g ′ − g0 )| + |(Pn − P ) log | +
g0 g0 2
γn
≤ δj Vn,t
M̄ M̄
(δ) + δj Ṽn,t (δ) + ,
2
which implies
3 1 γn
≤ − ≤ Vn,t
M̄ M̄
(δ) + Ṽn,t (δ). (24)
4q q 2δj
M̄ M̄ 3
So, either Vn,t (δ) or Ṽn,t (δ) is greater than 8q . This contradicts the definition of the
#-transform.
We can show that δnM̄ (t) ∨ δ̃nM̄ (t) = O(n− 2+γ t). To see this, for some s > 0, set
2
( (1−γ/2)/2 )# ( 1/2 )#
δ ( −2/(2+γ) )# δ
δ̂1 = √ (s), δ̂2 = n (s), δ̂3 = √ (s),
n n
(√ )# ( )#
t t
δ̂4 = δ (s), δ̂5 = (s),
n n
where all the #-transforms are taken with respect to δ. Then they satisfy
√
(1−γ/2)/2 √ −2/(2+γ) 1/2 √ δ̂4 t/n
δ̂ / n n δ̂ / n t/n
s= 1 , s= , s= 3 , s= , s= .
δ̂1 δ̂2 δ̂3 δ̂4 δ̂5
Thus, by using some constants c1 , . . . , c4 , we obtain
δ̂1 = c1 n−2/(2+γ) , δ̂2 = c2 n−2/(2+γ) , δ̂3 = c3 n−1 , δ̂4 = c4 t/n, δ̂5 = c5 t/n.
16
In the following, we show lemmas used in the proof of Theorem 1. We use the same
notations as those in the proof of Theorem 1.
Proof
This lemma can be shown along a similar line to Mendelson (2002), but we shall pay
attention to the point that F may not contain the constant function 0. Let (ϵi )1≤i≤n be
i.i.d. Rademacher random variables, i.e., P (ϵi = 1) = P (ϵi = −1) = 1/2, Rn (F) be the
Rademacher complexity of F defined as
1 ∑ n
Rn (F) = EQ Eϵ sup | ϵi f (xtr
i )|.
n f ∈F i=1
Set δ̂ 2 = supf ∈F Qn f 2 . Then noticing that log N (ϵ, F ∪ {0}, L2 (Qn )) ≤ ϵTγ + 1, it can be
shown that there is a universal constant C such that
∑n ∫ δ̂ √
1 C
Eϵ sup ϵi f (xi ) ≤ √
tr
1 + log N (ϵ, F, L2 (Qn ))dϵ
n f ∈F i=1 n 0
( √ )
C T
≤√ δ̂ 1−γ/2 + δ̂ . (27)
n 1 − γ/2
See van der Vaart and Wellner (1996) for detail. Taking the expectation with respect Q
and employing Jensen’s inequality and (26), we obtain
CT,γ [( 2 )(1−γ/2)/2 ( 2 )1/2 ]
Rn (F) ≤ √ δ + Rn (F) + δ + Rn (F) ,
n
Direct Importance Estimation for Covariate Shift Adaptation 38
Lemma 3 For all M > 1, there exists KM depending on γ, η1 , q, and K such that
( [ √ ])
t M t
Q sup |(Qn − Q)g| ≥ KM ϕn (D (δ)) +
M M
D (δ) + ≤ e−t .
g∈HδM n n
Proof
Since ϕM M M
n (D (δ))/δ and D (δ)/δ are monotone decreasing, we have
[ ] [ ]
∑ δ
E sup |(Qn − Q)f | ≤ E sup |(Qn − Q)(g − g0 )|
f ∈HδM δ ≥δ
δj M (δ )
g∈Gn j
j
∑ δ ∑ δ ϕM M
n (D (δj ))
≤ Cϕn (D (δj )) ≤
M M
′C ′
δ ≥δ
j
δj δ 1−γ
δ ≥δ j j
δjγ
∑ δ ϕM M ∑ δ 1−γ ′
n (D (δ))
≤ ′C
M
= Cϕn (D (δ))M
′
δj ≥δ j
δ 1−γ δγ′ δ 1−γ
δj ≥δ j
∑ ′
≤ CϕM n (D M
(δ)) q −j(1−γ ) = cγ,q ϕM M
n (D (δ)), (30)
j≥0
DM (δj ) DM (δ)
≤ δ sup ≤δ = DM (δ). (31)
δj ≥δ δ j δ
Using the Bousquet bound, we obtain
( [ √ ])
ϕM (DM (δ)) t DM (δ) t
Q sup |(Qn − Q)g|/M ≥ C cγ,q n + + ≤ e−t ,
g∈HδM M n M n
where C is some universal constant. Thus, there exists KM for all M > 1 such that
( [ √ ])
t t
Q sup |(Qn − Q)g| ≥ KM ϕM M
n (D (δ)) + DM (δ) + ≤ e−t .
M
g∈Hδ n n
Direct Importance Estimation for Covariate Shift Adaptation 39
Lemma 4 For an event Sn := {inf φ∈Fn Qn φ ≥ ϵ0 /2} ∩ {3/4 < an0 < 5/4}, we have
Q (Sn ) → 1.
Moreover, there exists a sufficiently large M̄ > 0 such that g/an0 ∈ GnM̄ (∀g ∈ Ĝn ) on the
event Sn .
Proof
It is obvious that ( )
1
(Qn − Q)g0 = Op √ .
n
Thus, because of Qg0 = 1, ( )
1
an0 = 1 + Op √ .
n
Moreover, Assumption 1.3 implies
( )
1
∥Qn − Q∥Fn = Op √ .
n
Thus, √
inf Qn φ ≥ ϵ0 − Op (1/ n),
φ∈Fn
implying { }
Q(S̄n ) → 1 for S̄n := inf Qn φ ≥ ϵ0 /2 .
φ∈Fn
On the event Sn , all the elements of Ĝn is uniformly bounded from above:
∑ ∑ ∑
1 = Qn ( αl φ l ) = αl Qn (φl ) ≥ αl ϵ0 /2
l l l
∑
⇒ αl ≤ 2/ϵ0 .
l
Set M̃ = 2ξ0 /ϵ0 , then on the event Sn , Ĝn ⊂ GnM̃ is always satisfied. Since an0 is bounded
from above and below on the event Sn , we can take a sufficiently large M̄ > M̃ such that
g/an0 ∈ GnM̄ (∀g ∈ Ĝn ).
Direct Importance Estimation for Covariate Shift Adaptation 40
If (1 + c0 )hQ (g0 , gn∗ )hQ (g ′ , gn∗ ) ≥ |δn |, the assertion immediately follows. Otherwise we can
apply the same arguments as Theorem 1 replacing g0 with gn∗ .
Thus , we have
( ) ( )
′ g′ g′
− log Qg − (Pn − P ) log ≤ P log ≤ 0. (33)
g∗ Q(g ′ )g∗
In a finite dimensional situation, the inequality (8) is satisfied with arbitrary γ > 0; see
Lemma 2.6.15 in van der Vaart and Wellner (1996). Thus, we can show that the left-hand
side of (33) converges
( T to
) 0 in probability in a similar way to the proof of Theorem 1. This
p
and ∇∇P log α φ+g∗
2g∗
= −I0 /4 ≺ O give α̂n → α∗ .
√ α=α∗
Next we prove n-consistency. By the KKT condition, we have
with the Lagrange multiplier λ̂, λ∗ ∈ Rb and ŝ, s∗ ∈ R (note that KLIEP “maximizes”
Pn ψ(α), thus λ̂ ≤ 0). Noticing that ∇ψ(α) = αTφφ , we obtain
(α̌n − α∗ )T λ∗ = 0
goes to 1. In particular
√ (α̌n − α∗ )T λ∗ = op (1/n).
Set Zn′ := n(∇Pn ψ(α∗ ) − Qn φ − (∇P ψ(α∗ ) − Qφ)). By the optimality and consis-
tency of α̌n , we obtain
0 ≤Pn ψ(α̌n ) − Pn ψ(α∗ )
1 ( )
=(α̌n − α∗ )T ∇Pn ψ(α∗ ) − (α̌n − α∗ )T I0 (α̌n − α∗ ) + op ∥α̌n − α∗ ∥2
2
Z ′
1 ( )
=(α̌n − α∗ )T (λ∗ + √n ) − (α̌n − α∗ )T I0 (α̌n − α∗ ) + op ∥α̌n − α∗ ∥2
n 2
Z ′
1 ( )
=(α̌n − α∗ )T √n − (α̌n − α∗ )T I0 (α̌n − α∗ ) + op ∥α̌n − α∗ ∥2 + 1/n (38)
n 2
√
because
√ ∇∇ T
P n ψ(α∗ ) = −I0 +op (1) and (α̌n −α∗ ) λ∗ = op (1/n). Thus noticing Zn / n =
T
We define
√
ρ(α) := ∥α − α∗ − Zn / n∥20 ,
α̃n := arg min ρ(α), α̈n := arg min ρ(α).
α∈Sn ,λT
∗ α=0 α∈S,λT
∗ α=0
√ √
In the following, we show (Step 1) n(α̌n − α̃n ) √
= op (1), (Step 2) n(α̃n − α̈n ) = op (1),
√ the asymptotic law of n(α̈n − α∗ ) and simultaneously it gives
and finally (Step 3) derive
the asymptotic law of n(α̌n − α∗ ).
√
Step 1. Derivation of n(α̌n − α̃n ) = op (1).
ρ(α∗ ) ≥ ρ(α̃n ) implies
√ √ √ √
∥α̃n − α∗ ∥0 ≤ ∥α̃n − α∗ − Zn / n∥0 + ∥Zn / n∥0 ≤ 2∥Zn / n∥0 = Op (1/ n).
√
Step 2. Derivation of n(α̃n − α̈n ) = op (1).
In a similar way to the case of α̃n , we can show
√
α̈n − α∗ = Op (1/ n).
Let α̃n′ and α̈n′ denote the projection of α̃n to S and α̈n to Sn :
α̃n′ := arg min ∥α̃n − α∥0 , α̈n′ := arg min ∥α̈n − α∥0 .
α∈S,λT
∗ α=0 α∈Sn ,λT
∗ α=0
Direct Importance Estimation for Covariate Shift Adaptation 43
Then
√ √ √
∥ n(α̈n − α∗ ) − Zn ∥0 ≥ ∥ n(α̈n′ − α∗ ) − Zn ∥0 − ∥ n(α̈n′ − α̈n )∥0
√ √
≥ ∥ n(α̃n − α∗ ) − Zn ∥0 − ∥ n(α̈n′ − α̈n )∥0 ,
and similarly
√ √ √
∥ n(α̃n − α∗ ) − Zn ∥0 ≥ ∥ n(α̈n − α∗ ) − Zn ∥0 − ∥ n(α̃n′ − α̃n )∥0 .
Thus
√ √ √
−∥ n(α̃n′ − α̃n )∥0 ≤ ∥ n(α̃n − α∗ ) − Zn ∥0 − ∥ n(α̈n − α∗ ) − Zn ∥0
√
≤ ∥ n(α̈n′ − α̈n )∥0 .
then
√ √ √ √
∥ n(α̈n − α̃n )∥0 = ∥ n(α̈n − α∗ ) − n(α̃n′ − α∗ ) + n(α̃n′ − α̃n )∥0
√ √ √
≤ ∥ n(α̈n − α∗ ) − n(α̃n′ − α∗ )∥0 + ∥ n(α̃n′ − α̃n )∥0
√ √ √
≤ ∥ n(α̃n′ − α∗ ) − Zn ∥20 − ∥ n(α̈n − α∗ ) − Zn ∥20 + op (1)
√ √ √
≤ op (1) + ∥ n(α̃n − α∗ ) − Zn ∥20 − ∥ n(α̈n − α∗ ) − Zn ∥20 + op (1)
≤ op (1). (43)
Zn I0−1 (Z1 + Z2 ).
A projection to a closed convex set is a continuous map. Thus, by the continuous mapping
theorem, it follows that
√
n(α̈n − α∗ ) arg min ∥δ − Z∥0 .
δ∈C,λT
∗ δ=0
Acknowledgments
This work was supported by MEXT (17700142 and 18300057), the Okawa Foundation,
the Microsoft CORE3 Project, and the IBM Faculty Award.
References
P. Baldi and S. Brunak. Bioinformatics: The Machine Learning Approach. MIT Press,
Cambridge, 1998.
S. Ghosal and A. W. van der Vaart. Entropies and rates of convergence for maximum
likelihood and Bayes estimation for mixtures of normal densities. Annals of Statistics,
29:1233–1263, 2001.
P. Hall. On Kullback-Leibler loss and density estimation. The Annals of Statistics, 15(4):
1491–1519, 1987.
Direct Importance Estimation for Covariate Shift Adaptation 46
C.-J. Lin, R. C. Weng, and S. S. Keerthi. Trust region Newton method for large-scale
logistic regression. Technical report, Department of Computer Science, National Taiwan
University, 2007. URL http://www.csie.ntu.edu.tw/~cjlin/liblinear/.
S. Mendelson. Improving the sample complexity using global data. IEEE Transactions
on Information Theory, 48:1977–1991, 2002.
G. Rätsch, T. Onoda, and K.-R. Müller. Soft margins for adaboost. Machine Learning,
42(3):287–320, 2001.
I. Steinwart. On the influence of the kernel on the consistency of support vector machines.
Journal of Machine Learning Research, 2:67–93, 2001.
M. Sugiyama, M. Kawanabe, and K.-R. Müller. Trading variance reduction with unbi-
asedness: The regularized subspace information criterion for robust model selection in
kernel regression. Neural Computation, 16(5):1077–1104, 2004.
M. Talagrand. Sharper bounds for Gaussian and empirical processes. Annals of Probabil-
ity, 22:28–76, 1994.
Y. Tsuboi, H. Kashima, S. Hido, S. Bickel, and M. Sugiyama. Direct density ratio esti-
mation for large-scale covariate shift adaptation. In M. J. Zaki, K. Wang, C. Apte, and
H. Park, editors, Proceedings of the Eighth SIAM International Conference on Data
Mining (SDM2008), pages 443–454, Atlanta, Georgia, USA, Apr. 24–26 2008.
A. W. van der Vaart and J. A. Wellner. Weak Convergence and Empirical Processes. with
Applications to Statistics. Springer, New York, 1996.