-
Notifications
You must be signed in to change notification settings - Fork 1
/
hmc_lecture.tex
1371 lines (1261 loc) · 56.7 KB
/
hmc_lecture.tex
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
955
956
957
958
959
960
961
962
963
964
965
966
967
968
969
970
971
972
973
974
975
976
977
978
979
980
981
982
983
984
985
986
987
988
989
990
991
992
993
994
995
996
997
998
999
1000
\documentclass[18pt]{beamer}
% Boolean flags for including / excluding some information.
\def\withInlineNote{0}
% if true, include the 'sticky note' style comments reminding the intentions.
\def\generalAcceptProbFormula{1}
% if true, include the acceptance probability when the reversible dynamics underlying the proposal is *not* volume-preserving.
%\usepackage{pgfpages} % For showing notes on the 2nd screen.
%\setbeameroption{show notes}
%\setbeameroption{hide notes} % Only slides
%\setbeameroption{show only notes} % Only notes
%\setbeameroption{show notes on second screen=right} % Both
\usetheme{Madrid} % [secheader]
\setbeamertemplate{footline}{}
\usefonttheme{professionalfonts}
\usepackage[english]{babel}
\usepackage{graphicx}
\usepackage[normalem]{ulem}
\usepackage{hyperref}
\usepackage{bm}
\usepackage{dsfont}
\usepackage{subcaption}
\usepackage{bbm}
\usepackage{calc} % For widthof command
\usepackage{xcolor}
\usepackage{tikz}
\usepackage{csquotes} % Necessary for biblatex.
\usepackage[
style=authoryear-comp,
maxcitenames=2,
natbib=true,
backend=bibtex
]{biblatex}
\makeatletter
\def\blx@maxline{77} % To deal with a bug in an older version of the biblatex package.
\makeatother
\renewbibmacro{in:}{} % Remove "in" before the journal title.
\renewbibmacro{volume+number+eid}{} % Get rid of the volume and number.
\DeclareFieldFormat*{journaltitle}{\textit{#1}.}
\DeclareFieldFormat*{pages}{}
\DeclareFieldFormat*{volume}{}
\DeclareFieldFormat*{urldate}{}
\newcommand{\fullauthorcite}[1]{
\AtNextCite{\defcounter{maxnames}{99}}
\fullcite{#1}
}
\addbibresource{hmc_lecture.bib}
% Packaged used only under specific conditions.
\if\generalAcceptProbFormula1 \usepackage{todonotes} \fi
\setbeamerfont{itemize/enumerate subbody}{size=\normalsize} %to set the body size
%\setbeamertemplate{frametitle}[default][center]
\setbeamertemplate{itemize subitem}{\normalsize\raise1.25pt\hbox{\donotcoloroutermaths$\blacktriangleright$}} %to set the symbol size
% HMC related macros
\newcommand{\position}{\theta}
\newcommand{\momentum}{p}
\newcommand{\bposition}{\bm{\position}}
\newcommand{\bmomentum}{\bm{\momentum}}
\newcommand{\Position}{\Theta}
\newcommand{\Momentum}{P}
\newcommand{\Mass}{\bm{M}}
\newcommand{\integrationTime}{\tau}
\newcommand{\nIntegrationStep}{L}
\newcommand{\stepsize}{\Delta t}
\newcommand{\acceptprob}{a}
\newcommand{\solutionOp}{\bm{\Psi}}
\newcommand{\involution}{\bm{R}}
% Math macros
\newcommand{\transpose}{\text{\raisebox{.5ex}{$\intercal$}}}
\newcommand{\diff}{{\rm d}}
\newcommand{\Diff}{\mathbf{D}}
\DeclareMathOperator*{\argmax}{argmax}
\DeclareMathOperator*{\argmin}{argmin}
% Probability / statistics macros
\newcommand{\eqDistribution}{\mathrel{\raisebox{-.2ex}{$\overset{\scalebox{.6}{$\, d$}}{=}$}}}
\newcommand{\given}{\, | \,}
\newcommand{\normal}{\mathcal{N}}
\newcommand{\proposalKernel}{Q}
\newcommand{\indep}{\protect\mathpalette{\protect\independenT}{\perp}}
\def\independenT#1#2{\mathrel{\rlap{$#1#2$}\mkern2mu{#1#2}}}
% Variable / Greek symbol macros
\newcommand{\y}{\bm{y}}
\newcommand{\x}{\bm{x}}
\newcommand{\I}{\bm{I}}
\newcommand{\bPhi}{\bm{\Phi}}
\newcommand{\bSigma}{\bm{\Sigma}}
\newcommand{\nparam}{d}
\newcommand{\lshrink}{\lambda}
\newcommand{\gshrink}{\tau}
% Utility macros
\newcommand{\inlineNote}[1]{%
\if\withInlineNote1%
\todo[inline]{#1}%
\fi%
}
\newcommand{\pauseWithoutSpace}{\par\pause\noindent}
% Fun macros
\newcommand{\shrug}[1][]{
\begin{tikzpicture}[baseline, x=0.8\ht\strutbox, y=0.8\ht\strutbox, line width=0.125ex, #1]
\def\arm{(-2.5,0.95) to (-2,0.95) (-1.9,1) to (-1.5,0) (-1.35,0) to (-0.8,0)};
\draw \arm;
\draw[xscale=-1] \arm;
\def\headpart{(0.6,0) arc[start angle=-40, end angle=40,x radius=0.6,y radius=0.8]};
\draw \headpart;
\draw[xscale=-1] \headpart;
\def\eye{(-0.075,0.15) .. controls (0.02,0) .. (0.075,-0.15)};
\draw[shift={(-0.3,0.8)}] \eye;
\draw[shift={(0,0.85)}] \eye;
% draw mouth
\draw (-0.1,0.2) to [out=15,in=-100] (0.4,0.95);
\end{tikzpicture}
}
% Custom environments
\newcommand{\defineWithinItemizeSpacing}{
\setlength{\abovedisplayskip}{.3\baselineskip}
\setlength{\belowdisplayskip}{.3\baselineskip}
}
\newenvironment{itemizedEquation}{
\defineWithinItemizeSpacing
\begin{equation}
}{
\end{equation} \ignorespacesafterend
}
\makeatletter
\newenvironment{itemizedEquation*}{
\defineWithinItemizeSpacing
\begin{equation*}
}{
\end{equation*} \ignorespacesafterend
}
\makeatother
\newenvironment{indented}{
\hfill \begin{minipage}{\dimexpr\textwidth-3ex}
}{
\end{minipage}
}
% Color definitions
\definecolor{jhuBlue}{RGB}{0, 45, 114} % "Heritage" blue; https://brand.jhu.edu/color/
\definecolor{navyblue}{rgb}{0.0, 0.0, 0.5}
\definecolor{turquoise}{rgb}{0.19, 0.84, 0.78}
\definecolor{mediumturquoise}{rgb}{0.28, 0.82, 0.8}
\definecolor{lava}{rgb}{0.81, 0.06, 0.13}
\colorlet{linkColor}{mediumturquoise}
\colorlet{highlightedTextColor}{lava}
% Set the color theme of the presentation
\usecolortheme[named=jhuBlue]{structure}
\colorlet{textcolor}{white}
\setbeamercolor{frametitle}{fg=textcolor}
\setbeamercolor{titlelike}{fg=textcolor}
\setbeamercolor{section in head/foot}{fg=textcolor}
%\colorlet{toccolor}{black}
%\setbeamercolor{section in toc}{fg=toccolor}
\setbeamercolor{bibliography entry author}{fg=black}
\setbeamercolor{bibliography entry title}{use=structure, fg=structure.fg}
\setbeamercolor{bibliography entry note}{fg=black}
% Block colors
\setbeamercolor{block title}{use=structure, fg=textcolor, bg=structure.fg}
\setbeamercolor{block body}{
parent=normal text, use=block title, bg=block title.bg!10}
%\setbeamercolor{block title}{bg=jhuBlue!100, fg=white}
\setbeamertemplate{enumerate items}[default]
\setbeamerfont*{itemize/enumerate body}{size=\normalsize}
\setbeamerfont*{itemize/enumerate subbody}{parent=itemize/enumerate body}
\setbeamerfont*{itemize/enumerate subsubbody}{parent=itemize/enumerate body}
\setbeamercovered{dynamic}
\setbeamercovered{invisible}
\beamertemplatenavigationsymbolsempty
% Insert table of content frames between sections automatically. See http://en.wikibooks.org/wiki/LaTeX/Presentations
\AtBeginSubsection[]
{
\begin{frame}
\frametitle{Table of Contents}
\tableofcontents[
currentsection,
sectionstyle=show/show,
subsectionstyle=show/shaded/hide
]
\end{frame}
}
\title[HMC: theory \& practice]{Hamiltonian Monte Carlo: Theory and Practice}
\author{Aki Nishimura}
\institute[]{Department of Biostatistics, Johns Hopkins University}
\date{}
\begin{document}
\frame{\titlepage}
\section{Introducing Hamiltonian Monte Carlo (HMC)}
\subsection{Why \& What to learn about HMC}
\frame{
\frametitle{What is HMC?}
\begin{itemize}
\item HMC is a state-of-the-art \textit{general-purpose} sampler, only requiring evaluation of the target log-density and its gradient.
\item Required computations can be done algorithmically and efficiently for probabilistic models (or, more precisely, Bayesian networks):
\begin{itemize}
\item density evaluation via \textit{computational (directed acyclic) graphs}
\item gradient via \textit{reverse mode differentiation} / \textit{back-propagation}
\end{itemize}
\begin{figure}
\centering
\hspace{-.1\linewidth}
\includegraphics[height=.45\textheight]{Figure/probabilistic_programming_languages}
\end{figure}
\end{itemize}
}
\frame{
\frametitle{What to expect from HMC?}
\begin{indented}
HMC is typically superior to more traditional general-purpose samplers:
\end{indented}
\begin{figure}
\includegraphics[width=.85\textwidth]{Figure/random_walk_metropolis_vs_hmc_on_100dim_Gaussian}
\caption{Comparison on a 100-dimensional Gaussian after accounting for computational costs by thinning RWM \citep{neal2010hmc}.}
% Note: $\bSigma^{1/2} = \textrm{diag}(0.01, 0.02, \ldots, 1)$
% Note: counting 150 random-walk Metropolis updates as one iteration
\end{figure}
}
\frame{
\frametitle{What to expect from HMC}
\begin{itemize}
\item HMC can handle a large class of posteriors for not-overly-complicated models with moderate sized data, but is \emph{not} a silver-bullet.
\pause
\item Performance of HMC is sensitive to
\begin{itemize}
\item structure / geometry of the target distribution.
\item parametrization of the model.
\item tuning parameters (which may be adjusted during a ``warm-up'').
\end{itemize}
\pause
\item In general, prefer
\vspace{-.75\baselineskip}
\begin{multline*}
\text{model-specific inference algorithm by an expert} \\
> \text{probabilistic programming implementation} \\
> \text{your own code}. \hspace{.05\linewidth}
\end{multline*} \vspace{-1.5\baselineskip}
\item When the data actually call for the power of custom Bayesian modeling, HMC is a reasonable option for posterior computation.
% Note: ``once the data gets large enough or the model gets complex enough, one will pay the price in terms of computational time.''
\end{itemize}
}
\frame{
\frametitle{HMC at its best}
\begin{itemize}
\item Some softwares (e.g.\ \texttt{rstanarm}) incorporate model-specific best practices in applying HMC, yielding quite impressive performance.
\begin{itemize}
\item Given the complexity of applying HMC effectively, using these softwares is a good way to get a sense of HMC's capability.
\end{itemize}
\item Some cutting-edge Bayesian methods rely on HMC for posterior computation with competitive computational efficiency.
\begin{itemize}
\item e.g.\ Bayesian sparse regression for GLM and survival analysis
\end{itemize}
\end{itemize}
}
\frame{
\frametitle{Learning objectives: things to take home with}
\begin{itemize}
\item Sensitivity of HMC's performance means that, even as an end-user, one benefits from basic understandings of the algorithm.
\item Hopefully, you will
\begin{itemize}
\item be able to diagnose why (and fix if possible) when sampling fails.
\item know when to change default parameters in software packages.
\item know how to parametrize your model for best HMC performance.
% \item develop intuitions as to when posterior computation is feasible.
% \item be familiar with research frontiers and improvements on the way.
\end{itemize}
\end{itemize}
}
\subsection{History \& Motivation behind HMC}
\frame{
\frametitle{History of ``H''MC}
\begin{itemize}
\item Invented as ``hybrid'' Monte Carlo in computational physics literature for computer simulation of lattice models in quantum field theory \citep{duane1987hmc}.
\inlineNote{HMC may seem to come from nowhere, so a bit of history to help.}%
\item At the time, there were two dominant approaches:
\begin{itemize}
\item Monte Carlo simulation based on ``local'' moves, changing the state of one particle at a time.
\item molecular dynamics simulation with ``global'' moves by numerically solving \textit{equations of motion}.
\end{itemize}
\item ``Hybrid'' Monte Carlo combined the efficiency of molecular dynamics with Metropolis algorithm to ensure the exact stationary distribution.
\end{itemize}
}
\frame{
\frametitle{What does Hamiltonian dynamics have to do with MCMC?}
\begin{itemize}
\item Two (often competing) objectives in constructing a proposal density:
\begin{itemize}
\item you want to make ``large" moves to explore the space.
\item you want sufficiently high acceptance rates.
\end{itemize}
\pause
\item e.g.\ random-walk Metropolis for $\nparam$-dimensional Gaussians:
\begin{itemize}
\item As $d \to \infty$, proposal variance needs to scale proportional to $1 / d$ to maintain a positive acceptance rate.
\item With proposal variance $\propto 1 / d$, it takes $\nparam$ steps for the chain to travel a unit distance in each coordinate.
\item Cost of generating one effective sample then is proportional to
\begin{itemizedEquation*}
\nparam \times \text{(cost of likelihood evaluation)}.
\end{itemizedEquation*}
% Note: the cost is often described as $O(d^2)$ in the literature under the assumption that the likelihood evaluation costs $O(d)$.
\end{itemize}
\pause
\item Question: can we generate proposals that are far away from the current state, yet still maintains high acceptance rate?
\pause
\begin{itemize}
\item Yes, use Hamiltonian dynamics to generate proposals!
\item In particular, HMC has the cost of $O(d^{1 / 4})$ in the above example.
\end{itemize}
\end{itemize}
}
\subsection{First look at HMC algorithm}
\frame{
\frametitle{Set-up and terminologies for HMC}
\begin{itemize}
\item To sample from the distribution of interest $\pi_\Position(\bposition)$, HMC augments the parameter space with an auxiliary parameter $\bmomentum \in \mathbb{R}^\nparam \sim \normal(\mathbf{0}, m \I)$.
\item HMC then samples from the joint density
\begin{itemizedEquation*}
\pi(\bposition, \bmomentum)
\propto \pi_\Position(\bposition) \times \mathcal{N}\left( \bmomentum \, ; \mathbf{0}, m \I \right)
\end{itemizedEquation*}
where $\bposition$ and $\bmomentum$ are referred to as \textit{position} and \textit{momentum} variables.
\pause
\item HMC terminologies:
\begin{itemize}
\item $U(\bposition) = - \log \pi_\Theta(\bposition)$ : \textit{potential energy}.
\item $K(\bmomentum) = - \log \pi_{\Momentum}(\bmomentum) = \frac{1}{m} \bmomentum^\transpose \bmomentum$ : \textit{kinetic energy}.
\item $H(\bposition, \bmomentum) = U(\bposition) + K(\bmomentum) = - \log \pi(\bposition, \bmomentum)$ : \newline \phantom{$H(\bposition, \bmomentum) = U(\bposition) + K(\bmomentum)$ =} \textit{Hamiltonian} or \textit{total energy}.
\end{itemize}
\end{itemize}
}
\frame{
\frametitle{Transition kernel of HMC}
\begin{itemize}
\item HMC generates a proposal by combining momentum randomization and \textit{deterministic} transition of simulated Hamiltonian dynamics.
\end{itemize}
\begin{block}{HMC transition rule}
Given the current state $(\bposition_0, \bmomentum_0)$, HMC generates the next state as follows:
\begin{enumerate}[<+->]
\item Randomize momentum: $\bmomentum_0 \sim \mathcal{N}\left(\mathbf{0}, m \I \right)$.
\item Generate a proposal $(\bposition^*, \bmomentum^*) \approx (\bposition(\integrationTime), - \bmomentum(\integrationTime))$ by approximating \newline the solution $\left\{ (\bposition(t), \bmomentum(t)) : t \in [0, \integrationTime] \right\}$ of \textit{Hamilton's equation}
\vspace{-.3\baselineskip}
\begin{equation} \label{eq:hamilton}
\vspace{-.3\baselineskip}
\begin{aligned}
\frac{\diff \bposition}{\diff t}
&= m^{-1} \bmomentum, \quad
\frac{\diff \bmomentum}{\diff t}
= - \nabla_{\bposition} U(\bposition)
\end{aligned}
\end{equation}
with initial condition $(\bposition(0), \bmomentum(0)) = (\bposition_0, \bmomentum_0)$.
\item Accept or reject the proposal with the acceptance probability
\begin{itemizedEquation*}
\min\left\{1, \pi(\bposition^*, \bmomentum^*) / \pi(\bposition, \bmomentum) \right\}.
\end{itemizedEquation*}
\vspace*{-\baselineskip}
\end{enumerate}
\end{block}
}
\frame{
\frametitle{Physical interpretation of HMC trajectories}
\begin{itemize}
\item Hamilton's equation describes a motion of a particle with mass $m$ under the potential energy field $U(\bposition)$:
\begin{itemizedEquation*}
\begin{aligned}
\text{``velocity''}
&= \frac{\diff \bposition}{\diff t}
= m^{-1} \bmomentum
\\
\text{``mass $\times$ acceleration''}
&= \frac{\diff \bmomentum}{\diff t}
= - \nabla_{\bposition} U(\bposition)
= \text{``force''}
\end{aligned}
\end{itemizedEquation*}
\item Trajectory $\bposition(t)$ accelerates toward lower values of the potential $U(\bposition)$ or, equivalently, larger values of $\log \pi_\Position(\bposition) = - U(\bposition)$.
\end{itemize}
}
\frame{
\frametitle{Visual illustration: HMC in action}
\begin{center}
\href{http://chi-feng.github.io/mcmc-demo/}{\color{linkColor} \fontsize{16pt}{18pt} \selectfont MCMC animations (Credit: Chi Feng)}
\end{center}
}
\section{Theory of HMC: exactness \& high acceptance rate}
\subsection{Exactness of HMC at stationarity}
\frame{
\frametitle{HMC as a valid Metropolis algorithm}
\begin{itemize}
\item Hamiltonian dynamics generates a \textit{symmetric} proposal
\begin{itemizedEquation*}
\proposalKernel\left\{ (\bposition, \bmomentum) \to (\bposition^*, \bmomentum^*) \right\}
= \proposalKernel\left\{ (\bposition^*, \bmomentum^*) \to (\bposition, \bmomentum) \right\}
\end{itemizedEquation*}
by virtue of its \textit{reversibility} (and \textit{volume-preservation}).
\inlineNote{`volume-preservation' in () since we can do without it.}%
\pause
\begin{itemize}
\item For a deterministic proposal kernel, interpret the symmetry as
\begin{itemizedEquation*}
\proposalKernel\left\{ S \to S^* \right\}
= \proposalKernel\left\{ S^* \to S \right\}
\end{itemizedEquation*}
for a pair of sets $S$ and $S^*$.
\end{itemize}
\inlineNote{in case the audience is bothered by the "delta measure" proposal.}%
\pause
\item Evolution of Hamiltonian dynamics can be ``reversed'' (or ``inverted'') by flipping momentum and applying the same dynamics:
\begin{itemizedEquation*}
(\bposition, \bmomentum) \to (\bposition', \bmomentum')
\quad \Leftrightarrow \quad
(\bposition', -\bmomentum') \to (\bposition, -\bmomentum)
\end{itemizedEquation*}
\end{itemize}
}
\frame{
\frametitle{Symmetry via reversibility of Hamiltonian dynamics}
\inlineNote{a bit heavy on math notions, but just to be precise on reversibility.}%
\begin{itemize}
\item Let $\{ \solutionOp_t \}_{t \in \mathbb{R}}$ denote the \textit{solution operator} of dynamics i.e.\
\begin{itemizedEquation*}
(\bposition(t), \bmomentum(t)) := \solutionOp_t(\bposition, \bmomentum)
\end{itemizedEquation*}
solves Hamilton's equations and $\solutionOp_0(\bposition, \bmomentum) = (\bposition, \bmomentum)$.
\item Let $\involution(\bposition, \bmomentum) = (\bposition, - \bmomentum)$ denote the momentum flip operator.
\item \textit{Reversibility} of dynamics means that
\begin{itemizedEquation*}
\left( \involution \circ \solutionOp_t \right)^{-1} = \involution \circ \solutionOp_t
\ \text{ for all } \ t \in \mathbb{R}.
\end{itemizedEquation*}
\end{itemize}
\vspace{-.5\baselineskip}
\begin{figure}
\centering
\includegraphics[height=.45\textheight]{Figure/reversible_map}
\end{figure}
}
\frame{
\frametitle{Geometric / structure-preserving numerical integration}
\begin{itemize}
\item In practice, Hamiltonian dynamics must be numerically approximated.
\item \textit{Integrator} refers to an algorithm for approximating solutions of ODEs.
\item For an approximate dynamics to remain a valid proposal mechanism, the integrator must preserve reversibility (and volume-preservation).
\pause
\inlineNote{Update equations need to be untangled a bit.}%
\item To approximate the evolution from time $t$ to $t + \stepsize$ of dynamics
\begin{itemizedEquation*}
\frac{\diff \bposition}{\diff t}
= m^{-1} \bmomentum, \quad
\frac{\diff \bmomentum}{\diff t}
= - \nabla U(\bposition),
\end{itemizedEquation*}
the \textit{leapfrog} (or \textit{velocity Verlet}) method carries out the updates
\begin{itemizedEquation*}
\arraycolsep=2pt
\def\arraystretch{1.75}
\begin{array}{ccccc}
\bmomentum_{t + \stepsize / 2}
&=& \bmomentum_t
&-& \displaystyle \frac{\stepsize}{2} \nabla U(\bposition_t) \\
\bposition_{t + \stepsize}
&=& \bposition_t
&+& \stepsize \, m^{-1} \bmomentum_{t + \stepsize / 2} \\
\bmomentum_{t + \stepsize}
&=& \bmomentum_{t + \stepsize / 2}
&-& \displaystyle \frac{\stepsize}{2} \nabla U(\bposition_{t + \stepsize}).
\end{array}
\end{itemizedEquation*}
\item Map $\solutionOp_{\stepsize}^\nIntegrationStep$ induced by $\nIntegrationStep(\tau) = \lfloor \tau / \stepsize \rfloor$ steps of the leapfrog updates approximate the exact evolution from time $t = 0$ to $t = \integrationTime$.
\end{itemize}
}
\subsection{High acceptance rate of HMC proposals}
\frame{
\frametitle{Invariance of the target under Hamiltonian dynamics}
\begin{itemize}
\item If we could solve Hamiltonian dynamics exactly, then HMC proposals would have $100\%$ (!) acceptance rates.
\item In essence, this is because the target $\pi(\cdot, \cdot)$ is an \textit{invariant} distribution of the dynamics --- if $(\bposition, \bmomentum) \sim \pi(\cdot, \cdot)$, then $\solutionOp_t(\bposition, \bmomentum) \sim \pi(\cdot, \cdot)$ for all $t$.
\pause
\item With numerical approximation, acceptance rate of HMC proposals converges to 1 as $\stepsize \to 0$ for a fixed $\tau$ and $\nIntegrationStep(\tau) = \lfloor \tau / \stepsize \rfloor$.
\end{itemize}
}
\if\generalAcceptProbFormula1
\frame{
\frametitle{Acceptance probability of reversible map proposals}
\begin{itemize}
\item For a general reversible map $\solutionOp$, the correct acceptance probability of a proposal $(\bposition^*, \bmomentum^*) = \solutionOp(\bposition, \bmomentum)$ is given by
\begin{itemizedEquation*}
\min \! \left\{
1, \, \frac{
\pi(\bposition^*, \bmomentum^*) \left| \Diff \solutionOp(\bposition, \bmomentum) \right|
}{
\pi(\bposition, \bmomentum)}
\right\}.
\end{itemizedEquation*}
\vspace{-.5\baselineskip}
\begin{itemize}
\item To see why the Jacobian is needed, recall that the density of a transformed variables $(\bposition^*, \bmomentum^*) = \solutionOp(\bposition, \bmomentum)$ is given as
\begin{itemizedEquation*}
\pi_{\Position^*, \, \Momentum^*}(\bposition^*, \bmomentum^*)
= \pi_{\Position, \, \Momentum}(\bposition, \bmomentum) \left| \Diff \solutionOp(\bposition, \bmomentum) \right|^{-1}.
\end{itemizedEquation*}
\end{itemize}
\pause
\item Hamiltonian dynamics and its leapfrog approximation are both volume-preserving, meaning $\left| \Diff \solutionOp_{\integrationTime} \right| = \left| \Diff \solutionOp_{\stepsize}^\nIntegrationStep \right| = 1$.
\item Hence, the acceptance probability of an HMC proposal is
\begin{itemizedEquation*}
\min \! \left\{
1, \, \frac{
\pi(\bposition^*, \bmomentum^*)
}{
\pi(\bposition, \bmomentum)}
\right\}
= \min \! \left\{
1, \, \exp( - \Delta H)
\right\}.
\end{itemizedEquation*}
where $\Delta H = H(\bposition^*, \bmomentum^*) - H(\bposition, \bmomentum)$.
\inlineNote{Note how the magnitude \& sign of $\Delta H$ affect the acceptance rate.}
\end{itemize}
}
\fi
\frame{
\frametitle{Energy-conservation property for high acceptance rate}
\begin{itemize}
\if\generalAcceptProbFormula0
\item Acceptance probability is, in terms of $\Delta H = H(\bposition^*, \bmomentum^*) - H(\bposition, \bmomentum)$,
\begin{itemizedEquation*}
\min \! \left\{
1, \, \pi(\bposition^*, \bmomentum^*) / \pi(\bposition, \bmomentum)
\right\}
= \min \! \left\{
1, \, \exp( - \Delta H)
\right\}.
\end{itemizedEquation*}
\pauseWithoutSpace
\fi
\item Hamiltonian dynamics is \textit{energy-conserving}, meaning the Hamiltonian remains constant along its trajectory $(\bposition(t), \bmomentum(t))$:
\begin{itemizedEquation*}
H(\bposition(t), \bmomentum(t))
= H(\bposition(0), \bmomentum(0))
\ \text{ for all } \ t.
\end{itemizedEquation*}
\pauseWithoutSpace
\item With the leapfrog approximation for a fixed $\integrationTime$, the error is
\begin{itemizedEquation*}
\Delta H
= H(\bposition_{\nIntegrationStep \stepsize}, \bmomentum_{\nIntegrationStep \stepsize})
- H(\bposition_{0}, \bmomentum_{0})
= O(\stepsize^2).
\end{itemizedEquation*}
\item Metropolis proposals in general satisfies, as $\Delta H \to 0$,
\begin{itemizedEquation*}
\mathbb{E}\left[ \Delta H \right]
\approx \mathbb{E}\left[ \Delta H^2 \right] / \, 2.
\end{itemizedEquation*}
% Note: we have an actual bound $E[\Delta H] \leq E[\Delta H^2]$ for a reversible dynamics-based proposal.
% Note: the above relation holds for any Metropolis type algorithm
\item HMC proposals thus satisfies $\mathbb{E}[\Delta H] = O(\stepsize^{\textcolor{highlightedTextColor}{4}})$ as $\stepsize \to 0$.
\pause
\item e.g.\ HMC generates one effective sample from a $\nparam$-dimensional Gaussian $\normal(\bm{0}, \I)$ with the cost of
\begin{itemizedEquation*}
\nparam^{1 / 4} \times \text{(cost of likelihood \& gradient evaluation)}.
\end{itemizedEquation*}
\end{itemize}
}
\subsection{Summary \& 2nd look at HMC algorithm}
\frame{
\frametitle{Summary: theory of HMC}
\begin{itemize}
\baselineskip=16pt
\item Reversibility (\& volume-preservation) of Hamiltonian dynamics \\
\hspace*{2em} $\Rightarrow$ Symmetry of HMC proposals \\
\hspace*{5em} $\Rightarrow$ HMC as a valid Metropolis algorithm
\vspace{.5\baselineskip}
\item Volume-preservation \& Energy-conservation \\
\hspace*{2em} $\Rightarrow$ Invariance of the target under Hamiltonian dynamics \\
\hspace*{5em} $\Rightarrow$ High acceptance rate of HMC proposals
\end{itemize}
}
\frame{
\frametitle{Another look at HMC transition kernel}
\vspace{-.3\baselineskip}
\begin{itemize}
\item Having covered details, here is a more precise and general description.% we now state the algorithm more precisely.
\begin{itemize}
\item \textit{Mass} $\Mass = \textrm{Var}(\bmomentum)$ need not to be proportional to the identity.
\item Momentum flip is optional since $\pi(\bposition, \bmomentum) = \pi(\bposition, -\bmomentum)$.
\end{itemize}
\end{itemize}
\vspace{-.3\baselineskip}
\begin{block}{HMC transition rule}
Given the current state $(\bposition_0, \bmomentum_0)$, HMC generates the next state as follows:
\begin{enumerate}
\item Randomize momentum: $\bmomentum_0 \sim \mathcal{N}\left(\mathbf{0}, \textcolor{highlightedTextColor}{\Mass} \right)$.
\item Generate a proposal $(\bposition^*, \bmomentum^*) \approx (\bposition(\integrationTime), \textcolor{highlightedTextColor}{\pm} \bmomentum(\integrationTime))$ \textcolor{highlightedTextColor}{by using the leapfrog integrator} to approximate the solution of Hamilton's equation
\vspace{-.5\baselineskip}
\begin{equation}
\vspace{-.5\baselineskip}
\begin{aligned}
\frac{\diff \bposition}{\diff t}
&= \textcolor{highlightedTextColor}{\Mass^{-1}} \bmomentum, \quad
\frac{\diff \bmomentum}{\diff t}
= - \nabla_{\bposition} U(\bposition)
\end{aligned}
\end{equation}
with initial condition $(\bposition(0), \bmomentum(0)) = (\bposition_0, \bmomentum_0)$.
\item Accept or reject the proposal with the acceptance probability
\begin{itemizedEquation*}
\min\left\{1, \pi(\bposition^*, \bmomentum^*) / \pi(\bposition, \bmomentum) \right\}.
\end{itemizedEquation*}
\vspace{-\baselineskip}
\end{enumerate}
\end{block}
}
\frame{
\frametitle{Another look at HMC transition kernel}
\vspace{-.3\baselineskip}
\begin{itemize}
\item Same theories justify a more general version below.
\begin{itemize}
\item Any symmetric, potentially position-dependent, distribution can be employed for momentum: $- \bmomentum \given \bposition \eqDistribution \bmomentum \given \bposition \sim \pi_{\Momentum \given \Position}(\, \cdot \given \bposition)$.
\item Note: \textit{symplectic} integrators are volume-preserving.
% Note: \textit{symplectic} integrators, commonly discussed in the HMC literature, are volume-preserving.
\end{itemize}
\end{itemize}
\vspace{-.3\baselineskip}
\begin{block}{HMC transition rule}
Given the current state $(\bposition_0, \bmomentum_0)$, HMC generates the next state as follows:
\begin{enumerate}
\item Randomize momentum: \textcolor{highlightedTextColor}{$\bmomentum_0 \given \bposition_0 \sim \pi_{\Momentum \given \Position}(\, \cdot \given \bposition_0)$}.
\item Generate a proposal $(\bposition^*, \bmomentum^*) \approx (\bposition(\integrationTime), \bmomentum(\integrationTime))$ by using \textcolor{highlightedTextColor}{a reversible and volume-preserving integrator} to solve Hamilton's equation
\vspace{-.5\baselineskip}
\begin{equation}
\vspace{-.5\baselineskip}
\begin{aligned}
\frac{\diff \bposition}{\diff t}
&= \textcolor{highlightedTextColor}{\nabla_{\bmomentum} K(\bposition, \bmomentum)}, \quad
\frac{\diff \bmomentum}{\diff t}
= - \nabla_{\bposition} U(\bposition)
\end{aligned}
\end{equation}
with initial condition $(\bposition(0), \bmomentum(0)) = (\bposition_0, \bmomentum_0)$.
\item Accept or reject the proposal with the acceptance probability
\begin{itemizedEquation*}
\min\left\{1, \pi(\bposition^*, \bmomentum^*) / \pi(\bposition, \bmomentum) \right\}.
\end{itemizedEquation*}
\vspace{-\baselineskip}
\end{enumerate}
\end{block}
}
\subsection*{References}
\frame{
\frametitle{References: HMC theory}
\begin{indented}
Overviews of (the basic version of) HMC in theory and practice are provided by
\end{indented}
\begin{itemize}
\item \fullcite{neal2010hmc}
\end{itemize}
\begin{indented}
Another review paper with alternative perspectives:
\end{indented}
\begin{itemize}
\item \fullcite{betancourt2017intro-hmc}
\end{itemize}
}
\frame{
\frametitle{References: HMC theory}
\begin{indented}
Notable extensions and generalization of the basic HMC:
\end{indented}
\begin{itemize}
\item \fullauthorcite{girolami2011rmhmc}
\item \fullauthorcite{fang2014compressible-hmc}
\item \fullauthorcite{nishimura2017discontinuous-hmc}
\end{itemize}
}
\section{Example: HMC on Gaussian targets}
\frame{
\frametitle{Table of Contents}
\tableofcontents[
currentsection,
sectionstyle=show/shaded,
subsectionstyle=show/shaded/hide
]
}
\frame{
\frametitle{Example: HMC on Gaussian targets}
\begin{itemize}
\item HMC's behavior on Gaussian targets can be quantified explicitly.
\item Arguably the easiest case for HMC, but illustrate many of the characteristic properties.
\item Some of the things to pay attention to:
\begin{itemize}
\item ``periodic'' behavior of HMC trajectories.
\item how a choice of integration time $\integrationTime$ or path length $L = \lfloor \integrationTime / \stepsize \rfloor$ affects the mixing rate.
\item acceptance rate as a function of integrator stepsize $\stepsize$.
\end{itemize}
\end{itemize}
}
\frame{
\frametitle{HMC on univariate Gaussian target}
\begin{itemize}
\item We first consider HMC's behavior for $\position \sim \normal(0, \sigma^2)$, $\momentum \sim \normal(0, 1)$ or
\begin{itemizedEquation*}
U(\position) = - \log \pi_{\Position}(\position) = \frac{\position^2}{2 \sigma^2} + \textrm{const}, \ \
K(\momentum) = \frac{\momentum^2}{2}.
\end{itemizedEquation*}
\item Corresponding dynamics is described by
\begin{itemizedEquation*}
\frac{\diff \position}{\diff t} = \momentum, \ \
\frac{\diff \momentum}{\diff t} = - \frac{\position}{\sigma^2}
\ \ \text{ or equivalently } \ \
\frac{\diff^2 \position}{\diff t^2} = - \frac{\position}{\sigma^2}
.
\end{itemizedEquation*}
\pauseWithoutSpace
\item Solution coincides with a harmonic oscillator of period $2 \pi \sigma$:
\begin{itemizedEquation*}
\position(t)
= \position_0 \cos(t / \sigma) + \momentum_0 \, \sigma \sin(t / \sigma).%
% , \ \ \momentum(t) = \dot{\position}(t)
\end{itemizedEquation*}%
\pauseWithoutSpace
\item If $\position_0 \sim \normal(0, \sigma^2)$ and $\momentum_0 \sim \normal(0, 1)$, then $\position(t) \sim \normal(0, \sigma^2)$ for all $t$ and \vspace{-.7\baselineskip}
\begin{itemizedEquation*}
\position(\integrationTime)
= \momentum_0 \, \sigma
\indep \position_0
\ \text{ for } \ \integrationTime = \pi \sigma / 2.
\end{itemizedEquation*}
\end{itemize}
}
\frame{
\frametitle{Leapfrog dynamics \& stability limit on integrator stepsize}
\inlineNote{Mathematical details not so important on the next few slides! Main things to note are stability limit and integration time choice.}
\begin{itemize}
\item In case of a Gaussian target, one leapfrog can be expressed as
\begin{itemizedEquation*}
\begin{bmatrix}
\position_{n \stepsize} \\ \momentum_{n \stepsize}
\end{bmatrix}
=
{\def\arraystretch{1.5}
\begin{bmatrix}
1 - \frac{\stepsize^2}{2 \sigma^2} & \stepsize \\
- \frac{\stepsize}{\sigma^2} + \frac{\stepsize^3}{4 \sigma^4} & 1 - \frac{\stepsize^2}{2 \sigma^2}
\end{bmatrix}
}
\begin{bmatrix}
\position_{(n - 1) \stepsize} \\ \momentum_{(n - 1) \stepsize}
\end{bmatrix}.
\end{itemizedEquation*}
\item Eigenvalues of the leapfrog map $\solutionOp_{\stepsize}$ have magnitude $< 1$ if and only if the stepsize is within the \textit{stability region} $\stepsize < 2 \sigma$.
\item For $\stepsize > 2 \sigma$, the acceptance rate effectively drops to 0.
\end{itemize}
}
\frame{
\frametitle{Leapfrog dynamics \& stability limit on integrator stepsize}
\begin{itemize}
\item For $\stepsize < 2 \sigma$, we have the following formula for $\solutionOp_{\stepsize}^n$:
\begin{itemizedEquation*}
\begin{bmatrix}
\position_{n \stepsize} \\ \momentum_{n \stepsize}
\end{bmatrix}
=
\arraycolsep=0pt
\begin{bmatrix}
\cos(n \phi)
& \sigma \left( 1 - \frac{\stepsize^2}{4 \sigma^2} \right)^{\text{\tiny $-1/2$}} \sin(n \phi) \\
- \frac{1}{\sigma} \left( 1 - \frac{\stepsize^2}{4 \sigma^2} \right)^{\text{\tiny $1/2$}} \sin(n \phi)
& \cos(n \phi)
\end{bmatrix}
\begin{bmatrix}
\position_{0} \\ \momentum_{0}
\end{bmatrix}
\end{itemizedEquation*}
where $\phi = \phi(\stepsize / \sigma) = \cos^{-1}\!\left( 1 - \frac{\stepsize^2}{2 \sigma^2} \right)$.
\item Since $\cos^{-1}(1 - \delta^2 / 2) \approx \delta$, we have $\phi \approx \stepsize / \sigma$ as $\stepsize / \sigma \to 0$.
\item For $\stepsize$ sufficiently small, a choice $\nIntegrationStep \approx \frac{\pi \sigma}{2 \stepsize}$ yields
\begin{itemizedEquation*}
\cos(L \phi) \approx 0
\ \text{ \& } \sin(L \phi) \approx 1
\end{itemizedEquation*}
and the proposal $(\position_{\nIntegrationStep \stepsize}, \momentum_{\nIntegrationStep \stepsize})$ approximately independent of $(\position_{0}, \momentum_{0})$.
\end{itemize}
}
\frame{
\frametitle{Acceptance rate / Hamiltonian error as function of stepsize}
\begin{itemize}
\item Acceptance probability is given as $\min\{1, \exp(-\Delta H)\}$ where
\begin{itemizedEquation*}
\Delta H
= - \log \frac{
\pi(\position_{\nIntegrationStep \stepsize}, \momentum_{\nIntegrationStep \stepsize})
}{
\pi(\position_{0}, \momentum_{0})
}.
\end{itemizedEquation*}
\pauseWithoutSpace
\item After tedious calculation, we can show that
\begin{itemizedEquation*}
\mathbb{E} \left[ \Delta H \right]
= \frac{\stepsize^4}{\sigma^4}
\left( 1 - \frac{\stepsize^2}{4 \sigma^2} \right)^{-1}
\frac{\sin^2(\nIntegrationStep \phi)}{32}.
\end{itemizedEquation*}
\end{itemize}
\begin{figure}
\centering
\begin{minipage}{.5\linewidth}
\includegraphics[height=.4\textheight]{Figure/ave_hamiltonian_error_on_gaussian_target}
\end{minipage}
\begin{minipage}{.425\linewidth}
\vspace{-\baselineskip}
\caption{Average Hamiltonian error $\mathbb{E} \left[ \Delta H \right]$ as a function of $\stepsize$ \\ when $\integrationTime = 2 \pi \sigma$ and $\nIntegrationStep = \lceil \integrationTime / \stepsize \rceil$.}
\end{minipage}
\end{figure}
}
\frame{
\frametitle{HMC on multivariate Gaussians}
\begin{itemize}
\item Consider the target $\bposition \sim \normal(\bm{0}, \bm{\Sigma})$, $\bmomentum \sim \normal(\bm{0}, \I)$.
\item With the identity mass, HMC's performance turns out to be invariant under rotation of the parameter i.e.\ we can assume that $\bSigma$ is diagonal.
\pause
\item With $U(\bposition) = \sum_{i = 1}^\nparam \frac{\position_i^2}{2 \sigma_i^2}$ and $K(\bmomentum) = \sum_{i = 1}^\nparam \frac{p_i^2}{2}$, Hamilton's equation decouples into $\nparam$ independent one-dimensional equations:
\begin{itemizedEquation*}
\frac{\diff \position_i}{\diff t} = \momentum_i, \ \
\frac{\diff \momentum_i}{\diff t} = - \frac{\position_i}{\sigma_i^2}
\ \ \text{ for } \ \
i = 1, \ldots, \nparam.
\end{itemizedEquation*}
\pauseWithoutSpace
\item Leapfrog update also decouples into one-dimensional updates:
\begin{itemize}
\item Direction with the \textit{smallest} variance determines the overall stability limit of $\stepsize < 2 \min_i \sigma_i$.
\item Direction with the \textit{largest} variance determines the necessary number of leapfrog steps $L \approx \frac{\pi}{2 \stepsize} \max_i \sigma_i$.
\item Error accumulates over the coordinates: $\Delta H = \sum_i \Delta H_i$.
\end{itemize}
\end{itemize}
}
\frame{
\frametitle{Computational cost of HMC on multivariate Guassians}
\begin{itemize}
\item Computational cost is $\propto L \propto \frac{\sigma_{\max}}{\stepsize}$. What $\stepsize$ to use?
\pause
\item Stability limit is $\stepsize < 2 \sigma_{\min}$, but does not guarantee small $\Delta H$. Two major sources of the total error $\Delta H$ are
\begin{enumerate}
\item small errors accumulated over many parameters.
\item large errors in a small number of ``tightly constrained'' directions.
\end{enumerate}
\pause
\item In an extreme case $\sigma_i = \sigma_0$ for all $i$'s, we have
\begin{itemizedEquation*}
\mathbb{E}\left[ \Delta H \right]
= \nparam \times \mathbb{E} \left[ \Delta H_1 \right]
\propto \nparam \times \stepsize^4.
\end{itemizedEquation*}
\vspace{-\baselineskip}
\begin{itemize}
\item Need $\Delta t \propto d^{-1/4}$ to maintain a positive acceptance rate.
\item Computational costs becomes $\propto d^{1 / 4}$.
\end{itemize}
\pause
\item In another extreme case $\sigma_m = \sigma_{\min} \ll \sigma_i$ for $i \neq m$, the error is completely dominated by $\Delta H_{m}$.
\begin{itemize}
\item Since $\mathbb{E} \left[ \Delta H_i \right] \propto (\stepsize / \sigma_i)^4$ and $\stepsize < 2 \sigma_{\min}$, there are little contributions to the overall error from $\Delta H_i$ for $i \neq m$. %$i \neq \argmin_j \sigma_j$
\item Computational costs becomes $\propto \sigma_{\max} / \sigma_{\min}$ --- the ratio \\ between the largest and smallest ``widths'' of the target.
\end{itemize}
\end{itemize}
}
\subsection*{References}
\frame{
\frametitle{References: HMC on Gaussian targets}
\begin{indented}
Similar analysis is carried out in
\end{indented}
\begin{itemize}
\item \fullauthorcite{beskos2013optimal-hmc}
\end{itemize}
}
\section{Tuning HMC: theory and practice}
\frame{
\frametitle{Table of Contents}
\tableofcontents[
currentsection,
sectionstyle=show/shaded,
subsectionstyle=show/shaded/hide
]
}
\frame{
\frametitle{Tuning parameters of HMC}
\begin{itemize}
\item Performance of HMC depends critically on the choice of
\begin{itemizedEquation*}
\arraycolsep=2pt
\def\arraystretch{1.2}
\begin{array}{ccl}
\Mass = \textrm{Var}(\bmomentum)
&:& \text{mass matrix} \\
\integrationTime \, \text{ or } \, L = \lfloor \integrationTime / \stepsize \rfloor
&:& \text{integration time\, or\, path length} \\
\stepsize
&:& \text{integrator stepsize}
\end{array}
\end{itemizedEquation*}
\item Bayesian software packages automatically tune these parameters behind the scene.
\begin{itemize}
\item These tuning algorithms yet again have tuning parameters (!). The default values are reasonable, but certainly not perfect.
\item Manual adjustment of the tuning algorithm parameters is often necessary.
\end{itemize}
\end{itemize}
}
\subsection{Mass matrix for preconditioning target distribution}
\frame{
\frametitle{Mass matrix for linear parameter transformation}
\begin{itemize}
\item \textbf{Fact :} HMC's performance remains identical whether sampling from the (joint) parameter space $(\bm{A} \bposition, \bmomentum)$ and from $(\bposition, \bm{A}^\transpose \bmomentum)$.
\pause
\item When using the identity mass $\Mass = \I$,
\begin{itemize}
\item the computational cost tends to increase as the ratio between the largest and smallest ``widths'' of the target does.
\item (linear) reparametrization $\bposition \to \bSigma^{-1/2} \bposition$ for $\bSigma = \text{Var}(\bposition)$ often improves the efficiency.
\end{itemize}