<p><div><div><div><div data-show-faces="false" data-height="21" data-width="100" data-layout="button_count" data-send="true" data-href="https://www.r-bloggers.com/hamiltonian-tails/"></div></div><div></div></div><div></div></div>
<div>
(This article was first published on <strong><a href="https://xianblog.wordpress.com/2018/07/17/hamiltonian-tails/"> R – Xi'an's Og</a></strong>, and kindly contributed to <a rel="nofollow" href="https://www.r-bloggers.com/">R-bloggers)</a> </div>
<blockquote>
<p><span><em>“We demonstrate HMC’s sensitivity to these parameters by sampling from a bivariate Gaussian with correlation coefficient 0.99. We consider three settings (ε,L) = {(0.16; 40); (0.16; 50); (0.15; 50)}”</em> Ziyu Wang, Shakir Mohamed, and Nando De Freitas. 2013<em><br>
</em></span></p>
</blockquote>
<p><strong>I</strong>n an experiment with my PhD student Changye Wu (who wrote all R codes used below), we looked back at a strange feature in an <a rel="nofollow" href="https://dl.acm.org/citation.cfm?id=3043100" target="_blank">2013 ICML paper</a> by Wang, Mohamed, and De Freitas. Namely, a rather poor performance of an Hamiltonian Monte Carlo (leapfrog) algorithm on a two-dimensional strongly correlated Gaussian target, for very specific values of the parameters (ε,L) of the algorithm.</p>
<p><img data-orig-file="https://xianblog.files.wordpress.com/2018/06/wamodef.jpeg" data-orig-size="725,327" data-medium-file="https://xianblog.files.wordpress.com/2018/06/wamodef.jpeg?w=300" data-attachment-id="36275" data-image-meta="{" data-image-description="" src="https://xianblog.files.wordpress.com/2018/06/wamodef.jpeg?w=450&h=203&fit=450%2C203&resize=450%2C203" data-permalink="https://xianblog.wordpress.com/2018/07/17/hamiltonian-tails/wamodef/" data-large-file="https://xianblog.files.wordpress.com/2018/06/wamodef.jpeg?w=450&amp;h=203&amp;fit=450%2C203&amp;resize=450%2C203" alt="" data-image-title="" sizes="(max-width: 450px) 100vw, 450px" width="450" data-comments-opened="1" class="wp-image-36275" data-recalc-dims="1" height="203">The Gaussian target associated with this sample stands right in the middle of the two clouds, as identified by Wang et al. And the leapfrog integration path for (ε,L)=(0.15,50)</p>
<p><img data-orig-file="https://xianblog.files.wordpress.com/2018/06/wamodef1.jpeg" data-orig-size="725,327" data-medium-file="https://xianblog.files.wordpress.com/2018/06/wamodef1.jpeg?w=300" data-attachment-id="36277" data-image-meta="{" data-image-description="" src="https://xianblog.files.wordpress.com/2018/06/wamodef1.jpeg?w=450&h=203&fit=450%2C203&resize=450%2C203" data-permalink="https://xianblog.wordpress.com/2018/07/17/hamiltonian-tails/wamodef-2/" data-large-file="https://xianblog.files.wordpress.com/2018/06/wamodef1.jpeg?w=450&amp;h=203&amp;fit=450%2C203&amp;resize=450%2C203" alt="" data-image-title="WaMoDeF" sizes="(max-width: 450px) 100vw, 450px" width="450" data-comments-opened="1" class="wp-image-36277" data-recalc-dims="1" height="203">keeps jumping between the two ridges (or tails) , with no stop in the middle. Changing ever so slightly (ε,L) to (ε,L)=(0.16,40) does not modify the path very much</p>
<p><img data-orig-file="https://xianblog.files.wordpress.com/2018/06/wamodef2.jpeg" data-orig-size="725,327" data-medium-file="https://xianblog.files.wordpress.com/2018/06/wamodef2.jpeg?w=300" data-attachment-id="36278" data-image-meta="{" data-image-description="" src="https://xianblog.files.wordpress.com/2018/06/wamodef2.jpeg?w=450&h=203&fit=450%2C203&resize=450%2C203" data-permalink="https://xianblog.wordpress.com/2018/07/17/hamiltonian-tails/wamodef-3/" data-large-file="https://xianblog.files.wordpress.com/2018/06/wamodef2.jpeg?w=450&amp;h=203&amp;fit=450%2C203&amp;resize=450%2C203" alt="" data-image-title="WaMoDeF" sizes="(max-width: 450px) 100vw, 450px" width="450" data-comments-opened="1" class="wp-image-36278" data-recalc-dims="1" height="203">but the HMC output is quite different since the cloud then sits right on top of the target</p>
<p><img data-orig-file="https://xianblog.files.wordpress.com/2018/06/wamodef5.jpeg" data-orig-size="725,327" data-medium-file="https://xianblog.files.wordpress.com/2018/06/wamodef5.jpeg?w=300" data-attachment-id="36281" data-image-meta="{" data-image-description="" src="https://xianblog.files.wordpress.com/2018/06/wamodef5.jpeg?w=450&h=203&fit=450%2C203&resize=450%2C203" data-permalink="https://xianblog.wordpress.com/2018/07/17/hamiltonian-tails/wamodef-4/" data-large-file="https://xianblog.files.wordpress.com/2018/06/wamodef5.jpeg?w=450&amp;h=203&amp;fit=450%2C203&amp;resize=450%2C203" alt="" data-image-title="WaMoDeF" sizes="(max-width: 450px) 100vw, 450px" width="450" data-comments-opened="1" class="wp-image-36281" data-recalc-dims="1" height="203"></p>
<p>with no clear explanation except for a sort of periodicity in the leapfrog sequence associated with the velocity generated at the start of the code. Looking at the Hamiltonian values for (ε,L)=(0.15,50)</p>
<p><img data-orig-file="https://xianblog.files.wordpress.com/2018/06/wamodef8.jpeg" data-orig-size="725,327" data-medium-file="https://xianblog.files.wordpress.com/2018/06/wamodef8.jpeg?w=300" data-attachment-id="36284" data-image-meta="{" data-image-description="" src="https://xianblog.files.wordpress.com/2018/06/wamodef8.jpeg?w=450&h=203&fit=450%2C203&resize=450%2C203" data-permalink="https://xianblog.wordpress.com/2018/07/17/hamiltonian-tails/wamodef-5/" data-large-file="https://xianblog.files.wordpress.com/2018/06/wamodef8.jpeg?w=450&amp;h=203&amp;fit=450%2C203&amp;resize=450%2C203" alt="" data-image-title="WaMoDeF" sizes="(max-width: 450px) 100vw, 450px" width="450" data-comments-opened="1" class="wp-image-36284" data-recalc-dims="1" height="203">and for (ε,L)=(0.16,40)</p>
<p><img data-orig-file="https://xianblog.files.wordpress.com/2018/06/wamodef7.jpeg" data-orig-size="725,327" data-medium-file="https://xianblog.files.wordpress.com/2018/06/wamodef7.jpeg?w=300" data-attachment-id="36283" data-image-meta="{" data-image-description="" src="https://xianblog.files.wordpress.com/2018/06/wamodef7.jpeg?w=450&h=203&fit=450%2C203&resize=450%2C203" data-permalink="https://xianblog.wordpress.com/2018/07/17/hamiltonian-tails/wamodef-6/" data-large-file="https://xianblog.files.wordpress.com/2018/06/wamodef7.jpeg?w=450&amp;h=203&amp;fit=450%2C203&amp;resize=450%2C203" alt="" data-image-title="WaMoDeF" sizes="(max-width: 450px) 100vw, 450px" width="450" data-comments-opened="1" class="wp-image-36283" data-recalc-dims="1" height="203">does not help, except to point at a sequence located far in the tails of this Hamiltonian, surprisingly varying when supposed to be constant. At first, we thought the large value of ε was to blame but much smaller values still return poor convergence performances. As below for (ε,L)=(0.01,450)</p>
<p><img data-orig-file="https://xianblog.files.wordpress.com/2018/06/wamodef9.jpeg" data-orig-size="725,327" data-medium-file="https://xianblog.files.wordpress.com/2018/06/wamodef9.jpeg?w=300" data-attachment-id="36287" data-image-meta="{" data-image-description="" src="https://xianblog.files.wordpress.com/2018/06/wamodef9.jpeg?w=450&h=203&fit=450%2C203&resize=450%2C203" data-permalink="https://xianblog.wordpress.com/2018/07/17/hamiltonian-tails/wamodef-7/" data-large-file="https://xianblog.files.wordpress.com/2018/06/wamodef9.jpeg?w=450&amp;h=203&amp;fit=450%2C203&amp;resize=450%2C203" alt="" data-image-title="WaMoDeF" sizes="(max-width: 450px) 100vw, 450px" width="450" data-comments-opened="1" class="wp-image-36287" data-recalc-dims="1" height="203"></p>
	<p>
