The Bias-Variance dilemma of the Monte Carlo. method. Technion - Israel Institute of Technology, Technion City, Haifa 32000, Israel

Similar documents
Gaussian Processes for Regression. Carl Edward Rasmussen. Department of Computer Science. Toronto, ONT, M5S 1A4, Canada.

STA 4273H: Statistical Machine Learning

Infinite Mixtures of Gaussian Process Experts

CSC 2541: Bayesian Methods for Machine Learning

Gaussian process for nonstationary time series prediction

STAT 518 Intro Student Presentation

Pattern Recognition and Machine Learning. Bishop Chapter 11: Sampling Methods

Bagging During Markov Chain Monte Carlo for Smoother Predictions

Bayesian Methods for Machine Learning

Introduction to Machine Learning CMU-10701

Nonparametric Bayesian Methods (Gaussian Processes)

16 : Markov Chain Monte Carlo (MCMC)

Brief introduction to Markov Chain Monte Carlo

Monte Carlo Integration using Importance Sampling and Gibbs Sampling

Probabilistic Graphical Models Lecture 17: Markov chain Monte Carlo

1. INTRODUCTION Propp and Wilson (1996,1998) described a protocol called \coupling from the past" (CFTP) for exact sampling from a distribution using

17 : Markov Chain Monte Carlo

A quick introduction to Markov chains and Markov chain Monte Carlo (revised version)

Answers and expectations

Paul Karapanagiotidis ECO4060

Computational statistics

Gaussian Process Regression: Active Data Selection and Test Point. Rejection. Sambu Seo Marko Wallat Thore Graepel Klaus Obermayer

Cheng Soon Ong & Christian Walder. Canberra February June 2018

Markov Chain Monte Carlo (MCMC)

Slice Sampling with Adaptive Multivariate Steps: The Shrinking-Rank Method

Hamiltonian Monte Carlo for Scalable Deep Learning

Markov chain Monte Carlo

MCMC and Gibbs Sampling. Sargur Srihari

Regression with Input-Dependent Noise: A Bayesian Treatment

16 : Approximate Inference: Markov Chain Monte Carlo

Condensed Table of Contents for Introduction to Stochastic Search and Optimization: Estimation, Simulation, and Control by J. C.

MCMC Sampling for Bayesian Inference using L1-type Priors

INTRODUCTION TO MONTE CARLO METHODS D.J.C. MACKAY. Department of Physics, Cambridge University. Cavendish Laboratory, Madingley Road,

Markov Chain Monte Carlo methods

CV-NP BAYESIANISM BY MCMC. Cross Validated Non Parametric Bayesianism by Markov Chain Monte Carlo CARLOS C. RODRIGUEZ

Average Reward Parameters

Advances and Applications in Perfect Sampling

Bayesian Inference and MCMC

Monte Carlo Methods for Computation and Optimization (048715)

STA 4273H: Sta-s-cal Machine Learning

Modeling human function learning with Gaussian processes

Markov chain Monte Carlo methods for visual tracking

A Statistical Input Pruning Method for Artificial Neural Networks Used in Environmental Modelling

19 : Slice Sampling and HMC

Learning Energy-Based Models of High-Dimensional Data

Learning with Ensembles: How. over-tting can be useful. Anders Krogh Copenhagen, Denmark. Abstract

17 : Optimization and Monte Carlo Methods

Probabilistic Machine Learning

A Level-Set Hit-And-Run Sampler for Quasi- Concave Distributions

Markov Chain Monte Carlo

Approximate Slice Sampling for Bayesian Posterior Inference

Approximate Slice Sampling for Bayesian Posterior Inference

Session 3A: Markov chain Monte Carlo (MCMC)

27 : Distributed Monte Carlo Markov Chain. 1 Recap of MCMC and Naive Parallel Gibbs Sampling

Sampling Methods (11/30/04)

Markov Chain Monte Carlo (MCMC)

