- Book Chapter
- 10.1016/b978-0-44-319035-3.00020-3
8 - Adaptive noncanonical Hamiltonian Monte Carlo
- Jan 01, 2023
- Hamiltonian Monte Carlo Methods in Machine Learning
- Tshilidzi Marwala + 2 more +2
8 - Adaptive noncanonical Hamiltonian Monte Carlo
Magnetic Hamiltonian Monte Carlo (MHMC) is a Markov Chain Monte Carlo method that expands on Hamiltonian Monte Carlo (HMC) by adding a magnetic field to Hamiltonian dynamics. This magnetic field offers a great deal of flexibility over HMC and encourages more efficient exploration of the target posterior. This results in faster convergence and lower autocorrelations in the generated samples compared to HMC. However, as with HMC, MHMC is sensitive to the user specified trajectory length and step size. Automatically setting the parameters of MHMC is yet to be considered in the literature. In this work, we present the Adaptive MHMC (A-MHMC) algorithm which extends MHMC in that it automatically sets the parameters of MHMC and thus eliminates the need for the user to manually set a trajectory length and step size. The trajectory length adaptation is based on an extension of the No-U-Turn Sampler (NUTS) methodology to incorporate the magnetic field present in MHMC, while the step size is set via dual averaging during the burn-in period. Empirical results based on experiments performed on jump diffusion processes calibrated to real world financial market data, a simulation study using multivariate Gaussian distributions and real world benchmark datasets modelled using Bayesian Logistic Regression show that A-MHMC outperforms MHMC and NUTS on an effective sample size basis. In addition, A-MHMC provides significant relative speed up (up to 40 times) over MHMC and produces similar time normalised effective samples sizes relative to NUTS.
8 - Adaptive noncanonical Hamiltonian Monte Carlo
8 - Adaptive noncanonical Hamiltonian Monte Carlo
Efficient Bayesian inference with latent Hamiltonian neural networks in No-U-Turn Sampling
Efficient Bayesian inference with latent Hamiltonian neural networks in No-U-Turn Sampling
The Hamiltonian Monte Carlo Algorithm in Parameter Estimation and Uncertainty Quantification
The Hamiltonian Monte Carlo (HMC) algorithm is a Markov Chain Monte Carlo (MCMC) technique, which combines the advantages of Hamiltonian dynamics methods and Metropolis Monte Carlo approach, to sample from complex distributions. The HMC algorithm incorporates gradient information in the dynamic trajectories and thus suppresses the random walk nature in traditional Markov chain simulation methods. This ensures rapid mixing, faster convergence, and improved efficiency of the Markov chain. The leapfrog method is generally used in discrete simulation of the dynamic transitions. In this paper, we refer to this as the leapfrog–HMC. The primary goal of this paper is to present the HMC algorithm as a tool for rapid sampling of high dimensional and complex distributions, and demonstrate its advantages over the classical Metropolis Monte Carlo technique. We demonstrate that the use of an adaptive–step discretization scheme in simulating the dynamic transitions results in an algorithm which significantly outperforms the leapfrog–HMC algorithm. Relevance to reservoir parameter estimation and uncertainty quantification will be discussed.
Read moreAdaptively Setting the Path Length for Separable Shadow Hamiltonian Hybrid Monte Carlo
Hybrid Monte Carlo (HMC) has been widely applied to numerous posterior inference problems in machine learning and statistics. HMC has two main practical issues, the first is the deterioration in acceptance rates as the system size increases and the second is its sensitivity to two user-specified parameters: the step size and trajectory length. The former issue is addressed by sampling from an integrator-dependent modified or shadow density and compensating for the induced bias via importance sampling. The latter issue is addressed by adaptively setting the HMC parameters, with the state-of-the-art method being the No-U-Turn Sampler (NUTS). We combine the benefits of NUTS with those attained by sampling from the shadow density, by adaptively setting the trajectory length and step size of Separable Shadow Hamiltonian Hybrid Monte Carlo (S2HMC). This leads to a new algorithm, adaptive S2HMC (A-S2HMC), that shows improved performance over S2HMC and NUTS across various targets and leaves the target density invariant.
Read moreIncorporating the ChEES Criterion Into Sequential Monte Carlo Samplers
Markov chain Monte Carlo (MCMC) methods are a powerful but computationally expensive way of performing nonparametric Bayesian inference. MCMC proposals which utilise gradients, such as Hamiltonian Monte Carlo (HMC), can better explore the parameter space of interest if the additional hyperparameters are chosen well. The No-U-Turn Sampler (NUTS) is a variant of HMC which is extremely effective at selecting these hyper-parameters but is slow to run and is not suited to GPU architectures. An alternative to NUTS, Change in the Estimator of the Expected Square HMC (ChEES-HMC) was shown not only to run faster than NUTS on GPU but also sample from posteriors more efficiently. Sequential Monte Carlo (SMC) samplers are another sampling method which instead output weighted samples from the posterior. They are very amenable to parallelisation and therefore being run on GPUs while having additional flexibility in their choice of proposal over MCMC. We incorporate (ChEES-HMC) as a proposal into SMC samplers and demonstrate competitive but faster performance than NUTS on a number of tasks.
Read moreAlgorithm and Hardware Co-Design for FPGA Acceleration of Hamiltonian Monte Carlo Based No-U-Turn Sampler
Monte Carlo (MC) methods are widely used in many research areas such as physical simulation, statistical analysis, and machine learning. Application of MC methods requires drawing fast mixing samples from a given probability distribution. Among existing sampling methods, the Hamiltonian Monte Carlo (HMC) utilizes gradient information during Hamiltonian simulation and can produce fast mixing samples at the highest efficiency. However, without carefully chosen simulation parameters for a specific problem, HMC generally suffers from simulation locality and computation waste. As a result, the No-U-Turn Sampler (NUTS) has been proposed to automatically tune these parameters during simulation and is the current state-of-the-art sampling algorithm. However, application of NUTS requires frequent gradient calculation of a given distribution and high-volume vector processing, especially for large-scale problems, leading to drawing an expensively large number of samples and a desire of hardware acceleration. While some hardware acceleration works have been proposed for traditional Markov Chain Monte Carlo (MCMC) and HMC methods, there is no existing work targeting hardware acceleration of the NUTS algorithm. In this paper, we present the first NUTS accelerator on FPGA while addressing the high complexity of this state-of-the-art algorithm. Our hardware and algorithm co-optimizations include an incremental resampling technique which leads to a more memory efficient architecture and pipeline optimization for multi-chain sampling to maximize the throughput. We also explore three levels of parallelism in the NUTS accelerator to further boost performance. Compared with optimized C++ NUTS package: RSTAN, our NUTS accelerator can reach a maximum speedup of 50.6X and an energy improvement of 189.7X.
Read moreLocally Scaled and Stochastic Volatility Metropolis– Hastings Algorithms
Markov chain Monte Carlo (MCMC) techniques are usually used to infer model parameters when closed-form inference is not feasible, with one of the simplest MCMC methods being the random walk Metropolis–Hastings (MH) algorithm. The MH algorithm suffers from random walk behaviour, which results in inefficient exploration of the target posterior distribution. This method has been improved upon, with algorithms such as Metropolis Adjusted Langevin Monte Carlo (MALA) and Hamiltonian Monte Carlo being examples of popular modifications to MH. In this work, we revisit the MH algorithm to reduce the autocorrelations in the generated samples without adding significant computational time. We present the: (1) Stochastic Volatility Metropolis–Hastings (SVMH) algorithm, which is based on using a random scaling matrix in the MH algorithm, and (2) Locally Scaled Metropolis–Hastings (LSMH) algorithm, in which the scaled matrix depends on the local geometry of the target distribution. For both these algorithms, the proposal distribution is still Gaussian centred at the current state. The empirical results show that these minor additions to the MH algorithm significantly improve the effective sample rates and predictive performance over the vanilla MH method. The SVMH algorithm produces similar effective sample sizes to the LSMH method, with SVMH outperforming LSMH on an execution time normalised effective sample size basis. The performance of the proposed methods is also compared to the MALA and the current state-of-art method being the No-U-Turn sampler (NUTS). The analysis is performed using a simulation study based on Neal’s funnel and multivariate Gaussian distributions and using real world data modeled using jump diffusion processes and Bayesian logistic regression. Although both MALA and NUTS outperform the proposed algorithms on an effective sample size basis, the SVMH algorithm has similar or better predictive performance when compared to MALA and NUTS across the various targets. In addition, the SVMH algorithm outperforms the other MCMC algorithms on a normalised effective sample size basis on the jump diffusion processes datasets. These results indicate the overall usefulness of the proposed algorithms.
Read moreEarly postnatal care uptake and its associated factors following childbirth in East Africa—a Bayesian hierarchical modeling approach
BackgroundThe postnatal period is a critical period for both mothers and their newborns for their health. Lack of early postnatal care (PNC) services during a 2-day period is a life-threatening situation for both the mother and the babies. However, no data have been examined for PNCs in East Africa. Hence, using the more flexible Bayesian multilevel modeling approach, this study aims to investigate the pooled prevalence and potential factors for PNC utilization among women after delivery in East African countries.MethodsWe retrieved secondary data from the Kids Record (KR) demographic and health surveys (DHS) data from 2015 to 2022 from 10 East African countries. A total of 77,052 weighted women were included in the study. We used R 4.3.2 software for analysis. We fitted Bayesian multilevel logistic regression models. Techniques such as Rhat, effective sample size, density, time series, autocorrelation plots, widely applicable information criterion (WAIC), deviance information criterion (DIC), and Markov Chain Monte-Carlo (MCMC) simulation were used to estimate the model parameters using Hamiltonian Monte-Carlo (HMC) and its extensions, No-U-Turn Sampler (NUTS) techniques. An adjusted odds ratio (AOR) with a 95% credible interval (CrI) in the multivariable model to select variables that have a significant association with PNC was used.ResultsThe overall pooled prevalence of PNC within 48 hrs. of delivery was about 52% (95% CrI: 39, 66). A higher rate of PNC usage was observed among women aged 25–34 years (AOR = 1.21; 95% CrI: 1.15, 1.27) and 35–49-years (AOR = 1.61; 95% CrI: 1.5, 1.72) as compared to women aged 15–24 years; similarly, women who had achieved primary education (AOR = 1.96; 95% CrI: 1.88, 2.05) and secondary/higher education (AOR = 3.19; 95% CrI: 3.03, 3.36) as compared to uneducated women; divorced or widowed women (AOR = 0.83; 95% CrI: 0.77, 0.89); women who had currently working status (AOR = 0.9; 95% CrI: 0.87, 0.93); poorer women (AOR = 0.88; 95% CrI: 0.84, 0.92), middle-class women (AOR = 0.83; 95% CrI: 0.79, 0.87), richer women (AOR = 0.77; 95% CrI: 0.73, 0.81), and richest women (AOR = 0.59; 95% CrI: 0.55, 0.63) as compared to the poorest women; women who had media exposure (AOR = 1.32; 95% CrI: 1.27, 1.36), were having 3–5 children (AOR = 0.89; 95% CrI: 0.84, 0.94), had >5 children (AOR = 0.69; 95% CrI: 0.64, 0.75), had first birth at age < 20 years (AOR = 0.82; 95% CrI: 0.79, 0.84), had at least one ANC visit (AOR = 1.93; 95% CrI: 1.8, 2.08), delivered at health facilities (AOR = 2.57; 95% CrI: 2.46, 2.68), had average birth size (AOR = 0.94; 95% CrI: 0.91, 0.98) and small birth size child (AOR = 0.88; 95% CrI: 0.84, 0.92), had twin newborns (AOR = 1.15; 95% CrI: 1.02, 1.3), and fourth and above birth order (AOR = 0.88; 95% CrI: 0.82, 0.95) were individual-driven women who have been independently associated with PNC, respectively. Regarding community-level variables, rural women (AOR = 0.76; 95% CrI: 0.72, 0.79), high media exposure communities (AOR = 1.1; 95% CrI: 1.04, 1.18), communities with high wealth levels (AOR = 0.88 95% CrI: 0.83, 0.94), communities with high antenatal care (ANC) utilization (AOR = 1.13, 95% CrI: 1.07, 1.19), and long distance to health facilities (AOR = 1.5; 95% CrI: 1.38, 1.63) were among the community factors associated with PNC, respectively.ConclusionOne of the significant public health priorities in East Africa continues to be the underutilization of immediate PNC. The government ought to prioritize improving maternity and child health services, collaborating with interested parties in the area, reducing health disparities, educating mothers about child health, and other connected issues that are very beneficial.
Read moreSemi-Parametric Distributional Regression in Forestry and Ecology
Recent advances in machine learning software, such as automatic differentiation and just-in-time (JIT) compilation, have significantly changed machine learning research. They have accelerated model development and contributed to the emergence of AI tools such as the chatbot ChatGPT and the image generator DALL-E. In the context of probabilistic programming, similar methods are used to implement efficient gradient-based inference algorithms applicable to a broad range of Bayesian models, e.g. Hamiltonian Monte Carlo (HMC) and the No-U-Turn Sampler (NUTS). This cumulative dissertation includes three research papers that combine methods from machine learning and probabilistic programming with semi-parametric regression models from applied statistics. This combination enables the development of novel models with semi-parametric regression predictors and the corresponding inference algorithms. Moreover, various applications in forestry and ecology are presented. In the first paper, we present the probabilistic programming framework Liesel, which aims to provide a software basis for efficient and reliable research in applied statistics, suitable for the implementation of complex models and inference algorithms. The software focuses on semi-parametric regression predictors with linear, non-linear, random and spatial covariate effects. A typical workflow with Liesel would be: (1) configuration of a model graph as a baseline, e.g. using Liesel's R interface, (2) adaptation of the model graph to implement new research ideas, and (3) fully Bayesian inference using the included Markov chain Monte Carlo (MCMC) library, either with a standard algorithm or a user-defined variant. Samplers such as HMC and NUTS are supported and can be combined with conventional methods, e.g. iterative weighted least squares (IWLS) proposals and Gibbs updates. Liesel is written in Python and uses the machine learning library JAX as a backend. The second and third paper discuss extensions and applications of semi-parametric distributional regression in forestry and ecology. The new models arise from the introduction of certain response structures into a regression context, e.g. in the form of Gaussian processes (GPs) with parametric mean and covariance functions. We apply the GP model to measurements from high-resolution circumference dendrometers. These instruments record both the irreversible growth of tree stems as well as the reversible shrinking and swelling due to the water content. With our model, the data can be decomposed into a permanent and a temporary component, and differences between trees and years can be explained by covariates. In the last paper, we propose the multi-species count model (MSCM) to estimate relationships between environmental conditions and different indices of species diversity. We use the model with semi-parametric regression predictors to assess the effects of European beech, Norway spruce and Douglas fir on the species diversity of various taxa, based on data collected in the Research Training Group (RTG) 2300 and taking into account spatial correlation.
Read moreDaily meal frequency and its associated factors among children aged 6–23 months in Ethiopia: a Bayesian hierarchical Poisson model
BackgroundInadequate feeding frequency during the early childhood period is responsible for more than two-thirds of global child deaths. Evidence on the rate of daily meal frequency among infants and young children at the national level is crucial for developing targeted interventions to improve feeding practices. Hence, this study aimed to identify factors associated with the rate of daily meal frequency (DMF) among children aged 6–23 months in Ethiopia.MethodsWe retrieved secondary data from the Kids record (KR) of the Ethiopian Mini Demographic and Health Survey (MDHS) dataset. A total of 1,264 children aged 6–23 months were included in the study. A Bayesian hierarchical Poisson model was employed. Model convergence was checked via Rhat, effective sample size, density plots, terrace plots, and autocorrelation plots, and all the results were confirmed. We used the widely applicable information criterion (WAIC) and leave-one-out cross-validation (LOO) for model comparison. The model parameters were estimated via special Markov chain Monte Carlo (MCMC) simulation techniques called Hamiltonian Monte Carlo (HMC) and its extension, the no-U-turn sampler (NUTS). An adjusted incidence rate ratio (AIRR) with a 95% credible interval (CrI) in the multivariable model was used to select variables that had a significant association with the rate of daily meal frequency. The data were analyzed via R software version 4.3.1.ResultsThe mean and standard deviation of the DMF were 3.36 and 1.60, respectively. The rate of DMF was 1.17 times greater (AIRR = 1.17, 95% CrI: 0.997, 1.381) in children whose mothers had a secondary/higher educational level than in those whose mothers had no education. Kids currently being breastfed have a lower rate of DMF (AIRR = 0.88, 95% CI: 0.798, 0.979) by 10% than those who are not currently breastfeeding. Compared with children between the ages of 6–8 months, those between 9 and 11 months (AIRR = 1.55 95% CrI: 1.374, 1.754), 12–17 months (AIRR = 1.72, 95% CrI: 1.543, 1.911), and 18–23 months (AIRR = 95% CrI: 1.90, 1.692, 2.125) had 55, 72 and 90% higher rates of DMF, respectively. In the Afar region (IRR = 0.77, 95% CI: 0.615, 0.982), Somalia (AIRR = 0.83, 95% CrI: 0.682, 1.01), Benishangul (AIRR = 0.8, 95% CrI: 0.639, 0.994), Southern nation nationality and people’s region (SNNPR) (AIRR = 0.73, 95% CrI: 0.596, 0.894), and (AIRR = 0.73, 95% CrI: 0.572, 0.925) decrease the daily meal frequency by 33, 17, 20, 27 and 27%, respectively, compared with that of children from Tigray.Conclusion and recommendationThe rate of DMF was low in Ethiopia and exhibited a significant clustering pattern across the country. These findings stress the need for tailored interventions addressing regional inequities, promoting age-specific nutrition, supporting maternal education, and empowering working women to improve children’s nutritional intake and ensure more equitable access to meals across Ethiopia.
Read moreFast Hamiltonian Monte Carlo Using GPU Computing
In recent years, the Hamiltonian Monte Carlo (HMC) algorithm has been found to work more efficiently compared to other popular Markov chain Monte Carlo (MCMC) methods (such as random walk Metropolis–Hastings) in generating samples from a high-dimensional probability distribution. HMC has proven more efficient in terms of mixing rates and effective sample size than previous MCMC techniques, but still may not be sufficiently fast for particularly large problems. The use of GPUs promises to push HMC even further greatly increasing the utility of the algorithm. By expressing the computationally intensive portions of HMC (the evaluations of the probability kernel and its gradient) in terms of linear or element-wise operations, HMC can be made highly amenable to the use of graphics processing units (GPUs). A multinomial regression example demonstrates the promise of GPU-based HMC sampling. Using GPU-based memory objects to perform the entire HMC simulation, most of the latency penalties associated with transferring data from main to GPU memory can be avoided. Thus, the proposed computational framework may appear conceptually very simple, but has the potential to be applied to a wide class of hierarchical models relying on HMC sampling. Models whose posterior density and corresponding gradients can be reduced to linear or element-wise operations are amenable to significant speed ups through the use of GPUs. Analyses of datasets that were previously intractable for fully Bayesian approaches due to the prohibitively high computational cost are now feasible using the proposed framework.
Read moreMarkov chain Monte Carlo algorithms with sequential proposals
We explore a general framework in Markov chain Monte Carlo (MCMC) sampling where sequential proposals are tried as a candidate for the next state of the Markov chain. This sequential-proposal framework can be applied to various existing MCMC methods, including Metropolis–Hastings algorithms using random proposals and methods that use deterministic proposals such as Hamiltonian Monte Carlo (HMC) or the bouncy particle sampler. Sequential-proposal MCMC methods construct the same Markov chains as those constructed by the delayed rejection method under certain circumstances. In the context of HMC, the sequential-proposal approach has been proposed as extra chance generalized hybrid Monte Carlo (XCGHMC). We develop two novel methods in which the trajectories leading to proposals in HMC are automatically tuned to avoid doubling back, as in the No-U-Turn sampler (NUTS). The numerical efficiency of these new methods compare favorably to the NUTS. We additionally show that the sequential-proposal bouncy particle sampler enables the constructed Markov chain to pass through regions of low target density and thus facilitates better mixing of the chain when the target density is multimodal.
Read moreProbabilistic geophysical inversion of complex resistivity measurements using the Hamiltonian Monte Carlo method
SUMMARY In this work, we introduce the probabilistic inversion of tomographic complex resistivity (CR) measurements using the Hamiltonian Monte Carlo (HMC) method. The posterior model distribution on which our approach operates accounts for the underlying complex-valued nature of the CR imaging problem accurately by including the individual errors of the measured impedance magnitude and phase, allowing for the application of independent regularization on the inferred subsurface conductivity magnitude and phase, and incorporating the effects of cross-sensitivities. As the tomographic CR inverse problem is nonlinear, of high dimension and features strong correlations between model parameters, efficiently sampling from the posterior model distribution is challenging. To meet this challenge we use HMC, a Markov-chain Monte Carlo method that incorporates gradient information to achieve efficient model updates. To maximize the benefit of a given number of forward calculations, we use the No-U-Turn sampler (NUTS) as a variant of HMC. We demonstrate the probabilistic inversion approach on a synthetic CR tomography measurement. The NUTS succeeds in creating a sample of the posterior model distribution that provides us with the ability to analyse correlations between model parameters and to calculate statistical estimators of interest, such as the mean model and the covariance matrix. Our results provide a strong basis for the characterization of the posterior model distribution and uncertainty quantification in the context of the tomographic CR inverse problem.
Read moreComparison between the Hamiltonian Monte Carlo method and the Metropolis–Hastings method for coseismic fault model estimation
A rapid source fault estimation and quantitative assessment of the uncertainty of the estimated model can elucidate the occurrence mechanism of earthquakes and inform disaster damage mitigation. The Bayesian statistical method that addresses the posterior distribution of unknowns using the Markov chain Monte Carlo (MCMC) method is significant for uncertainty assessment. The Metropolis–Hastings method, especially the Random walk Metropolis–Hastings (RWMH), has many applications, including coseismic fault estimation. However, RWMH exhibits a trade-off between the transition distance and the acceptance ratio of parameter transition candidates and requires a long mixing time, particularly in solving high-dimensional problems. This necessitates a more efficient Bayesian method. In this study, we developed a fault estimation algorithm using the Hamiltonian Monte Carlo (HMC) method, which is considered more efficient than the other MCMC method, but its applicability has not been sufficiently validated to estimate the coseismic fault for the first time. HMC can conduct sampling more intelligently with the gradient information of the posterior distribution. We applied our algorithm to the 2016 Kumamoto earthquake (MJMA 7.3), and its sampling converged in 2 × 104 samples, including 1 × 103 burn-in samples. The estimated models satisfactorily accounted for the input data; the variance reduction was approximately 88%, and the estimated fault parameters and event magnitude were consistent with those reported in previous studies. HMC could acquire similar results using only 2% of the RWMH chains. Moreover, the power spectral density (PSD) of each model parameter's Markov chain showed this method exhibited a low correlation with the subsequent sample and a long transition distance between samples. These results indicate HMC has advantages in terms of chain length than RWMH, expecting a more efficient estimation for a high-dimensional problem that requires a long mixing time or a problem using nonlinear Green’s function, which has a large computational cost.Graphical
Read moreA Comparison of MCMC Algorithms for the Bayesian Calibration of Building Energy Models for Building Simulation 2017 Conference
Random walk Metropolis and Gibbs sampling are Markov Chain Monte Carlo (MCMC) algorithms that are typically used for the Bayesian calibration of building energy models. However, these algorithms can be challenging to tune and achieve convergence when there is a large number of parameters. An alternative sampling method is Hamiltonian Monte Carlo (HMC) whose properties allow it to avoid the random walk behavior and converge to the target distribution more easily in complicated high-dimensional problems. Using a case study, we evaluate the effectiveness of three MCMC algorithms: (1) random walk Metropolis, (2) Gibbs sampling and (3) No-UTurn Sampler (NUTS) (Hoffman and Gelman, 2014), an extension of HMC. The evaluation was carried out using a Bayesian approach that follows Kennedy and O'Hagan (2001). We combine field and simulation data using the statistical formulation developed by Higdon et al. (2004). It was found that NUTS is more effective for the Bayesian calibration of building energy models as compared to random walk Metropolis and Gibbs sampling.
Read more