<div>
<div>To <strong>leave a comment</strong> for the author, please follow the link and comment on their blog: <strong><a href="https://xianblog.wordpress.com/2018/07/17/hamiltonian-tails/"> R – Xi'an's Og</a></strong>.</div>
<hr>
<a rel="nofollow" href="https://www.r-bloggers.com/">R-bloggers.com</a> offers <strong><a rel="nofollow" href="https://feedburner.google.com/fb/a/mailverify?uri=RBloggers">daily e-mail updates</a></strong> about <a rel="nofollow" href="https://www.r-project.org/" title="The R Project for Statistical Computing">R</a> news and <a rel="nofollow" href="https://www.r-bloggers.com/search/tutorial" title="R tutorials">tutorials</a> on topics such as: <a rel="nofollow" href="https://www.r-bloggers.com/search/data%20science" title="Data science">Data science</a>, <a rel="nofollow" href="https://www.r-bloggers.com/search/Big%20Data" title="Big Data">Big Data, <a rel="nofollow" href="https://www.r-users.com/" title="R jobs">R jobs</a>, visualization (<a rel="nofollow" href="https://www.r-bloggers.com/search/ggplot2" title="ggplot and ggplot2 tutorials">ggplot2</a>, <a rel="nofollow" href="https://www.r-bloggers.com/search/boxplot" title="Boxplots using lattice and ggplot2 tutorials">Boxplots</a>, <a rel="nofollow" href="https://www.r-bloggers.com/search/map" title="Maps and gis">maps</a>, <a rel="nofollow" href="https://www.r-bloggers.com/search/animation" title="Animation in R">animation</a>), programming (<a rel="nofollow" href="https://www.r-bloggers.com/search/RStudio" title="RStudio IDE for R">RStudio</a>, <a rel="nofollow" href="https://www.r-bloggers.com/search/sweave" title="Sweave and literate programming">Sweave</a>, <a rel="nofollow" href="https://www.r-bloggers.com/search/LaTeX" title="LaTeX in R">LaTeX</a>, <a rel="nofollow" href="https://www.r-bloggers.com/search/SQL" title="SQL and databases">SQL</a>, <a rel="nofollow" href="https://www.r-bloggers.com/search/eclipse" title="Eclipse IDE for R">Eclipse</a>, <a rel="nofollow" href="https://www.r-bloggers.com/search/git" title="git and github, Version Control System">git</a>, <a rel="nofollow" href="https://www.r-bloggers.com/search/hadoop" title="Large data in R using Hadoop">hadoop</a>, <a rel="nofollow" href="https://www.r-bloggers.com/search/Web+Scraping" title="Web Scraping of google, facebook, yahoo, twitter and more using R">Web Scraping</a>) statistics (<a rel="nofollow" href="https://www.r-bloggers.com/search/regression" title="Regressions and ANOVA analysis tutorials">regression</a>, <a rel="nofollow" href="https://www.r-bloggers.com/search/PCA" title="principal component analysis tutorial">PCA</a>, <a rel="nofollow" href="https://www.r-bloggers.com/search/time+series" title="Time series">time series</a>, <a rel="nofollow" href="https://www.r-bloggers.com/search/trading" title="finance trading">trading</a>) and more...
<img alt="" width="1" src="http://feeds.feedburner.com/~r/RBloggers/~4/OZO9xElS3Ws" height="1"></a></div>