BR-SNIS: Bias Reduced Self-Normalized Importance Sampling
Abstract
Importance Sampling (IS) is a method for approximating expectations under a target distribution using independent samples from a proposal distribution and the associated importance weights.
In many applications, the target distribution is known only up to a normalization constant, in which case self-normalized IS (SNIS) can be used.
While the use of self-normalization can have a positive effect on the dispersion of the estimator, it introduces bias.
In this work, we propose a new method, BR-SNIS, whose complexity is essentially the same as that of SNIS and which signiﬁcantly reduces bias without increasing the variance.
This method is a wrapper in the sense that it uses the same proposal samples and importance weights as SNIS, but makes clever use of iterated sampling–importance resampling (i-SIR) to form a bias-reduced version of the estimator.
We furnish the proposed algorithm with rigorous theoretical results, including new bias, variance and high-probability bounds, and these are illustrated by numerical examples.
Introduction Background and previous work:
Importance sampling [15, 1] (IS) is a classical Monte Carlo technique for estimating expectations under some given probability distribution (the target ) on the basis of a sample of draws from a different distribution (the proposal ).
In the modern era of artiﬁcial intelligence and statistical machine learning, characterized by large computational resources and
Bayesian inference, IS technologies are enjoying a revival; see, e.g. , [34, 20] and [11] for a recent survey.
The method is not only relevant to situations where sampling from the target is intractable; it can also be used to achieve variance reduction [21].
When the proposal is dominating the target— in the sense that the support of the latter is contained in the support of the former—unbiased estimation can be achieved by assigning each draw an importance weight given by the likelihood ratio between the target and the proposal.
In the very common case where the target is known only up to a normalizing constant, consistent estimation can still be achieved by simply normalizing each importance weight by the total weight of the sample; however, since such self-normalized importance sampling (SNIS) involves ratios of random variables, the procedure can only be implemented at the cost of bias, which can be signiﬁcant in some applications.
More precisely, let ( , X ) be some state space and ⇡ (d x ) / w ( x )  (d x ) a given target probability distribution, where w and  are a positive weight function and a proposal probability distribution on ( , X ) , respectively, such that the normalizing constant  ( w ) =
R w ( x )  (d x ) (this will be our generic notation for Lebesgue integrals) of ⇡ is ﬁnite.
The SNIS estimator is given by
[Equation]
where X 1: M = ( X 1 , . .
, X M ) are independent draws from  , and can be used to approximate ⇡ ( f ) =
R f ( x ) ⇡ (d x ) for any test function f such that ⇡ ( | f | ) < 1 .
The estimator (1) can be calculated without knowledge of the normalizing constant  ( w ) , which is intractable in general.
The SNIS estimator is known to be biased; provided that  ( w 2 ) < 1 , the bias and mean-squared error (MSE) of the SNIS estimator (1) over bounded test functions f satisfying k f k 1  1 are given respectively (see [1, Theorem 2.1]) by
[Equation]
where  [ ⇡ ,  ] =  ( w 2 ) /  2 ( w )
Although IS is primarily intended to approximate integrals in the form ⇡ ( f ) , it can also be used to generate unweighted samples being approximately distributed according to ⇡ .
In this paper, we consider iterated sampling importance resampling (i-SIR), proposed in [42]; see [4, 24, 23, 5].
The i-SIR can be seen as an iterative application of the sampling importance resampling (SISR) algorithm proposed by [37]; the k -th iteration is deﬁned as follows.
Given a state
Y k, (i) set X 1 k +
=
Y k and draw X 2: N k +1 independently from the proposal distribution  ; (ii) compute, for i 2 { 1, . . .
, N } , the normalized importance weights [-ω iN , k +
-]!
iN , k +1 = w ( X ik +1 ) / [Equation]
; (iii select Y k +1 from the set X 1: N k +1 by choosing X ik +1 with probability ! iN , k +1 .
In the following,
Y k +1 and X 1: N k +1 will be referred to as the state and the candidate pool , respectively.
Following [42] (see Section 2.1), i-SIR may be viewed (up to an irrelevant permutation of the samples) as a two-stage
Gibbs sampler targeting an extended probability distribution ' N on an enlarged state space including the state as well as the candidate pool.
As this extended distribution allows ⇡ as a marginal with respect to the state, one can expect the marginal distribution of the generated states ( Y k ) k 2 N , forming themselves a Markov chain, to approach the target ⇡ of interest as k tends to inﬁnity.
This paper:
In i-SIR, the only function of the candidate pool is to guide the states selected at stage (iii) towards the target.
Thus, since all rejected candidates are discarded, the approach results generally in a large waste of computational work.
Thus, in the present paper we propose to recycle all the generated samples by incorporating all the proposed candidates X 1: N k into the estimator rather than only the selected candidate Y k .
We proceed in three steps.
First, we show that under the stationary distribution ' N of the process ( Y k , X 1: N k ) k 2 N generated by i-SIR, the expectation of ⇧ N f
( X 1: N k ) (given by (1)) equals ⇡ ( f ) for every valid test function f
(see Theorem 2).
Second, we establish that since i-SIR is nothing but a systematic-scan Gibbs sampler, the two processes ( X 1: N k ) k 2 N and ( Y k ) k 2 N are interleaving (see Theorem 5); thus, if ( Y k ) k 2 N is uniformly geometrically ergodic, so is ( X 1: N k )
k 2 N with the same mixing rate  N .
Third, as the main result of the present paper, we establish a novel O (  kN /N )
bound on the bias of the estimator ⇧ N f
( X 1: N k ) (see Theorem 3), where the exponentially diminishing factor  kN indicates a drastic bias reduction vis-à-vis the standard IS estimator (1) based on i.i.d.
samples.
As a consequence, approximating ⇡ ( f ) by the average of ( ⇧ N f ( X 1: N k ))
k ` = {+k 
+}
+1 , where the “burn-in” period k 0 should be chosen proportionally to the mixing time of the process, yields an estimator whose bias can be furnished with a bound which is, roughly, proportional to  k 0 N and inversely proportional to the total number M = kN of samples generated in the algorithm (see Theorem 4).
To complete the theoretical analysis of these estimators, we also equip the same with variance bounds.
The procedure of recycling, as described above, all the samples generated in the i-SIR and to incorporate, at negligible computational cost, the same into the ﬁnal estimator, will from now on be referred as BR-SNIS.
Finally, we test numerically the proposed estimators and illustrate how a signiﬁcant bias reduction relatively to the standard i-SIR can be obtained at basically no cost.
To sum up, our contribution is twofold, since we
– propose a new algorithm, BR-SNIS, which makes better use of the available computational resources by recycling the candidate pool generated at each iteration of i-SIR.
– furnish the proposed algorithm with rigorous theoretical results, including novel bias, variance, and high-probability bounds which support our claim that sample recycling may lead to drastic bias reduction without impairing the variance.
Main results 2.1 Statements
The i-SIR algorithm can be interpreted as a systematic-scan two-stage Gibbs sampler, alternately sampling from the full conditions of an extended target ' N on the product space of states and candidate pools.
Once the extended target ' N is properly deﬁned, these full conditionals can be retrieved from a dual representation of ' N presented in Theorem 1.
In order to deﬁne ' N , we introduce the Markov kernel (see Appendix A.1 for comments)
[Equation]
on ⇥ X ✏ N , which describes probabilistically the sampling operation (i) in i-SIR.
Using the kernel ⇤ N we may now deﬁne properly the extended target ' N as the probability law ' N
[Equation]
[Equation]
on ( N +1 , X ✏ ( N +1) ) .
Note that since for every A 2 X , ' N (1 A ⇥ N ) =
⇡ ( A ) , the target ⇡ coincides with the marginal of ' N with respect to the state.
Moreover, it is easily seen that ⇤ N provides the conditional distribution, under ' N , of the candidate pool given the state.
Deﬁning the kernels
[Equation]
(3) on ⇥ X ✏ N , the marginal distribution ⇡ N of ' N with respect to x 1: N is given by
[Equation]
It is interesting to note that the marginal ⇡ N has a probability density function, proportional to  N 1 ( x 1: N ) =
P
Ni =1 w ( x i ) /N , with respect to the product measure  ✏ N .
Using (4), we immediately obtain the following result.
Theorem 1 (duality of extended target) .
For every N 2 N ⇤ ,
[Equation]
Note that the second identity of the dual representation (5) provides also the conditional distribution, under ' N , of the state given the candidates.
Consequently, i-SIR is a systematic scan two-stage
Gibbs sampler which generates a Markov chain ( X k , Y k )
k 2 N with time-homogeneous Markov kernel
P
[Equation]
on N
[Equation]
⇥
[Equation]
✏ ( N +1) .
Note that the law P N ( y k , x 1: N k , · ) does not depend on x 1: N k , which means that only the state Y k needs to be stored from one iteration to the other.
Thus, ( Y k ) k 2 N is a Markov chain with Markov transition kernel
[Equation]
(where integration is w.r.t.
x 1: N k +1 ) on ⇥ X .
The kernel (6) was analyzed in [5].
Given some probability distribution ⇠ on ( N +1 , X ✏ ( N +1) ) , we denote by P ⇠ the law of the canonical Markov chain ( X k , Y k ) k 2 N with kernel P N and initial distribution ⇠ .
Our ﬁrst results establishes the unbiasedness of the estimator ⇧ N f ( X 1: N ) under ' N .
Theorem 2.
For every N 2 N ⇤ and ⇡ -integrable function f ,
[Equation]
The proof of Theorem 2 is postponed to Appendix A.3.
Next, we present theoretical bounds on the discrepancy, in terms of bias, MSE and covariance, between ⇧ N f ( X 1: N k ) and ⇡ ( f ) , for bounded target functions f , when the i-SIR chain is initialized according to an arbitrary distribution ⇠ .
We will work under the following assumption.
A1.
It holds that ! = k w k 1 /  ( w ) < 1 .
Under A 1, the state and candidate-pool Markov chains ( Y k ) k 2 N and ( X 1: N ) k 2 N can be shown to be uniformly geometrically ergodic with mixing rate and mixing-time upper bound
[Equation]
respectively; see Theorem 6 below for details.
Here the mixing time ⌧ mix , N grows logarithmically with the sample size N .
The exact value of ⌧ mix , N is likely to be grossly pessimistic, but we conjecture that the logarithmic dependence in the minibatch size holds true.
In addition, under A 1 we deﬁne the constants
[Equation]
With these deﬁnitions, the following holds true.
Theorem 3.
Assume A 1.
Then for every initial distribution ⇠ on ( N +1 , X ✏ ( N +1) ) , bounded measurable function f on ( , X ) such that k f k 1  1 , N  2 , and ( k , ` ) 2 ( N ⇤ ) 2 ,
[Equation]
i
[Equation]
where constants are given in (7) and (8) .
It is worth noting that the bias decreases inversely with the number of candidates and exponentially with the number of iterations (the mixing time of the chain also depends on N ).
The MSE is also inversely proportional to the number of candidates N .
In the light of the previous results, it is natural to consider an estimator formed by an average across the IS estimators ( ⇧ N f
( X 1: N k ))
k 2 N associated with the candidate pools generated at the different i-SIR iterations.
To mitigate the bias, we remove a “burn-in” period whose length k 0 should be chosen proportional to the mixing time ⌧ mix , N of the Markov chain ( Y k ) k 2 N (which turns out to coincide with that or the chain ( X 1: N k ) k 2 N ; see Section 2.2).
This yields the estimator
[Equation]
of ⇡ ( f ) .
The total number of samples (generated by the proposal  ) underlying this estimator is
M = ( N  1) k .
Importantly, all the importance weights included in the estimators are obtained as a by-product of the i-SIR schedule; thus, it is, for a given budget of simulations ( i.e. , under the constraint that ( k  k 0 ) N is constant), possible to compute ⇧ ( k 0 , k ), N ( f ) for different values of k 0 , k and N with a negligible computational cost.
We denote by  =
( k  k 0 ) /k
the ratio of the number of candidate pools used in the estimator to the total number of sampled such pools.
Note that this type of estimator was already suggested by [43], and also appears in [39].
Our ﬁnal main result provides bounds on the bias and the MSE of the estimator (9) as well as a high-probability bound for the same.
Deﬁne ⇣ bias = 4 ⌧ mix , N & bias / 3 , ⇣ mse
i = & mse ( i +1) ^ 2 1 { 0,2 } ( i ) + (8 / 3) ⌧ mix , N & cov i , i 2 { 0, 1, 2 } , ⇣ mse = ⇣ mse+ ⇣ mse 1 ( N  1)  1 / 4 + ⇣ mse 2 ( N  1)  1 , and MSE is M = (4 /M )
 [ ⇡ ,  ] , see (2).