Hastings-within-Gibbs Algorithm: Introduction and Application on Hierarchical Model

Te comparison of dierent models M i is based on teir relative probabilities, wic can be expressed, again using Bayes' teorem, in terms of prior probab

Lecture 7 and 8: Markov Chain Monte Carlo

Markov Chain Monte Carlo methods

arxiv: v1 [stat.ml] 4 Dec 2018

Use of probability gradients in hybrid MCMC and a new convergence test

Kernel adaptive Sequential Monte Carlo

STAT 425: Introduction to Bayesian Analysis

Riemann Manifold Methods in Bayesian Statistics

ST 740: Markov Chain Monte Carlo

Development of Stochastic Artificial Neural Networks for Hydrological Prediction

Approximate inference in Energy-Based Models

MCMC Methods: Gibbs and Metropolis

SAMPLING ALGORITHMS. In general. Inference in Bayesian models

1 Geometry of high dimensional probability distributions

Gentle Introduction to Infinite Gaussian Mixture Modeling

Pattern Recognition and Machine Learning

Regression, Ridge Regression, Lasso

MCMC algorithms for fitting Bayesian models

General Construction of Irreversible Kernel in Markov Chain Monte Carlo

Implementing componentwise Hastings algorithms

CPSC 540: Machine Learning

Markov Chain Monte Carlo Methods for Stochastic Optimization

Doing Bayesian Integrals

Different Criteria for Active Learning in Neural Networks: A Comparative Study

Monte Carlo Lecture Notes II, Jonathan Goodman. Courant Institute of Mathematical Sciences, NYU. January 29, 1997

On Markov chain Monte Carlo methods for tall data

Improving the Asymptotic Performance of Markov Chain Monte-Carlo by Inserting Vortices

Monte Carlo Inference Methods

Introduction to Bayesian methods in inverse problems

The Infinite Gaussian Mixture Model

Least Absolute Shrinkage is Equivalent to Quadratic Penalization

Introduction to Machine Learning CMU-10701

MCMC: Markov Chain Monte Carlo

Thermostatic Controls for Noisy Gradient Systems and Applications to Machine Learning

Approximate Inference Part 1 of 2

April 20th, Advanced Topics in Machine Learning California Institute of Technology. Markov Chain Monte Carlo for Machine Learning

Web Appendix for Hierarchical Adaptive Regression Kernels for Regression with Functional Predictors by D. B. Woodard, C. Crainiceanu, and D.

Approximate Inference Part 1 of 2

(5) Multi-parameter models - Gibbs sampling. ST440/540: Applied Bayesian Analysis

Lecture 6: Markov Chain Monte Carlo

eqr094: Hierarchical MCMC for Bayesian System Reliability

Testing a Fourier Accelerated Hybrid Monte Carlo Algorithm

Probabilistic Graphical Models

Transcription:

The Bias-Variance dilemma of the Monte Carlo method Zlochin Mark 1 and Yoram Baram 1 Technion - Israel Institute of Technology, Technion City, Haifa 32000, Israel fzmark,baramg@cs.technion.ac.il Abstract. We investigate the setting in which Monte Carlo methods are used and draw a parallel to the formal setting of statistical inference. In particular, we nd that Monte Carlo approximation gives rise to a bias-variance dilemma. We show that it is possible to construct a biased approximation scheme with a lower approximation error than a related unbiased algorithm. 1 Introduction Markov Chain Monte Carlo methods have been gaining popularity in recent years. Their growing spectrum of applications ranges from molecular and quantum physics to optimization and learning. The main idea of this approach is to approximate the desired target distribution by an empirical distribution of a sample generated through the simulation of an ergodic Markov Chain. The common practice is to construct a Markov Chain in such a way as to insure that the target distribution is invariant. Much eort has been devoted to the development of general methods for the construction of such Markov chains. However, the fact that approximation accuracy is often lost when invariance is imposed has been largely overlooked. In this paper we make explicit the formal setting of the approximation problem, as well as the required properties of the approximation algorithm. By analogy to statistical inference, we observe that the desired property of the algorithms is a good rate of convergence, rather than unbiasedness. We demonstrate this point by numerical examples. 2 Monte Carlo method 2.1 The basic idea In various elds we encounter the problem of nding the expectation: ^a = E[a] = Z a()q()d (1) where a() is some parameter-dependent quantity of interest and Q() is the parameter distribution (e.g. in Bayesian learning a() can be the vector of output values for the test cases and Q() is the posterior distribution given the data).