Theorem 4.
Assume A 1.
Then the following holds true for every initial distribution ⇠ on ( N +1 , X ✏ ( N +1) ) , bounded measurable function f on ( , X ) such that k f k 1  1 , and N  2 . (i)
[Equation] [Equation]
[Equation] [Equation]
(ii) E ⇠ [ { ⇧ ( k 0 , k ), N ( f )  ⇡ ( f ) } 2 ]  MSE is  M
[Equation] ⇣ mse (  M )  1 ( N  1)  [Equation]
(iii) For every  2 (0, 1) , | ⇧ ( k 0 , k ), N ( f )  ⇡ ( f ) |  & hpd (  M )  1 / 2 (log(4 /  )) 1 / 2 with probability at least 1   , where & hpd = 664 ! .
Bootstrap: As established in Theorem 4, the bias of the BR-SNIS estimator decreases exponentially with the burn-in period k 0 , leading to potentially signiﬁcant bias reduction with respect to SNIS.
Still, using a large k 0 is done at a price of increased overall MSE (mainly through the term MSE is  M in
Theorem 4(ii), which is directly related to k 0 via  ).
A natural way to reduce the variance is to use bootstrap.
More precisely, we ﬁrst apply a random permutation to the samples and re-compute BRSNIS on the basis of the bootstrapped samples.
After this, we produce a ﬁnal estimator by averaging over the bootstrapped BR-SNIS replicates.
In most applications, the major computational bottleneck consists of sampling from  and evaluating w and f at the samples; thus, the additional operations that this bootstrap approach entails are computationally cheap.
Therefore, in our experiments, we use bootstrap in combination with the choice k [-
-]0 =
k  1 (in order to minimize the bound in Theorem 4(i)).
2.2 Elements of proofs
Ergodic properties of i-SIR:
The systematic scan two-stage Gibbs sampler is a well-studied
MCMC algorithmic structure, and we summarize its most important properties in Theorem 5 below; see [27, 3] and [36, Chapter 9] as well as the references therein.
In particular, as shown in [27], the state and candidate-pool Markov chains ( Y k ) k 2 N and ( X 1: N k ) k 2 N satisfy a duality property referred to as interleaving (Theorem 5(iii)).
Theorem 5.
Assume that for every x, w ( x ) > 0 ,  ( w ) < 1 and that there exists a set C 2 X such that  ( C ) > 0 and sup x 2 C w ( x ) /  ( w ) < 1 .
Then,
(i) the Markov kernel P N is Harris recurrent and ergodic with unique invariant distribution ' N .
(ii) the Markov kernel P N is ⇡ -reversible, Harris recurrent and ergodic.
(iii) the two Markov chains ( Y k ) k 2 N and ( X 1: N k ) k 2 N are conjugate of each other with the interleav- ing property,
i
e., for every initial distribution ⇠ and k 2 N , under P ⇠ , (a) X 1: N k and X 1: N k +1 are conditionally independent given Y k , (b) Y k and Y k +1 are conditionally independent given X 1: N k +1 ; (c)
moreover, under P ' N , ( Y k , X 1: N k  1 ) and ( Y k , X 1: N k ) are identically distributed.
The ergodic behavior of the i-SIR algorithm has been studied in many works; see [23, 25, 5] in particular.
The analysis is particularly simple under the assumption that the importance weight function w is bounded, as imposed by A 1.
Recall that the total variation-distance between two probability measures ⇠ and ⇠ 0 on ( , X ) is given by d TV ( ⇠ , ⇠ 0 )
=
sup g :osc( g )  1 { ⇠ ( g )  ⇠ 0 ( g ) } , where osc( g ) =
sup ( x , x 0 ) 2 2 | g ( x )  g ( x 0 ) | denotes the oscillator norm of a measurable function g .
The following result establishes the uniform geometric ergodicity of the state chain ( Y k ) k 2 N .
Theorem 6.
Assume A 1.
Then for every N  2 , yand k 2 N , d TV ( P kN ( y , · ), ⇡ )   kN , where  N is given in (7) .
The proof is given in [25, 5], but we provide it in Appendix A.5 for completeness.
For uniformly ergodic Markov chains, it is often more appropriate to work with the mixing time
[Equation] (where ⌧ mix , N is given in (7)), i.e. , the number of time steps required for the distribution of the chain to be within a certain total variation distance from its stationary distribution [2, 14].
An interesting consequence of the interleaving property is that if the Markov chain ( Y k ) k 2 N is (geometrically) ergodic, then the Markov chain ( X 1: N k ) k 2 N is (geometrically) ergodic as well with the same mixing time; see [36, Corollary 9.14]).
Bias of the BR-SNIS estimator:
As the BR-SNIS estimator ⇧ N f ( X 1: N k ) (where ⇧ N is deﬁned in (3)) is made up by a ratio of the two unnormalized estimators  N f ( X 1: N k ) and  N 1 ( X 1: N k ) , a key ingredient in the proof of Theorem 3 is to bound the bias and the p th order moments of statistics deﬁned as ratios of sums of random variables that are not necessarily independent.
The basic idea is to reduce the study of these relations to the analysis of the moments of the numerator and the denominator of these statistics and to exploit their concentration around the respective (conditional and unconditional) means.
The main results that we will use in the rest of the paper are summarized in Appendix B.
Lemma 7.
For every initial distribution ⇠ on ( N +1 , X ✏ ( N +1) ) , k 2 N ⇤ , and bounded measurable function f : ! R , it holds that
(i) for every y
[Equation] ii)
[Equation]
We now have all the elements that allow us to determine the ﬁrst important result of this work, namely the bias and the MSE of the estimator ⇧ N f
( X 1: N k ) of ⇡ ( f ) .
Proof of Theorem 3.
We establish the bias bound in (i) and postpone the proof of the bounds on the
MSE and the covariance in (ii) and (iii) to the supplement.
Deﬁne the measure ⇠ ( A ) =
⇠ ( A ⇥ ) , A
X , and the kernel P N = ⇤ N ⇧ N on
[Equation] Consequently,
[Equation]
and ⇤ N  N f ( Y k [Equation] = [Equation]
[Equation] ) | Y k  1 ] , P ⇠ -a.s.
Since ( Y k ) k 2 N is, under P ⇠ , a Markov chain with initial distribution ⇠ and Markov kernel P N (see (6)), it holds that
[Equation]
Consequently, the proof is concluded by establishing that for every k 2 N ⇤ ,
[Equation]
On the other hand, since by Theorem 2, ⇡ ( P N f ) =
⇡ ( f ) , we may use Theorem 6 to obtain the bound | ⇠ P k  1 N P N f  ⇡ ( f ) | = | ⇠ P [Equation]
[Equation]

[Equation]
[Equation] [Equation] Finally, we establish (10) by bounding osc( P N f ) .
Note that
[Equation]
1 )  ⇡ ( f ) k 1 , where, for every y, using Theorem 11,
[Equation]

[Equation]
[Equation]  ⇤ N  N 1 ( y ) } 2 ]( y ) } . Now, since ⇤ N  N 1 ( y )  (1  1 /N )  ( w ) , we get, using Lemma 7,
[Equation]
On the other hand, using the elementary inequality a/b  c/d = a ( d  b ) /bd
+ ( a  c ) /d , we get, as ⇡
( f ) =
( wf ) /  ( w ) , ⇤ N
[Equation]
Finally, the bound (10) is established by noting that
[Equation]
2.3 Related works
The ﬁrst use of the IS method, then as a variance reduction technique, dates back to the ’50s; see [12, 19] and the references therein.
Today, the renewed interest in IS parallels the ﬂurry of activity in the probabilistic ML community and its ever-increasing computational demands; thus, it is impossible to fully present the literature.
We therefore limit ourselves to describing results that have inspired our work, and refer the readers to the recent reviews [1, 11] for additional references.
There is clearly a plethora of modern ML applications where the standard SNIS estimator may be substantially improved using the BR-SNIS method.
To mention just a selection of examples, SNIS plays a key role for a robust off-policy selection strategy BY [20] (extending [40, 29]), Bayesian problems (see, e.g. , [1, Section 3]), Bayesian transfer learning [16, 28], variational autoencoders [9], inference of energy-based models [22], patch-based image restoration [34] and many more. In stochastic-approximation procedures, where a statistical estimator or algorithm is employed repeatedly to produce mean-ﬁeld estimates, controlling its bias becomes critical [ ? ? ].
Thus, it is natural to aim at minimizing the bias for a given computational budget, provided that the variance does not explode. For this reason, bias reduction (or unbiasedness) in stochastic simulation has been the subject of extensive research during the last decades; see [ ? ? ]. The present paper contributes to this line of research.
Despite long-standing interest in SNIS, there are only few theoretical results.
For example, [1,
Theorem 2.1] provides bounds on the bias and variance of SNIS, results that we extend to BR-SNIS in Theorem 3.
Moreover, [29, Proposition D.3] provides a suboptimal variance bound based on a bound for the second-order moment.
This result can be compared to the sophisticated sub-Gaussian concentration bound for BR-SNIS obtained in Theorem 4 (a result that can be obtained for SNIS using the same proof mechanism; see Appendix A.8).
Finally, [20] obtains a semi-empirical sub-Gaussian concentration inequality using the Efron-Stein estimate of variance and the Harris inequality.
As an MCMC sampling method, the i-SIR algorithm that has been applied successfully in many situations.
It was recently used—under the alternative name conditional importance sampling —in [31] for Markovian score climbing .
In the same work, it is mentioned that it is possible to “RaoBlackwellize” the gradient of the score using the proposed candidates, which is in line with the recycling argument underpinning the estimator suggested by us, but without theoretical justiﬁcations.
In its most basic form, the i-SIR algorithm appeared in the pioneering work of [42].
The same idea played a key role in the development of the particle Gibbs sampler [4, 5, 32], which extends i-SIR principles to sequential Monte Carlo methods .
An approach very similar to BR-SNIS can be taken also in this context; however, casting BR-SNIS into the framework of particle Gibbs methods is a non-trivial problem which is the subject of ongoing work.
Experimental results
In this section we compare numerically the performances of BR-SNIS and SNIS in three different settings: mixture of Gaussians, Bayesian logistic regression and variational autoencoders (VAE).
We leave to the supplementary material (Appendix C.1)
the detailed numerical veriﬁcation of the bounds established in Section 2.
Mixture of Gaussian distributions: We start with an example where the target distribution ⇡ is a mixture of two Gaussian distributions of dimension d = 7 , as shown in Figure 2a.
The proposal distribution is a Student distribution with ⌫ = 3 degrees of freedom.
The test function is f = 1 A  1 B , where A and B are a d -dimensional rectangle intersecting each of the modes of ⇡ (see Appendix C. for precise deﬁnitions).
We verify the positive effect of bootstrap in Figures 1a and 1b by computing the bias and the MSE over 1000 chains for N = 129 for several k .
The purple, green, and red curves correspond to a number of bootstrap rounds of 1, 21 , and 201 , respectively.
We illustrate the decay of the mean Sliced Wasserstein distance (according to [7]) with k for different values of N ( N =purple, N = 32 green, N = 64 orange, and N = 128 red) in Figure 1c.
The decay of the Wassertein distance is directly linked to the mixing time of the i-SIR kernel (see (7)), and hence allows us to represent the effective mixing time of the chain.
Moreover, we represent the theoretical slopes as dashed lines.
This illustrates that the effective value of ⌧ mix , N is smaller than its theoretical bound.
The bias and MSE for SNIS with M = 25600 are shown in black dashed lines.
We compare the bias (Figure 2b) and MSE (Figure 2c) of BR-SNIS and SNIS for a ﬁxed budget with a total number of M = 16384 samples.
We run the experiments 10 6 times; we compute the bias and MSE over batches of 10 4 replications using the true value of ⇡ ( f ) computed above (the boxplots in Figure 2 are therefore obtained over 100 replications).
For the algorithm BR-SNIS, we used N 2 { 129, 513 } , k
= k max  1 and k max = M/ ( N  1) bootstrap rounds.
As can be seen from Figure 2b, BR-SNIS signiﬁcantly reduces bias (by a factor of almost 10) w.r.t.
standard SNIS for both conﬁgurations, while MSE increases only slightly (at around 20% ), as can be seen in Figure 2c.
The code used for this experiment is available at 1 .
We also show in Appendix {+C.
+} that k
= [-(cid:98) 0.
-]b 0.625 k max c can lead to about 3 times less bias w.r.t.
standard SNIS while only augmenting the MSE of 10% .
We have also compared in BR-SNIS to zero bias estimators based on SNIS such as [30], the results are in shown in Appendix C.1.
Bayesian Logistic regression: We consider posterior inference in a Bayesian logistic regression model.
Let D train =
( x i , y i )
Ti =1 be a dataset, where each x i 2 R d is a vector of covariates and y i 2 {  1, 1 } is a binary response.
Let p ( y i | x i ; ✓ ) = { 1 + exp
(  y i x > i ✓ ) }  1 be the probability of the i th observation at ✓ 2 ⇥ ✓ R d and ⇡ 0 (d ✓ ) be a prior distribution for ✓ .
The Bayesian posterior is
[Figure]
[Figure] given [Equation] For numerical illustration, we use the heart failure clinical records ( d = 13 , T = 299 ), breast cancer detection ( d = 30 , T = 569 ), and Covertype ( d = 55 , T = 4 · 10 4 ) datasets from the UCI machine learning repository.
For Covertype, we use Cover type 1 (Spruce/Fir) and Cover type(Lodgepole Pine) classes to deﬁne a binary classiﬁcation problem.
As a prior, we use a Gaussian distribution N(0, ⌧  2 I ) with ⌧ 2 = 5 · 10  2 .
The importance distribution  is Gaussian with mean and diagonal covariance learned by variational inference; see Appendix C.2 for details.
The boxplots for bias in Figure 3 were constructed in the same way as those in Figure 2.
We compare two test .
[Table]
Breast
Heart
SNIS, M =0.0028 +/- 0.
0.00011 +/-
6.04e0.00023 +/- 7.24eBR-SNIS, M=0.0014 +/- 0.
7.9e-5 +/-
5.5e0.
+/-
6.7eSNIS, M =0.0026 +/- 0.
4.3e-5 +/-
[-3.3e7.8e-
-]3.3e7.8e-5 +/-
6.8eBR-SNIS, M=0.
[Table]
functions, f ( ✓ ) =
✓ , corresponding to evaluation of the posterior mean, and f ( ✓ ) =
p ( y | x , ✓ ) , where ( x , y ) 2 D test .
This last function allows us to compute a TV distance for the predictive distribution.
Indeed, in a classiﬁcation context, one can compute the TV distance between any two predictive distributions p and ˆ p as
[Equation]
where we compare the predictive distribution p ( y | x , D train ) = [Equation]
⇡ [Equation] ✓ and ˆ p is the estimation of this quantity, provided in the experiments by SNIS or BR-SNIS.
From Figure 3 we can see that for each dataset we have a constant decrease in bias, while the variance increases only slightly.
We plot the bias in other components of ✓ and provide further numerical details in Appendix C.2. [Figure] [Figure] [Table]
Generative Model:
We now extend our methodology to the more complex deep latent generative models (DLGM).
A DLGM deﬁnes a family of probability densities p ✓ ( x ) over an observation space x 2 R P by introducing a latent variable z 2 R d , deﬁning the joint density function p ✓ ( x , z ) (with respect to Lebesgue measure) and aiming to ﬁnd a parameter ✓ maximizing the marginal log-likelihood of the model p ✓ ( x ) = R p [Equation] x , z
[Equation]
d z .
Under simple technical assumptions, by Fisher’s identity,
[Equation] [Equation]
In most cases, the conditional density p ✓ ( z | x ) =
p ✓ ( x , z ) /p
✓ ( x ) is intractable and can only be sampled.
The variational autoencoder [18] is based on the introduction of an additional parameter  and a family of variational distributions q  ( z | x ) .
The joint parameters { ✓ ,  } are then inferred by maximizing the evidence lower bound (ELBO) deﬁned by
[Equation]
( x ).
This basic setup has been further developed and improved in many directions.
Here we consider the importance weighted autoencoder (IWAE) [8], which relies on SNIS to design a tighter ELBO on the log-likelihood.
The objective of the IWAE is given by
[Equation]
where w ✓ ,  , x ( z ) =
p ✓ ( x , z ) /q  ( z | x ) denote the importance weights.
However, writing, following [8, Eq.
[Equation]
where ! ( i ) ✓ ,  , x = w ✓ ,  , x ( z i ) /
P
Mj =1 w ✓ ,  , x ( z j ) are normalized importance weights, yields an expression of the gradient that corresponds exactly to the biased SNIS approximation of (13).
Thus, the optimization problem will suffer from bias.
We hence propose to use BR-SNIS for learning IWAE.
The proposed algorithm proceeds in two steps, which are repeated during the optimization (details are given in Appendix C.3)
• First, update the parameter  as in the IWAE algorithm (using the reparameterization trick and following the methodology of [8]) according to  ( t +1)
=
( t )  ⌘ r  L M ( ✓ ( t ) ,  ( t ) ) .
• Second, update the parameter ✓ by estimating (13) using BR-SNIS for ⇡ ( z ) =
p ✓ ( x , z ) , f ( z ) = r ✓ log p ✓ ( x , z ) and  ( z ) =
q  ( z | x ) .
We refer to this model as BR-IWAE.
As an illustration, we train the model using the binarized MNIST dataset [38], where x 2 { 0, 1 } 784 are binarized digits images in dimension 784.
For both for the encoder q  and the decoder p ✓ , we use a convolutional neural network (more details are given in Appendix C.3).
For comparison, we estimate the log-likelihood using the VAE, IWAE and BR-IWAE approaches, and the result is reported in Table 2.
All models are run for 100 epochs, using the Adam optimizer [17] and a learning rate of 10  4 .
The complete experimental details are given in Appendix C.3.
Conclusion
In this paper, we have introduced a novel method, BR-SNIS, which improves over SNIS when it comes to producing close to unbiased estimates of expectations taken w.r.t.
to distributions known only up to a normalizing constant, a ubiquitous problem in machine learning and statistics.
[-+
-]
The high performance of BR-SNIS is supported theoretically by non-asymptotic bias, variance and high-probability bounds.
We illustrate our method on various examples, which show the practical advantages of BR-SNIS over SNIS.
Finally, BR-SNIS is naturally adapted to other IS based methods, for example [41], which use a Hamiltonian (gradient-based) transform [33] as part of the IS proposal.
[-Φ N ( Y K 
-]
[-Letting ς hpd = 2 ζ 1 / 
-]
The extension of BR-SNIS to [41] would produce an Hamiltonian based sampler able to recycle all samples, contrarily to other classical Hamiltonian-based methods [33, 13].
[-If X ∈ L φ (Ω) , then,for every x > 
-]
[-=
-]
[-=
-]
[-Bias–MSE trade-off: Figures 4a and 4b display the bias and the MSE of the BR-SNIS estimatorswith the same conﬁgurations as in Figure 2 but with k 0 = (cid:98) 0.
-]
[-, 1) (cid:124) and µ 2 = ( − 2, 0, . . . , 0) (cid:124) and covariance matrices Σ 
-]
[-d − 1 I , where p = 1 / 
-]
BR-SNIS can also be extended to Particle Markov chain Monte Carlo methods such as Particle Gibbs with Ancestor sampling [26].
Acknowledgement
This work was partly supported by SCAI Project-ANR-19-CHIA-0002.
The article was partly prepared within the framework of the HSE University Basic Research Program.
Part of this work has been carried out under the auspice of the Lagrange Center in Mathematics and Computing.