2 Since an exact calculation is often infeasible, an approximation is made. The basic Monte Carlo estimate of ^a is: a n = 1 n a( i ) (2) where i are independent and distributed according to Q( i ). In the case where sampling from Q() is impossible, an importance sampling [2] can be used: a n = 1 n a( i )w( i ) (3) where i are distributed according to some P 0 ( i ) and w( i ) = Q(i) P 0(i). In many problems, especially high dimensional ones, independent sampling cannot provide accurate estimates in reasonable time. An alternative is the Markov Chain Monte Carlo (MCMC) approach, where the same estimate as in (2) is used, but the sampled values (i) are not drawn independently. Instead, they are generated by a homogeneous ergodic (and, usually, reversible) Markov Chain with invariant distribution Q [5]. 2.2 Approximation error and the bias-variance dilemma Let us consider a yet more general approximation scheme where the invariant distribution of the Markov Chain is not Q but some other distribution Q 0. Moreover, we may consider non-homogeneous Markov Chains with the transition probabilities T t ( (t+1) j (t) ) depending on t. Since a n is a random variable, its bias, equilibrium bias and variance are dened as follows: Bias n = Efa n g? ^a Bias eq = lim n!1 Bias n V ar n = Efa n? Efa n gg 2 where E denotes expectation with respect to the distribution of a n. In addition, we may dene the initialization bias, Bias init n = Bias n?bias eq, as a measure of how far the Markov Chain is from equilibrium. The common practice is to try to construct a homogeneous (i.e. T ( j ) independent of time) reversible Markov Chain with Q() as invariant distribution, hence with the equilibrium bias equal to zero. However the quality of the approximation is measured not by the bias, but by an average squared estimation error: Err n = E[a n? ^a] 2 = Bias 2 n + V ar n = (Bias eq + Bias init n ) 2 + V ar n (4) From the last equation it can be seen that the average estimation error has three components. Therefore, there is a possibility (at least potentially) to reduce the

total approximation error by balancing those three. Moreover it shows that, since the initialization bias and the variance depend on the number of iterations, the algorithm may depend on the number of iterations as well. 3 Batch versus online estimation A similar trade-o between the components of the error appears in statistical inference, where it is know as \the bias-variance dilemma". The analogy to the statistical inference setting can be further extended by making a distinction between two models of MCMC estimation: Online estimation - the computation time is potentially unlimited and we are interested in as good an approximation as possible at any point in time or, alternatively, as rapid a rate of convergence of Err n to zero as possible. Batch estimation - the allowed computation time is limited and known in advance and the objective is to design an algorithm with as low an average estimation error as possible. Note that the batch estimation paradigm is more realistic than the online estimation, since, in practice, the time complexity is of primary importance. In addition, in many instances of Bayesian learning, the prior distribution is not known but is chosen on some ad-hoc basis and the data is usually noisy. Therefore, it makes little sense to look for a time-expensive high accuracy approximation to the posterior. Instead, a cheaper rough approximation, capturing the essential characteristics of the posterior, is needed. The traditional MCMC method overlooks the distinction between the two models. In both cases, the approximation is obtained using a homogeneous (and, usually, reversible) Markov Chain with the desired invariant distribution. It should be clear, however, that such an approach is far from optimal. In the online estimation model, a more reasonable alternative would be considering a non-homogeneous Markov Chain that rapidly converges to a rough approximation of Q and whose transition probabilities are modied with time so as to insure the asymptotic invariance of Q (hence consistency). A general method for designing such Markov Chains is described in the next subsection. In the batch estimation model the invariance of Q may be sacriced (i.e. equilibrium bias may be non-zero) if this facilitates a lower variance and/or initialization bias for the nite computation time. Mixture Markov Chains Suppose that we are given two Markov Chains - the rst, M 1, is unbiased, while the second, M 2, is biased, but more rapidly mixing. Let their transition probabilities be Tt 1 and Tt 2 respectively. It will usually be the case that for small sample sizes, M 2 will produce better estimates, but as n grows, the inuence of the bias becomes dominant, making M 1 preferable. In order to overcome this diculty, we may dene a mixture Markov chain with mixing probabilities p t, for which the transition is made according to Tt 1 with probability 1? p t and according to T 2 t with probability p t. If the sequence fp t g starts with p 1 = 1 and decreases to zero, then for small t the resulting Markov chain behaves similarly to M 2, hence producing better estimates than

4 M 1, but as t grows, its behavior approaches that of M 1 (in particular, the resulting estimate is asymptotically unbiased). Clearly, if both Markov Chains are degenerate (i.e. produce IID states), it can be easily seen that the bias behaves asymptotically as Bias n = O( 1 n p i ) (5) and it can be shown that (5) also holds for any uniformly ergodic Markov Chains. In order to balance between the variance, which typically decreases as O( 1 ), n and the bias, the sequence fp i g should be chosen so that Bias n = O( p 1 n ), i.e. P n p i = O( p n). This mixture Markov Chain approach allows to design ecient sampling algorithms both in online and in batch settings (in latter case the sequence fp i g may depend on the sample size, n). 3 Examples 3.1 Independent sampling Annealed Importance sampling In the Annealed Importance sampling algorithm [6], the sample points are generated using some variant of simulated annealing and then the importance weights, w (i), are calculated in a way that insures asymptotic unbiasedness of the weighted average. The annealed importance sampling (AIS) estimate of E Q [a] is: a n = a(x (i) )w (i) = w (i) (6) Smoothed importance sampling While implicitly concentrating on the regions of high probability, AIS estimate can still have a rather high variance, since its importance weights are random and their dispersion can be large. Let us observe that E Q [a] may be written as E Q [a] = E P [aw] = E E P [w] P (a) a E P (wja)[w] (7) E P [w] where a = a(x) and P is the distribution dened by the annealing algorithm. The estimate (6) is simply a nite sample approximation to the rst part of (7). Next, the second part of (7) suggests using an estimate: ^a n = a(x (i) ) ^w(a(x (i) )) (8) where ^w(a) is an estimate of E P (wja)[w] E P [w]. It can be shown that if ^w(a) was known exactly, than (8) would have a lower variance than (6). In practice, a good

n Annealed IS Smoothed IS 10 3.04 1.09 100 0.694 0.313 1000 0.0923 0.0594 Table 1. Average estimation error of posterior output prediction for dierent sample sizes. The results for sample size n are based on 10 4 =n trials. 5 estimate of ^w(a) can be obtained using some data smoothing algorithm such as kernel smoothing [3]. The resulting method henceforth is referred to as Smoothed Importance sampling. The usage of smoothing introduces bias (which can be made arbitrary small by decreasing the smoothing kernel width to zero as n! 1), but in return can lead to a signicant reduction of the variance, hence, a smaller estimation error than (6), as demonstrated by the following numerical experiment. A Bayesian linear regression problem The comparison was carried out using a simple Bayesian learning problem from [6]. The data for this problem consisted of 100 independent cases, each having 10 real-valued predictor variables, x 1 ; : : :; x 10, and a real-valued response variable, y, which is modeled by y = X10 k=1 k x k + (9) where is zero-mean Gaussian noise with unknown variance 2. The 100 cases were generated from this model with 2 = 1 and with 1 = 1; 2 = 0:5; 3 =?0:5, and k = 0; 4 k 10. The predictor variables were generated from a multivariate Gaussian with unit variance for each x k and with correlations 0.9 between each pair of x k. The inverse variance 1= 2 was given a gamma prior with mean 1=0:1 2 and shape parameter 0.5. The prior distribution of k was Cauchy with hyperparameter, whose reciprocal was given a gamma prior with mean 1=0:05 2 and shape parameter 0.25. The two method were used to estimate the posterior prediction for a test set of size 100. The \correct" posterior prediction were estimated using Annealed Importance sampling with sample size 10000. As can be seen in Table 1, the average estimation error of Smoothed Importance sampling was uniformly lower than that of Annealed Importance sampling. It should also be noted that the modeling error, i.e. the squared distance between the Bayesian prediction and the correct test values, was 5.08, which is of the same order magnitude as the estimation error for n = 10. This conrms our claim that, in the context of Bayesian learning, high accuracy approximations are not needed.

6 3.2 MCMC sampling HMC algorithm The HMC algorithm [1] is one of the state-of-the-art asymptotically unbiased MCMC algorithms for sampling from complex distributions. The algorithm is expressed in terms of sampling from a canonical distribution dened in terms of the energy function E(q): P (q) / exp(?e(q)) (10) To allow the use of dynamical methods, a \momentum" variable, p, is introduced, with the same dimensionality as q. The canonical distribution over the \phase space" is dened to be: P (q; p) / exp(?h(q; p) = exp(?e(q)? p 2 i 2 ) (11) where p i ; i = 1; : : :; n are the momentum components. Sampling from the canonical distribution can be done using the stochastic dynamics method, in which simulation of the Hamiltonian dynamics of the system using leapfrog discretization is alternated with Gibbs sampling of the momentum. In the hybrid Monte Carlo method, the bias, introduced by the discretization, is eliminated by applying the Metropolis algorithm to the candidate states, generated by the stochastic dynamic transitions. The candidate state is accepted with probability max(1; exp(h)), where H is the dierence between the Hamiltonian in the beginning and and the end of the trajectory [5]. A modication of the Gibbs sampling of the momentum, proposed in [4], is to replace p each time by p cos() + sin(), where is a small angle and is distributed according to N(0; I). While keeping the canonical distribution invariant, this scheme, called momentum persistence, allows the use of shorter (hence cheaper) trajectories. However, in order to insure invariance of the target distribution, the momentum has to be reversed in case the candidate state has been rejected by the Metropolis step. This causes occasional backtracking and slows the sampling down. Stabilized stochastic dynamics As an alternative to the HMC algorithm we consider stochastic dynamics with momentum persistence, but without the Metropolis step. In order to insure stability of the algorithm, if the momentum size grows beyond a certain percentile of its distribution (say, 99%), it is replaced using Gibbs sampling. The resulting Stabilized Stochastic Dynamics (SSD) algorithm is biased. However, since it avoids backtracking, it can produce a lower estimation error, as found in experiments described next. Sampling from an anisotropic Gaussian In many Bayesian learning problems, the parameter distribution is anisotropic, hence it is interesting to examine

k=2 k=3 k=4 k=5 n SSD HMC MIX SSD HMC MIX SSD HMC MIX SSD HMC MIX 1000 0.35 0.61 0.35 1.26 2.77 1.31 9.6 45.9 10.6 198 2668 182 10000 0.34 0.56 0.50 1.29 2.63 2.33 10.7 21.2 17.9 91 201 183 100000 0.33 0.58 0.57 1.24 2.78 2.83 10.2 22.5 23.3 99 213 207 Table 2. Average estimation error of the E Qfxg for dierent condition numbers, k, and sample sizes, n. The results are normalized by 1. n 7 the behavior of the two algorithms on anisotropic Gaussian distributions (the advantage of using Gaussian is that for many statistics of interest the expectation can be computed analytically). We compared the performance of HMC, SSD and mixture Markov Chain with p n t = 1; if t p 1000n 0; otherwise (12) on two-dimensional Gaussian distributions with condition number ranging from 10 2 to 10 5. Specically, the weighted squared error: Err(x) = Err(x 1 ; x 2 ) = ((x 1? 10) 2 + 10 k x 2 2)=2; k = 2; 3; 4; 5 (13) was used as an energy function. The initial distribution for the rst state of the chain was an isotropic Gaussian N(0; I). All three algorithms used momentum persistence with cos() = 0:95 and dynamic transitions consisting of 10 leapfrog steps. Following [7], the discretization timestep was chosen so as to keep the rejection rate in HMC below 5%. For each combination of k and n (sample size), the simulation was performed 1000 times (using the same random starting value for all three algorithms). The rst 10% of each sample were discarded and the averages x and Err(x) were calculated using the remaining 90%. The estimation error of x was calculated using (13), which gives a weighted squared distance to the true mean. The correct value of E Q ferr(x)g can be calculated analytically in this case - it is equal to 1 - hence, the squared estimation error of Err(x) could be computed as well. The results, normalized by 1, are reported in tables 2 and 3. The estimation n error of E Q fxg is uniformly smaller for SSD than for HMC. This is apparently caused by the fact that the asymptotic bias in x, introduced by SSD, is negligible. As to Err(x), SSD produces better estimates when the sample size is relatively small, but as n grows, the inuence of the bias makes it inferior. Mixture Markov Chain, on the other hand, produced results better than HMC for n = 1000, and comparable to HMC (or slightly better) for larger n. It should also be noted that for k = 5; n = 1000 all three algorithms failed to converge, but SSD and Mixture Markov Chain still produced considerably better results than HMC.

8 k=2 k=3 k=4 k=5 n SSD HMC MIX SSD HMC MIX SSD HMC MIX SSD HMC MIX 1000 16.1 19.7 14.3 16.6 21.9 19.2 24.0 669.3 24.9 516.9 45528.5 495.5 10000 17.1 21.1 18.0 27.8 19.6 21.6 36.3 33.6 31.0 81.4 122.9 108.2 100000 27.8 21.6 19.4 124.6 22.1 19.8 185.2 30.2 32.7 222.4 118.1 120.0 Table 3. Average estimation error of the E QfErr(x)g for dierent condition numbers, k, and sample sizes, n. The results are normalized by 1 n. 4 Conclusion We have shown that in Monte Carlo estimation there is a \bias-variance dilemma", which has been largely overlooked. By means of numerical examples, we have demonstrated that bias correcting procedures can, in fact, increase the estimation error. As an alternative, an approximate (possibly asymptotically biased) estimation algorithms, with lower variance and convergence bias should be considered. Once the unbiasedness requirement is removed, a whole range of new possibilities for designing sampling algorithms opens up, such as automatic discretization step selection, dierent annealing schedules, alternative discretization schemes etc. References [1] S. Duane, A. D. Kennedy, B. J. Pendleton, and D. Roweth. Hybrid Monte Carlo. Physics Letters B, 195:216{222, 1987. [2] W. R. Gilks, S. Richardson, and D. J. Spiegelhalter, editors. Markov Chain Monte Carlo in Practice. Chapman&Hall, 1996. [3] W. Hardle. Applied nonparametric regression. Cambridge University Press, 1990. [4] A. M. Horowitz. A generalized guided Monte Carlo algorithm. Physics Letters B, 268:247{252, 1991. [5] R. M. Neal. Bayesian Learning for Neural Networks. Springer-Verlag, 1996. [6] R. M. Neal. Annealed importance sampling. Technical Report No. 9805, Dept. of Statistics, University of Toronto, 1998. [7] C. Rasmussen. A Practical Monte Carlo Implementation of Bayesian Learning. In D. S. Touretzky, M. C. Mozer, and M. E. Hasselmo, editors, Advances in Neural Information Processing Systems 8. MIT Press, 1996.